1 /* check-sources:disable-copyright-check */
2 /*
3  * Copyright (c) 1982, 1986, 1988, 1993
4  *      The Regents of the University of California.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 4. Neither the name of the University nor the names of its contributors
15  *    may be used to endorse or promote products derived from this software
16  *    without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  */
30 
31 #ifndef _SYSLOG_H
32 #define _SYSLOG_H
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  *  Facility codes
40  */
41 #define LOG_KERN (0 << 3)   /* kernel messages */
42 #define LOG_USER (1 << 3)   /* random user-level messages */
43 #define LOG_MAIL (2 << 3)   /* mail system */
44 #define LOG_DAEMON (3 << 3) /* system daemons */
45 #define LOG_AUTH (4 << 3)   /* security/authorization messages */
46 #define LOG_SYSLOG (5 << 3) /* messages generated internally by syslogd */
47 #define LOG_LPR (6 << 3)    /* line printer subsystem */
48 #define LOG_NEWS (7 << 3)   /* netnews subsystem */
49 #define LOG_UUCP (8 << 3)   /* uucp subsystem */
50 #define LOG_AUDIT (13 << 3) /* audit subsystem */
51 #define LOG_CRON (15 << 3)  /* cron/at subsystem */
52                             /* other codes through 15 reserved for system use */
53 #define LOG_LOCAL0 (16 << 3) /* reserved for local use */
54 #define LOG_LOCAL1 (17 << 3) /* reserved for local use */
55 #define LOG_LOCAL2 (18 << 3) /* reserved for local use */
56 #define LOG_LOCAL3 (19 << 3) /* reserved for local use */
57 #define LOG_LOCAL4 (20 << 3) /* reserved for local use */
58 #define LOG_LOCAL5 (21 << 3) /* reserved for local use */
59 #define LOG_LOCAL6 (22 << 3) /* reserved for local use */
60 #define LOG_LOCAL7 (23 << 3) /* reserved for local use */
61 
62 #define LOG_NFACILITIES 24 /* maximum number of facilities */
63 #define LOG_FACMASK 0x03f8 /* mask to extract facility part */
64 
65 /*
66  *  Priorities (these are ordered)
67  */
68 #define LOG_EMERG 0   /* system is unusable */
69 #define LOG_ALERT 1   /* action must be taken immediately */
70 #define LOG_CRIT 2    /* critical conditions */
71 #define LOG_ERR 3     /* error conditions */
72 #define LOG_WARNING 4 /* warning conditions */
73 #define LOG_NOTICE 5  /* normal but signification condition */
74 #define LOG_INFO 6    /* informational */
75 #define LOG_DEBUG 7   /* debug-level messages */
76 
77 #define LOG_PRIMASK 0x0007 /* mask to extract priority part (internal) */
78 
79 /*
80  * arguments to setlogmask.
81  */
82 #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
83 #define LOG_UPTO(pri)                                    \
84   ((1 << ((pri) + 1)) - 1) /* all priorities through pri \
85                             */
86 
87 /*
88  *  Option flags for openlog.
89  *
90  *      LOG_ODELAY no longer does anything; LOG_NDELAY is the
91  *      inverse of what it used to be.
92  */
93 #define LOG_PID 0x01    /* log the pid with each message */
94 #define LOG_CONS 0x02   /* log on the console if errors in sending */
95 #define LOG_ODELAY 0x04 /* delay open until syslog() is called */
96 #define LOG_NDELAY 0x08 /* don't delay open */
97 #define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */
98 
99 void syslog(int type, const char* fmt, ...);
100 void openlog(const char* app, int, int);
101 void closelog(void);
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif /* _SYSLOG_H */
108