source: trunk/minix/include/syslog.h@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 5.9 KB
Line 
1/* Copyright (c) 1983, 1986, 1988
2 * The Regents of the University of California. All rights reserved.
3 *
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.
19 *
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.
31 *
32 * from @(#)syslog.h 7.20 (Berkeley) 2/23/91
33 * Porting to Minix by G. Falzoni <gfalzoni@inwind.it>
34 * $Id: syslog.h,v 1.1 2005/10/31 14:07:07 beng Exp $
35 */
36
37/*
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.
43*/
44
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 */
54
55/* Extract priority */
56#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
57#define LOG_PRI(p) ((p)&LOG_PRIMASK)
58
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) */
71
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 */
82
83/* Extract Facility */
84#define LOG_FACMASK 0x03f8 /* mask to extract facility part */
85#define LOG_FAC(p) (((p)&LOG_FACMASK)>>3)
86
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_PERROR 0x20 /* log to stderr as well */
93
94void closelog(void);
95void openlog(const char *, int, int);
96void syslog(int, const char *,...);
97
98#ifdef SYSLOG_NAMES
99
100#define LOG_MAKEPRI(fac,pri) (((fac)<<3)|(pri))
101#define TABLE_NOPRI 0 /* Value to indicate no priority */
102#define TABLE_ALLPRI 0xFF /* Value to indicate all priorities */
103#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
104#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) /* Mark "facility" */
105
106struct _code {
107 char *c_name;
108 int c_val;
109};
110
111static const struct _code PriNames[] =
112{
113 "alert", LOG_ALERT,
114 "crit", LOG_CRIT,
115 "debug", LOG_DEBUG,
116 "emerg", LOG_EMERG,
117 "err", LOG_ERR,
118 "error", LOG_ERR, /* DEPRECATED */
119 "info", LOG_INFO,
120 "none", INTERNAL_NOPRI, /* INTERNAL */
121 "notice", LOG_NOTICE,
122 "panic", LOG_EMERG, /* DEPRECATED */
123 "warn", LOG_WARNING, /* DEPRECATED */
124 "warning", LOG_WARNING,
125 "*", TABLE_ALLPRI, /* INTERNAL */
126 NULL, -1,
127};
128
129static const struct _code FacNames[] =
130{
131 "auth", LOG_AUTH,
132 "authpriv", LOG_AUTHPRIV,
133 "cron", LOG_CRON,
134 "daemon", LOG_DAEMON,
135 "kern", LOG_KERN,
136 "lpr", LOG_LPR,
137 "mail", LOG_MAIL,
138 "mark", INTERNAL_MARK, /* INTERNAL */
139 "news", LOG_NEWS,
140 "security", LOG_AUTH, /* DEPRECATED */
141 "syslog", LOG_SYSLOG,
142 "user", LOG_USER,
143 "uucp", LOG_UUCP,
144 "local0", LOG_LOCAL0,
145 "local1", LOG_LOCAL1,
146 "local2", LOG_LOCAL2,
147 "local3", LOG_LOCAL3,
148 "local4", LOG_LOCAL4,
149 "local5", LOG_LOCAL5,
150 "local6", LOG_LOCAL6,
151 "local7", LOG_LOCAL7,
152 NULL, -1,
153};
154#endif
155
156/** syslog.h **/
Note: See TracBrowser for help on using the repository browser.