]> git.saurik.com Git - apple/xnu.git/blob - osfmk/sys/syslog.h
xnu-344.23.tar.gz
[apple/xnu.git] / osfmk / sys / syslog.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * HISTORY
27 *
28 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
29 * Import of Mac OS X kernel (~semeria)
30 *
31 * Revision 1.1.1.1 1998/03/07 02:25:59 wsanchez
32 * Import of OSF Mach kernel (~mburg)
33 *
34 * Revision 1.2.6.1 1994/09/23 03:13:08 ezf
35 * change marker to not FREE
36 * [1994/09/22 21:58:52 ezf]
37 *
38 * Revision 1.2.2.3 1993/08/03 18:30:38 gm
39 * CR9596: Change KERNEL to MACH_KERNEL.
40 * [1993/08/02 19:02:56 gm]
41 *
42 * Revision 1.2.2.2 1993/06/09 02:55:27 gm
43 * Added to OSF/1 R1.3 from NMK15.0.
44 * [1993/06/02 21:30:57 jeffc]
45 *
46 * Revision 1.2 1993/04/19 17:16:58 devrcs
47 * Fixes for ANSI C
48 * [1993/02/26 14:02:39 sp]
49 *
50 * Revision 1.1 1992/09/30 02:36:56 robert
51 * Initial revision
52 *
53 * $EndLog$
54 */
55 /* CMU_HIST */
56 /*
57 * Revision 2.4 91/05/14 17:40:18 mrt
58 * Correcting copyright
59 *
60 * Revision 2.3 91/05/13 06:07:15 af
61 * Removed CMU conditionals.
62 * [91/05/12 16:31:12 af]
63 *
64 * Revision 2.2 91/02/05 17:56:53 mrt
65 * Changed to new Mach copyright
66 * [91/02/01 17:49:22 mrt]
67 *
68 * Revision 2.1 89/08/03 16:10:10 rwd
69 * Created.
70 *
71 */
72 /* CMU_ENDHIST */
73 /*
74 * Mach Operating System
75 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
76 * All Rights Reserved.
77 *
78 * Permission to use, copy, modify and distribute this software and its
79 * documentation is hereby granted, provided that both the copyright
80 * notice and this permission notice appear in all copies of the
81 * software, derivative works or modified versions, and any portions
82 * thereof, and that both notices appear in supporting documentation.
83 *
84 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
85 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
86 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
87 *
88 * Carnegie Mellon requests users of this software to return to
89 *
90 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
91 * School of Computer Science
92 * Carnegie Mellon University
93 * Pittsburgh PA 15213-3890
94 *
95 * any improvements or extensions that they make and grant Carnegie Mellon rights
96 * to redistribute these changes.
97 */
98 /*
99 */
100
101 /*
102 * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
103 * All rights reserved.
104 *
105 * Redistribution and use in source and binary forms are permitted
106 * provided that the above copyright notice and this paragraph are
107 * duplicated in all such forms and that any documentation,
108 * advertising materials, and other materials related to such
109 * distribution and use acknowledge that the software was developed
110 * by the University of California, Berkeley. The name of the
111 * University may not be used to endorse or promote products derived
112 * from this software without specific prior written permission.
113 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
114 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
115 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
116 *
117 * @(#)syslog.h 7.10 (Berkeley) 6/27/88
118 */
119
120 /*
121 * Facility codes
122 */
123
124 #ifndef _SYS_SYSLOG_H_
125 #define _SYS_SYSLOG_H_
126
127 #define LOG_KERN (0<<3) /* kernel messages */
128 #define LOG_USER (1<<3) /* random user-level messages */
129 #define LOG_MAIL (2<<3) /* mail system */
130 #define LOG_DAEMON (3<<3) /* system daemons */
131 #define LOG_AUTH (4<<3) /* security/authorization messages */
132 #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
133 #define LOG_LPR (6<<3) /* line printer subsystem */
134 #define LOG_NEWS (7<<3) /* network news subsystem */
135 #define LOG_UUCP (8<<3) /* UUCP subsystem */
136 /* other codes through 15 reserved for system use */
137 #define LOG_LOCAL0 (16<<3) /* reserved for local use */
138 #define LOG_LOCAL1 (17<<3) /* reserved for local use */
139 #define LOG_LOCAL2 (18<<3) /* reserved for local use */
140 #define LOG_LOCAL3 (19<<3) /* reserved for local use */
141 #define LOG_LOCAL4 (20<<3) /* reserved for local use */
142 #define LOG_LOCAL5 (21<<3) /* reserved for local use */
143 #define LOG_LOCAL6 (22<<3) /* reserved for local use */
144 #define LOG_LOCAL7 (23<<3) /* reserved for local use */
145
146 #define LOG_NFACILITIES 24 /* maximum number of facilities */
147 #define LOG_FACMASK 0x03f8 /* mask to extract facility part */
148
149 #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) /* facility of pri */
150
151 /*
152 * Priorities (these are ordered)
153 */
154
155 #define LOG_EMERG 0 /* system is unusable */
156 #define LOG_ALERT 1 /* action must be taken immediately */
157 #define LOG_CRIT 2 /* critical conditions */
158 #define LOG_ERR 3 /* error conditions */
159 #define LOG_WARNING 4 /* warning conditions */
160 #define LOG_NOTICE 5 /* normal but signification condition */
161 #define LOG_INFO 6 /* informational */
162 #define LOG_DEBUG 7 /* debug-level messages */
163
164 #define LOG_PRIMASK 0x0007 /* mask to extract priority part (internal) */
165 #define LOG_PRI(p) ((p) & LOG_PRIMASK) /* extract priority */
166
167 #define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
168
169 #ifdef MACH_KERNEL
170 #define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */
171 #endif
172
173 /*
174 * arguments to setlogmask.
175 */
176 #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
177 #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */
178
179 /*
180 * Option flags for openlog.
181 *
182 * LOG_ODELAY no longer does anything; LOG_NDELAY is the
183 * inverse of what it used to be.
184 */
185 #define LOG_PID 0x01 /* log the pid with each message */
186 #define LOG_CONS 0x02 /* log on the console if errors in sending */
187 #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
188 #define LOG_NDELAY 0x08 /* don't delay open */
189 #define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */
190
191 #if defined(__STDC__)
192 extern void openlog(const char *, int);
193 extern void syslog(int, const char *, ...);
194 extern void closelog(void);
195 extern void setlogmask(int);
196 #endif /* defined(__STDC__) */
197 #endif /* _SYS_SYSLOG_H_ */