home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / sys / syslog.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  7.4 KB  |  213 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    syslog.h,v $
  29.  * Revision 2.1  92/04/21  17:17:49  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*
  36.  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
  37.  * All rights reserved.
  38.  *
  39.  * Redistribution and use in source and binary forms, with or without
  40.  * modification, are permitted provided that the following conditions
  41.  * are met:
  42.  * 1. Redistributions of source code must retain the above copyright
  43.  *    notice, this list of conditions and the following disclaimer.
  44.  * 2. Redistributions in binary form must reproduce the above copyright
  45.  *    notice, this list of conditions and the following disclaimer in the
  46.  *    documentation and/or other materials provided with the distribution.
  47.  * 3. All advertising materials mentioning features or use of this software
  48.  *    must display the following acknowledgement:
  49.  *    This product includes software developed by the University of
  50.  *    California, Berkeley and its contributors.
  51.  * 4. Neither the name of the University nor the names of its contributors
  52.  *    may be used to endorse or promote products derived from this software
  53.  *    without specific prior written permission.
  54.  *
  55.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  56.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  57.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  58.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  59.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  60.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  61.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  62.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  63.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  64.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  65.  * SUCH DAMAGE.
  66.  *
  67.  *    @(#)syslog.h    7.20 (Berkeley) 2/23/91
  68.  */
  69.  
  70. #define    _PATH_LOG    "/dev/log"
  71.  
  72. /*
  73.  * priorities/facilities are encoded into a single 32-bit quantity, where the
  74.  * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
  75.  * (0-big number).  Both the priorities and the facilities map roughly
  76.  * one-to-one to strings in the syslogd(8) source code.  This mapping is
  77.  * included in this file.
  78.  *
  79.  * priorities (these are ordered)
  80.  */
  81. #define    LOG_EMERG    0    /* system is unusable */
  82. #define    LOG_ALERT    1    /* action must be taken immediately */
  83. #define    LOG_CRIT    2    /* critical conditions */
  84. #define    LOG_ERR        3    /* error conditions */
  85. #define    LOG_WARNING    4    /* warning conditions */
  86. #define    LOG_NOTICE    5    /* normal but significant condition */
  87. #define    LOG_INFO    6    /* informational */
  88. #define    LOG_DEBUG    7    /* debug-level messages */
  89.  
  90. #define    LOG_PRIMASK    0x07    /* mask to extract priority part (internal) */
  91.                 /* extract priority */
  92. #define    LOG_PRI(p)    ((p) & LOG_PRIMASK)
  93. #define    LOG_MAKEPRI(fac, pri)    (((fac) << 3) | (pri))
  94.  
  95. #ifdef SYSLOG_NAMES
  96. #define    INTERNAL_NOPRI    0x10    /* the "no priority" priority */
  97.                 /* mark "facility" */
  98. #define    INTERNAL_MARK    LOG_MAKEPRI(LOG_NFACILITIES, 0)
  99. typedef struct _code {
  100.     char    *c_name;
  101.     int    c_val;
  102. } CODE;
  103.  
  104. CODE prioritynames[] = {
  105.     "alert",    LOG_ALERT,
  106.     "crit",        LOG_CRIT,
  107.     "debug",    LOG_DEBUG,
  108.     "emerg",    LOG_EMERG,
  109.     "err",        LOG_ERR,
  110.     "error",    LOG_ERR,        /* DEPRECATED */
  111.     "info",        LOG_INFO,
  112.     "none",        INTERNAL_NOPRI,        /* INTERNAL */
  113.     "notice",    LOG_NOTICE,
  114.     "panic",     LOG_EMERG,        /* DEPRECATED */
  115.     "warn",        LOG_WARNING,        /* DEPRECATED */
  116.     "warning",    LOG_WARNING,
  117.     NULL,        -1,
  118. };
  119. #endif
  120.  
  121. /* facility codes */
  122. #define    LOG_KERN    (0<<3)    /* kernel messages */
  123. #define    LOG_USER    (1<<3)    /* random user-level messages */
  124. #define    LOG_MAIL    (2<<3)    /* mail system */
  125. #define    LOG_DAEMON    (3<<3)    /* system daemons */
  126. #define    LOG_AUTH    (4<<3)    /* security/authorization messages */
  127. #define    LOG_SYSLOG    (5<<3)    /* messages generated internally by syslogd */
  128. #define    LOG_LPR        (6<<3)    /* line printer subsystem */
  129. #define    LOG_NEWS    (7<<3)    /* network news subsystem */
  130. #define    LOG_UUCP    (8<<3)    /* UUCP subsystem */
  131. #define    LOG_CRON    (9<<3)    /* clock daemon */
  132. #define    LOG_AUTHPRIV    (10<<3)    /* security/authorization messages (private) */
  133.  
  134.     /* other codes through 15 reserved for system use */
  135. #define    LOG_LOCAL0    (16<<3)    /* reserved for local use */
  136. #define    LOG_LOCAL1    (17<<3)    /* reserved for local use */
  137. #define    LOG_LOCAL2    (18<<3)    /* reserved for local use */
  138. #define    LOG_LOCAL3    (19<<3)    /* reserved for local use */
  139. #define    LOG_LOCAL4    (20<<3)    /* reserved for local use */
  140. #define    LOG_LOCAL5    (21<<3)    /* reserved for local use */
  141. #define    LOG_LOCAL6    (22<<3)    /* reserved for local use */
  142. #define    LOG_LOCAL7    (23<<3)    /* reserved for local use */
  143.  
  144. #define    LOG_NFACILITIES    24    /* current number of facilities */
  145. #define    LOG_FACMASK    0x03f8    /* mask to extract facility part */
  146.                 /* facility of pri */
  147. #define    LOG_FAC(p)    (((p) & LOG_FACMASK) >> 3)
  148.  
  149. #ifdef SYSLOG_NAMES
  150. CODE facilitynames[] = {
  151.     "auth",        LOG_AUTH,
  152.     "authpriv",    LOG_AUTHPRIV,
  153.     "cron",     LOG_CRON,
  154.     "daemon",    LOG_DAEMON,
  155.     "kern",        LOG_KERN,
  156.     "lpr",        LOG_LPR,
  157.     "mail",        LOG_MAIL,
  158.     "mark",     INTERNAL_MARK,        /* INTERNAL */
  159.     "news",        LOG_NEWS,
  160.     "security",    LOG_AUTH,        /* DEPRECATED */
  161.     "syslog",    LOG_SYSLOG,
  162.     "user",        LOG_USER,
  163.     "uucp",        LOG_UUCP,
  164.     "local0",    LOG_LOCAL0,
  165.     "local1",    LOG_LOCAL1,
  166.     "local2",    LOG_LOCAL2,
  167.     "local3",    LOG_LOCAL3,
  168.     "local4",    LOG_LOCAL4,
  169.     "local5",    LOG_LOCAL5,
  170.     "local6",    LOG_LOCAL6,
  171.     "local7",    LOG_LOCAL7,
  172.     NULL,        -1,
  173. };
  174. #endif
  175.  
  176. #ifdef KERNEL
  177. #define    LOG_PRINTF    -1    /* pseudo-priority to indicate use of printf */
  178. #endif
  179.  
  180. /*
  181.  * arguments to setlogmask.
  182.  */
  183. #define    LOG_MASK(pri)    (1 << (pri))        /* mask for one priority */
  184. #define    LOG_UPTO(pri)    ((1 << ((pri)+1)) - 1)    /* all priorities through pri */
  185.  
  186. /*
  187.  * Option flags for openlog.
  188.  *
  189.  * LOG_ODELAY no longer does anything.
  190.  * LOG_NDELAY is the inverse of what it used to be.
  191.  */
  192. #define    LOG_PID        0x01    /* log the pid with each message */
  193. #define    LOG_CONS    0x02    /* log on the console if errors in sending */
  194. #define    LOG_ODELAY    0x04    /* delay open until first syslog() (default) */
  195. #define    LOG_NDELAY    0x08    /* don't delay open */
  196. #define    LOG_NOWAIT    0x10    /* don't wait for console forks: DEPRECATED */
  197. #define    LOG_PERROR    0x20    /* log to stderr as well */
  198.  
  199. #ifndef KERNEL
  200.  
  201. #include <sys/cdefs.h>
  202. #include <stdarg.h>
  203.  
  204. __BEGIN_DECLS
  205. void    closelog __P((void));
  206. void    openlog __P((const char *, int, int));
  207. int    setlogmask __P((int));
  208. void    syslog __P((int, const char *, ...));
  209. void    vsyslog __P((int, const char *, va_list));
  210. __END_DECLS
  211.  
  212. #endif /* !KERNEL */
  213.