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