home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue6 / SDL.ZIP / !gcc / include / unixlib / sys / h / syslog < prev    next >
Encoding:
Text File  |  2006-09-17  |  6.8 KB  |  199 lines

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