updated package versions
[minix.git] / include / syslog.h
blob051984993fa60aa5699aee85ea6ca8bcaf878b02
1 /* Copyright (c) 1983, 1986, 1988
2 * The Regents of the University of California. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. All advertising materials mentioning features or use of this software
13 * must display the following acknowledgement:
14 * This product includes software developed by the University of
15 * California, Berkeley and its contributors.
16 * 4. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
32 * from @(#)syslog.h 7.20 (Berkeley) 2/23/91
33 * Porting to Minix by G. Falzoni <gfalzoni@inwind.it>
34 * $Id$
38 ** Priorities/facilities are encoded into a single 16/32-bit quantity, where
39 ** the bottom 3 bits are the priority (0-7) and the top 13/28 bits are the
40 ** facility (0-big number). Both the priorities and the facilities map
41 ** roughly one-to-one to strings in the syslogd(8) source code.
42 ** This mapping is included in this file.
45 /* Priorities codes (these are ordered) */
46 #define LOG_EMERG 0 /* system is unusable */
47 #define LOG_ALERT 1 /* action must be taken immediately */
48 #define LOG_CRIT 2 /* critical conditions */
49 #define LOG_ERR 3 /* error conditions */
50 #define LOG_WARNING 4 /* warning conditions */
51 #define LOG_NOTICE 5 /* normal but significant condition */
52 #define LOG_INFO 6 /* informational */
53 #define LOG_DEBUG 7 /* debug-level messages */
55 /* Extract priority */
56 #define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
57 #define LOG_PRI(p) ((p)&LOG_PRIMASK)
59 /* Facility codes */
60 #define LOG_KERN (0<<3) /* kernel messages */
61 #define LOG_USER (1<<3) /* random user-level messages */
62 #define LOG_MAIL (2<<3) /* mail system */
63 #define LOG_DAEMON (3<<3) /* system daemons */
64 #define LOG_AUTH (4<<3) /* security/authorization messages */
65 #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
66 #define LOG_LPR (6<<3) /* line printer subsystem */
67 #define LOG_NEWS (7<<3) /* network news subsystem */
68 #define LOG_UUCP (8<<3) /* UUCP subsystem */
69 #define LOG_CRON (9<<3) /* clock daemon */
70 #define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
72 /* Other codes through 15 reserved for system use */
73 #define LOG_LOCAL0 (16<<3) /* reserved for local use */
74 #define LOG_LOCAL1 (17<<3) /* reserved for local use */
75 #define LOG_LOCAL2 (18<<3) /* reserved for local use */
76 #define LOG_LOCAL3 (19<<3) /* reserved for local use */
77 #define LOG_LOCAL4 (20<<3) /* reserved for local use */
78 #define LOG_LOCAL5 (21<<3) /* reserved for local use */
79 #define LOG_LOCAL6 (22<<3) /* reserved for local use */
80 #define LOG_LOCAL7 (23<<3) /* reserved for local use */
81 #define LOG_NFACILITIES 24 /* current number of facilities */
83 /* Extract Facility */
84 #define LOG_FACMASK 0x03f8 /* mask to extract facility part */
85 #define LOG_FAC(p) (((p)&LOG_FACMASK)>>3)
87 /* Option flags for openlog */
88 #define LOG_PID 0x01 /* log the pid with each message */
89 #define LOG_CONS 0x02 /* log on the console if errors in sending */
90 #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
91 #define LOG_NDELAY 0x08 /* don't delay open */
92 #define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
93 #define LOG_PERROR 0x20 /* log to stderr as well */
95 void closelog(void);
96 void openlog(const char *, int, int);
97 void syslog(int, const char *,...);
99 #ifdef SYSLOG_NAMES
101 #define LOG_MAKEPRI(fac,pri) (((fac)<<3)|(pri))
102 #define TABLE_NOPRI 0 /* Value to indicate no priority */
103 #define TABLE_ALLPRI 0xFF /* Value to indicate all priorities */
104 #define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
105 #define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) /* Mark "facility" */
107 struct _code {
108 char *c_name;
109 int c_val;
112 static const struct _code PriNames[] =
114 "alert", LOG_ALERT,
115 "crit", LOG_CRIT,
116 "debug", LOG_DEBUG,
117 "emerg", LOG_EMERG,
118 "err", LOG_ERR,
119 "error", LOG_ERR, /* DEPRECATED */
120 "info", LOG_INFO,
121 "none", INTERNAL_NOPRI, /* INTERNAL */
122 "notice", LOG_NOTICE,
123 "panic", LOG_EMERG, /* DEPRECATED */
124 "warn", LOG_WARNING, /* DEPRECATED */
125 "warning", LOG_WARNING,
126 "*", TABLE_ALLPRI, /* INTERNAL */
127 NULL, -1,
130 static const struct _code FacNames[] =
132 "auth", LOG_AUTH,
133 "authpriv", LOG_AUTHPRIV,
134 "cron", LOG_CRON,
135 "daemon", LOG_DAEMON,
136 "kern", LOG_KERN,
137 "lpr", LOG_LPR,
138 "mail", LOG_MAIL,
139 "mark", INTERNAL_MARK, /* INTERNAL */
140 "news", LOG_NEWS,
141 "security", LOG_AUTH, /* DEPRECATED */
142 "syslog", LOG_SYSLOG,
143 "user", LOG_USER,
144 "uucp", LOG_UUCP,
145 "local0", LOG_LOCAL0,
146 "local1", LOG_LOCAL1,
147 "local2", LOG_LOCAL2,
148 "local3", LOG_LOCAL3,
149 "local4", LOG_LOCAL4,
150 "local5", LOG_LOCAL5,
151 "local6", LOG_LOCAL6,
152 "local7", LOG_LOCAL7,
153 NULL, -1,
155 #endif
157 /** syslog.h **/