xref: /netbsd-src/external/gpl3/gcc/dist/libphobos/libdruntime/core/sys/posix/syslog.d (revision 0a3071956a3a9fdebdbf7f338cf2d439b45fc728)
1 /**
2  * D header file for POSIX system logger API.
3  * (http://pubs.opengroup.org/onlinepubs/007904875/basedefs/syslog.h.html)
4  *
5  * Copyright: Copyright Adil Baig 2013.
6  * License:   $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
7  * Authors:   Adil Baig
8  * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
9  */
10 
11 /*          Copyright Adil Baig 2013.
12  * Distributed under the Boost Software License, Version 1.0.
13  *    (See accompanying file LICENSE or copy at
14  *          http://www.boost.org/LICENSE_1_0.txt)
15  */
16 module core.sys.posix.syslog;
17 
18 version (OSX)
19     version = Darwin;
20 else version (iOS)
21     version = Darwin;
22 else version (TVOS)
23     version = Darwin;
24 else version (WatchOS)
25     version = Darwin;
26 
version(Posix)27 version (Posix):
28 
29 extern (C) nothrow @nogc:
30 @system:
31 
32 version (CRuntime_Glibc)
33 {
34     //PRIORITY
35     enum {
36         LOG_EMERG = 0,     /* system is unusable */
37         LOG_ALERT = 1,     /* action must be taken immediately */
38         LOG_CRIT  = 2,     /* critical conditions */
39         LOG_ERR   = 3,     /* error conditions */
40         LOG_WARNING = 4,   /* warning conditions */
41         LOG_NOTICE  = 5,   /* normal but significant condition */
42         LOG_INFO    = 6,   /* informational */
43         LOG_DEBUG   = 7,   /* debug-level messages */
44     }
45 
46     //OPTIONS
47     enum {
48         LOG_PID    = 0x01,  /* log the pid with each message */
49         LOG_CONS   = 0x02,  /* log on the console if errors in sending */
50         LOG_ODELAY = 0x04,  /* delay open until first syslog() (default) */
51         LOG_NDELAY = 0x08,  /* don't delay open */
52         LOG_NOWAIT = 0x10,  /* don't wait for console forks: DEPRECATED */
53         LOG_PERROR = 0x20,  /* log to stderr as well */
54     }
55 
56     //FACILITY
57     enum {
58         LOG_KERN   = (0<<3),  /* kernel messages */
59         LOG_USER   = (1<<3),  /* random user-level messages */
60         LOG_MAIL   = (2<<3),  /* mail system */
61         LOG_DAEMON = (3<<3),  /* system daemons */
62         LOG_AUTH   = (4<<3),  /* security/authorization messages */
63         LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
64         LOG_LPR    = (6<<3),  /* line printer subsystem */
65         LOG_NEWS   = (7<<3),  /* network news subsystem */
66         LOG_UUCP   = (8<<3),  /* UUCP subsystem */
67         LOG_CRON   = (9<<3),  /* clock daemon */
68         LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
69         LOG_FTP    =  (11<<3), /* ftp daemon */
70 
71         /* other codes through 15 reserved for system use */
72         LOG_LOCAL0 = (16<<3), /* reserved for local use */
73         LOG_LOCAL1 = (17<<3), /* reserved for local use */
74         LOG_LOCAL2 = (18<<3), /* reserved for local use */
75         LOG_LOCAL3 = (19<<3), /* reserved for local use */
76         LOG_LOCAL4 = (20<<3), /* reserved for local use */
77         LOG_LOCAL5 = (21<<3), /* reserved for local use */
78         LOG_LOCAL6 = (22<<3), /* reserved for local use */
79         LOG_LOCAL7 = (23<<3), /* reserved for local use */
80 
81         LOG_NFACILITIES = 24,  /* current number of facilities */
82     }
83 
84     int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
85     int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
86 
87     void openlog (const char *, int __option, int __facility);
88     int  setlogmask (int __mask);
89     void syslog (int __pri, const char *__fmt, ...);
90     void closelog();
91 }
version(Darwin)92 else version (Darwin)
93 {
94     //http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/osfmk/sys/syslog.h
95 
96     //PRIORITY
97     enum {
98         LOG_EMERG = 0,     /* system is unusable */
99         LOG_ALERT = 1,     /* action must be taken immediately */
100         LOG_CRIT  = 2,     /* critical conditions */
101         LOG_ERR   = 3,     /* error conditions */
102         LOG_WARNING = 4,   /* warning conditions */
103         LOG_NOTICE  = 5,   /* normal but significant condition */
104         LOG_INFO    = 6,   /* informational */
105         LOG_DEBUG   = 7,   /* debug-level messages */
106     }
107 
108     //OPTIONS
109     enum {
110         LOG_PID    = 0x01,     /* log the pid with each message */
111         LOG_CONS   = 0x02,  /* log on the console if errors in sending */
112         LOG_ODELAY = 0x04,  /* delay open until first syslog() (default) */
113         LOG_NDELAY = 0x08,  /* don't delay open */
114         LOG_NOWAIT = 0x10,  /* don't wait for console forks: DEPRECATED */
115     }
116 
117     //FACILITY
118     enum {
119         LOG_KERN   = (0<<3),  /* kernel messages */
120         LOG_USER   = (1<<3),  /* random user-level messages */
121         LOG_MAIL   = (2<<3),  /* mail system */
122         LOG_DAEMON = (3<<3),  /* system daemons */
123         LOG_AUTH   = (4<<3),  /* security/authorization messages */
124         LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
125         LOG_LPR    = (6<<3),  /* line printer subsystem */
126         LOG_NEWS   = (7<<3),  /* network news subsystem */
127         LOG_UUCP   = (8<<3),  /* UUCP subsystem */
128 
129         /* other codes through 15 reserved for system use */
130         LOG_LOCAL0 = (16<<3), /* reserved for local use */
131         LOG_LOCAL1 = (17<<3), /* reserved for local use */
132         LOG_LOCAL2 = (18<<3), /* reserved for local use */
133         LOG_LOCAL3 = (19<<3), /* reserved for local use */
134         LOG_LOCAL4 = (20<<3), /* reserved for local use */
135         LOG_LOCAL5 = (21<<3), /* reserved for local use */
136         LOG_LOCAL6 = (22<<3), /* reserved for local use */
137         LOG_LOCAL7 = (23<<3), /* reserved for local use */
138 
139         LOG_NFACILITIES = 24,  /* current number of facilities */
140     }
141 
142     int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
143     int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
144 
145     void openlog (const char *, int __option, int __facility);
146     int  setlogmask (int __mask);
147     void syslog (int __pri, const char *__fmt, ...);
148     void closelog();
149 }
version(FreeBSD)150 else version (FreeBSD)
151 {
152     //http://fxr.watson.org/fxr/source/sys/syslog.h
153 
154     //PRIORITY
155     enum {
156         LOG_EMERG = 0,     /* system is unusable */
157         LOG_ALERT = 1,     /* action must be taken immediately */
158         LOG_CRIT  = 2,     /* critical conditions */
159         LOG_ERR   = 3,     /* error conditions */
160         LOG_WARNING = 4,   /* warning conditions */
161         LOG_NOTICE  = 5,   /* normal but significant condition */
162         LOG_INFO    = 6,   /* informational */
163         LOG_DEBUG   = 7,   /* debug-level messages */
164     }
165 
166     //OPTIONS
167     enum {
168         LOG_PID    = 0x01,    /* log the pid with each message */
169         LOG_CONS   = 0x02,    /* log on the console if errors in sending */
170         LOG_ODELAY = 0x04,    /* delay open until first syslog() (default) */
171         LOG_NDELAY = 0x08,    /* don't delay open */
172         LOG_NOWAIT = 0x10,    /* don't wait for console forks: DEPRECATED */
173         LOG_PERROR = 0x20,    /* log to stderr as well */
174     }
175 
176     //FACILITY
177     enum {
178         LOG_KERN   = (0<<3),  /* kernel messages */
179         LOG_USER   = (1<<3),  /* random user-level messages */
180         LOG_MAIL   = (2<<3),  /* mail system */
181         LOG_DAEMON = (3<<3),  /* system daemons */
182         LOG_AUTH   = (4<<3),  /* security/authorization messages */
183         LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
184         LOG_LPR    = (6<<3),  /* line printer subsystem */
185         LOG_NEWS   = (7<<3),  /* network news subsystem */
186         LOG_UUCP   = (8<<3),  /* UUCP subsystem */
187         LOG_CRON   = (9<<3),  /* clock daemon */
188         LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
189         LOG_FTP    =  (11<<3), /* ftp daemon */
190         LOG_NTP    = (12<<3), /* NTP subsystem */
191         LOG_SECURITY = (13<<3), /* security subsystems (firewalling, etc.) */
192         LOG_CONSOLE  = (14<<3), /* /dev/console output */
193 
194         /* other codes through 15 reserved for system use */
195         LOG_LOCAL0 = (16<<3), /* reserved for local use */
196         LOG_LOCAL1 = (17<<3), /* reserved for local use */
197         LOG_LOCAL2 = (18<<3), /* reserved for local use */
198         LOG_LOCAL3 = (19<<3), /* reserved for local use */
199         LOG_LOCAL4 = (20<<3), /* reserved for local use */
200         LOG_LOCAL5 = (21<<3), /* reserved for local use */
201         LOG_LOCAL6 = (22<<3), /* reserved for local use */
202         LOG_LOCAL7 = (23<<3), /* reserved for local use */
203 
204         LOG_NFACILITIES = 24,  /* current number of facilities */
205     }
206 
207     int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
208     int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
209 
210     void openlog (const char *, int __option, int __facility);
211     int  setlogmask (int __mask);
212     void syslog (int __pri, const char *__fmt, ...);
213     void closelog();
214 }
version(NetBSD)215 else version (NetBSD)
216 {
217     //http://fxr.watson.org/fxr/source/sys/syslog.h
218 
219     //PRIORITY
220     enum {
221         LOG_EMERG = 0,     /* system is unusable */
222         LOG_ALERT = 1,     /* action must be taken immediately */
223         LOG_CRIT  = 2,     /* critical conditions */
224         LOG_ERR   = 3,     /* error conditions */
225         LOG_WARNING = 4,   /* warning conditions */
226         LOG_NOTICE  = 5,   /* normal but significant condition */
227         LOG_INFO    = 6,   /* informational */
228         LOG_DEBUG   = 7,   /* debug-level messages */
229     }
230 
231     //OPTIONS
232     enum {
233         LOG_PID    = 0x01,    /* log the pid with each message */
234         LOG_CONS   = 0x02,    /* log on the console if errors in sending */
235         LOG_ODELAY = 0x04,    /* delay open until first syslog() (default) */
236         LOG_NDELAY = 0x08,    /* don't delay open */
237         LOG_NOWAIT = 0x10,    /* don't wait for console forks: DEPRECATED */
238         LOG_PERROR = 0x20,    /* log to stderr as well */
239     }
240 
241     //FACILITY
242     enum {
243         LOG_KERN   = (0<<3),  /* kernel messages */
244         LOG_USER   = (1<<3),  /* random user-level messages */
245         LOG_MAIL   = (2<<3),  /* mail system */
246         LOG_DAEMON = (3<<3),  /* system daemons */
247         LOG_AUTH   = (4<<3),  /* security/authorization messages */
248         LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
249         LOG_LPR    = (6<<3),  /* line printer subsystem */
250         LOG_NEWS   = (7<<3),  /* network news subsystem */
251         LOG_UUCP   = (8<<3),  /* UUCP subsystem */
252         LOG_CRON   = (9<<3),  /* clock daemon */
253         LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
254         LOG_FTP    =  (11<<3), /* ftp daemon */
255         LOG_NTP    = (12<<3), /* NTP subsystem */
256         LOG_SECURITY = (13<<3), /* security subsystems (firewalling, etc.) */
257         LOG_CONSOLE  = (14<<3), /* /dev/console output */
258 
259         /* other codes through 15 reserved for system use */
260         LOG_LOCAL0 = (16<<3), /* reserved for local use */
261         LOG_LOCAL1 = (17<<3), /* reserved for local use */
262         LOG_LOCAL2 = (18<<3), /* reserved for local use */
263         LOG_LOCAL3 = (19<<3), /* reserved for local use */
264         LOG_LOCAL4 = (20<<3), /* reserved for local use */
265         LOG_LOCAL5 = (21<<3), /* reserved for local use */
266         LOG_LOCAL6 = (22<<3), /* reserved for local use */
267         LOG_LOCAL7 = (23<<3), /* reserved for local use */
268 
269         LOG_NFACILITIES = 24,  /* current number of facilities */
270     }
271 
272     int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
273     int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
274 
275     void openlog (const char *, int __option, int __facility);
276     int  setlogmask (int __mask);
277     void syslog (int __pri, const char *__fmt, ...);
278     void closelog();
279 }
version(OpenBSD)280 else version (OpenBSD)
281 {
282     //PRIORITY
283     enum
284     {
285         LOG_EMERG = 0,     /* system is unusable */
286         LOG_ALERT = 1,     /* action must be taken immediately */
287         LOG_CRIT  = 2,     /* critical conditions */
288         LOG_ERR   = 3,     /* error conditions */
289         LOG_WARNING = 4,   /* warning conditions */
290         LOG_NOTICE  = 5,   /* normal but significant condition */
291         LOG_INFO    = 6,   /* informational */
292         LOG_DEBUG   = 7,   /* debug-level messages */
293     }
294 
295     //OPTIONS
296     enum
297     {
298         LOG_PID    = 0x01,    /* log the pid with each message */
299         LOG_CONS   = 0x02,    /* log on the console if errors in sending */
300         LOG_ODELAY = 0x04,    /* delay open until first syslog() (default) */
301         LOG_NDELAY = 0x08,    /* don't delay open */
302         LOG_NOWAIT = 0x10,    /* don't wait for console forks: DEPRECATED */
303         LOG_PERROR = 0x20,    /* log to stderr as well */
304     }
305 
306     //FACILITY
307     enum
308     {
309         LOG_KERN   = (0<<3),  /* kernel messages */
310         LOG_USER   = (1<<3),  /* random user-level messages */
311         LOG_MAIL   = (2<<3),  /* mail system */
312         LOG_DAEMON = (3<<3),  /* system daemons */
313         LOG_AUTH   = (4<<3),  /* security/authorization messages */
314         LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
315         LOG_LPR    = (6<<3),  /* line printer subsystem */
316         LOG_NEWS   = (7<<3),  /* network news subsystem */
317         LOG_UUCP   = (8<<3),  /* UUCP subsystem */
318         LOG_CRON   = (9<<3),  /* clock daemon */
319         LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
320         LOG_FTP    =  (11<<3), /* ftp daemon */
321         // OpenBSD does not define the following:
322         //LOG_NTP
323         //LOG_SECURITY
324         //LOG_CONSOLE
325 
326         /* other codes through 15 reserved for system use */
327         LOG_LOCAL0 = (16<<3), /* reserved for local use */
328         LOG_LOCAL1 = (17<<3), /* reserved for local use */
329         LOG_LOCAL2 = (18<<3), /* reserved for local use */
330         LOG_LOCAL3 = (19<<3), /* reserved for local use */
331         LOG_LOCAL4 = (20<<3), /* reserved for local use */
332         LOG_LOCAL5 = (21<<3), /* reserved for local use */
333         LOG_LOCAL6 = (22<<3), /* reserved for local use */
334         LOG_LOCAL7 = (23<<3), /* reserved for local use */
335 
336         LOG_NFACILITIES = 24,  /* current number of facilities */
337     }
338 
339     extern(D) int LOG_MASK(int pri) { return 1 << pri; }            /* mask for one priority */
340     extern(D) int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
341 
342     void openlog(const char *, int, int);
343     int  setlogmask(int);
344     void syslog(int, const char *, ...);
345     void closelog();
346 }
version(DragonFlyBSD)347 else version (DragonFlyBSD)
348 {
349     //PRIORITY
350     enum {
351         LOG_EMERG = 0,     /* system is unusable */
352         LOG_ALERT = 1,     /* action must be taken immediately */
353         LOG_CRIT  = 2,     /* critical conditions */
354         LOG_ERR   = 3,     /* error conditions */
355         LOG_WARNING = 4,   /* warning conditions */
356         LOG_NOTICE  = 5,   /* normal but significant condition */
357         LOG_INFO    = 6,   /* informational */
358         LOG_DEBUG   = 7,   /* debug-level messages */
359     }
360 
361     //OPTIONS
362     enum {
363         LOG_PID    = 0x01,    /* log the pid with each message */
364         LOG_CONS   = 0x02,    /* log on the console if errors in sending */
365         LOG_ODELAY = 0x04,    /* delay open until first syslog() (default) */
366         LOG_NDELAY = 0x08,    /* don't delay open */
367         LOG_NOWAIT = 0x10,    /* don't wait for console forks: DEPRECATED */
368         LOG_PERROR = 0x20,    /* log to stderr as well */
369     }
370 
371     //FACILITY
372     enum {
373         LOG_KERN   = (0<<3),  /* kernel messages */
374         LOG_USER   = (1<<3),  /* random user-level messages */
375         LOG_MAIL   = (2<<3),  /* mail system */
376         LOG_DAEMON = (3<<3),  /* system daemons */
377         LOG_AUTH   = (4<<3),  /* security/authorization messages */
378         LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
379         LOG_LPR    = (6<<3),  /* line printer subsystem */
380         LOG_NEWS   = (7<<3),  /* network news subsystem */
381         LOG_UUCP   = (8<<3),  /* UUCP subsystem */
382         LOG_CRON   = (9<<3),  /* clock daemon */
383         LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
384         LOG_FTP    =  (11<<3), /* ftp daemon */
385         LOG_NTP    = (12<<3), /* NTP subsystem */
386         LOG_SECURITY = (13<<3), /* security subsystems (firewalling, etc.) */
387         LOG_CONSOLE  = (14<<3), /* /dev/console output */
388 
389         /* other codes through 15 reserved for system use */
390         LOG_LOCAL0 = (16<<3), /* reserved for local use */
391         LOG_LOCAL1 = (17<<3), /* reserved for local use */
392         LOG_LOCAL2 = (18<<3), /* reserved for local use */
393         LOG_LOCAL3 = (19<<3), /* reserved for local use */
394         LOG_LOCAL4 = (20<<3), /* reserved for local use */
395         LOG_LOCAL5 = (21<<3), /* reserved for local use */
396         LOG_LOCAL6 = (22<<3), /* reserved for local use */
397         LOG_LOCAL7 = (23<<3), /* reserved for local use */
398 
399         LOG_NFACILITIES = 24,  /* current number of facilities */
400     }
401 
402     int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
403     int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
404 
405     void openlog (const char *, int __option, int __facility);
406     int  setlogmask (int __mask);
407     void syslog (int __pri, const char *__fmt, ...);
408     void closelog();
409 }
version(Solaris)410 else version (Solaris)
411 {
412     //http://pubs.opengroup.org/onlinepubs/007904875/basedefs/syslog.h.html
413 
414     //PRIORITY
415     enum {
416         LOG_EMERG = 0,     /* system is unusable */
417         LOG_ALERT = 1,     /* action must be taken immediately */
418         LOG_CRIT  = 2,     /* critical conditions */
419         LOG_ERR   = 3,     /* error conditions */
420         LOG_WARNING = 4,   /* warning conditions */
421         LOG_NOTICE  = 5,   /* normal but significant condition */
422         LOG_INFO    = 6,   /* informational */
423         LOG_DEBUG   = 7,   /* debug-level messages */
424     }
425 
426     //OPTIONS
427     enum {
428         LOG_PID = 0x01,     /* log the pid with each message */
429         LOG_CONS   = 0x02,  /* log on the console if errors in sending */
430         LOG_NDELAY = 0x08,  /* don't delay open */
431         LOG_NOWAIT = 0x10,  /* don't wait for console forks: DEPRECATED */
432     }
433 
434     //FACILITY
435     enum {
436         LOG_KERN   = (0<<3),  /* kernel messages */
437         LOG_USER   = (1<<3),  /* random user-level messages */
438         LOG_MAIL   = (2<<3),  /* mail system */
439         LOG_DAEMON = (3<<3),  /* system daemons */
440         LOG_AUTH   = (4<<3),  /* security/authorization messages */
441         LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
442         LOG_LPR    = (6<<3),  /* line printer subsystem */
443         LOG_NEWS   = (7<<3),  /* network news subsystem */
444         LOG_UUCP   = (8<<3),  /* UUCP subsystem */
445         LOG_CRON   = (9<<3),  /* clock daemon */
446         LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
447         LOG_FTP    =  (11<<3), /* ftp daemon */
448 
449         /* other codes through 15 reserved for system use */
450         LOG_LOCAL0 = (16<<3), /* reserved for local use */
451         LOG_LOCAL1 = (17<<3), /* reserved for local use */
452         LOG_LOCAL2 = (18<<3), /* reserved for local use */
453         LOG_LOCAL3 = (19<<3), /* reserved for local use */
454         LOG_LOCAL4 = (20<<3), /* reserved for local use */
455         LOG_LOCAL5 = (21<<3), /* reserved for local use */
456         LOG_LOCAL6 = (22<<3), /* reserved for local use */
457         LOG_LOCAL7 = (23<<3), /* reserved for local use */
458 
459         LOG_NFACILITIES = 24,  /* current number of facilities */
460     }
461 
462     int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
463     int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
464 
465     void openlog (const char *, int __option, int __facility);
466     int  setlogmask (int __mask);
467     void syslog (int __pri, const char *__fmt, ...);
468     void closelog();
469 }
version(CRuntime_UClibc)470 else version (CRuntime_UClibc)
471 {
472     //PRIORITY
473     enum {
474         LOG_EMERG = 0,     /* system is unusable */
475         LOG_ALERT = 1,     /* action must be taken immediately */
476         LOG_CRIT  = 2,     /* critical conditions */
477         LOG_ERR   = 3,     /* error conditions */
478         LOG_WARNING = 4,   /* warning conditions */
479         LOG_NOTICE  = 5,   /* normal but significant condition */
480         LOG_INFO    = 6,   /* informational */
481         LOG_DEBUG   = 7,   /* debug-level messages */
482     }
483 
484     //OPTIONS
485     enum {
486         LOG_PID    = 0x01,  /* log the pid with each message */
487         LOG_CONS   = 0x02,  /* log on the console if errors in sending */
488         LOG_ODELAY = 0x04,  /* delay open until first syslog() (default) */
489         LOG_NDELAY = 0x08,  /* don't delay open */
490         LOG_NOWAIT = 0x10,  /* don't wait for console forks: DEPRECATED */
491         LOG_PERROR = 0x20,  /* log to stderr as well */
492     }
493 
494     //FACILITY
495     enum {
496         LOG_KERN   = (0<<3),  /* kernel messages */
497         LOG_USER   = (1<<3),  /* random user-level messages */
498         LOG_MAIL   = (2<<3),  /* mail system */
499         LOG_DAEMON = (3<<3),  /* system daemons */
500         LOG_AUTH   = (4<<3),  /* security/authorization messages */
501         LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
502         LOG_LPR    = (6<<3),  /* line printer subsystem */
503         LOG_NEWS   = (7<<3),  /* network news subsystem */
504         LOG_UUCP   = (8<<3),  /* UUCP subsystem */
505         LOG_CRON   = (9<<3),  /* clock daemon */
506         LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
507         LOG_FTP    =  (11<<3), /* ftp daemon */
508 
509         /* other codes through 15 reserved for system use */
510         LOG_LOCAL0 = (16<<3), /* reserved for local use */
511         LOG_LOCAL1 = (17<<3), /* reserved for local use */
512         LOG_LOCAL2 = (18<<3), /* reserved for local use */
513         LOG_LOCAL3 = (19<<3), /* reserved for local use */
514         LOG_LOCAL4 = (20<<3), /* reserved for local use */
515         LOG_LOCAL5 = (21<<3), /* reserved for local use */
516         LOG_LOCAL6 = (22<<3), /* reserved for local use */
517         LOG_LOCAL7 = (23<<3), /* reserved for local use */
518 
519         LOG_NFACILITIES = 24,  /* current number of facilities */
520     }
521 
522     int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
523     int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
524 
525     void openlog (const char *, int __option, int __facility);
526     int  setlogmask (int __mask);
527     void syslog (int __pri, const char *__fmt, ...);
528     void closelog();
529 }
version(CRuntime_Musl)530 else version (CRuntime_Musl)
531 {
532     //PRIORITY
533     enum {
534         LOG_EMERG = 0,     /* system is unusable */
535         LOG_ALERT = 1,     /* action must be taken immediately */
536         LOG_CRIT  = 2,     /* critical conditions */
537         LOG_ERR   = 3,     /* error conditions */
538         LOG_WARNING = 4,   /* warning conditions */
539         LOG_NOTICE  = 5,   /* normal but significant condition */
540         LOG_INFO    = 6,   /* informational */
541         LOG_DEBUG   = 7,   /* debug-level messages */
542     }
543 
544     //OPTIONS
545     enum {
546         LOG_PID    = 0x01,  /* log the pid with each message */
547         LOG_CONS   = 0x02,  /* log on the console if errors in sending */
548         LOG_ODELAY = 0x04,  /* delay open until first syslog() (default) */
549         LOG_NDELAY = 0x08,  /* don't delay open */
550         LOG_NOWAIT = 0x10,  /* don't wait for console forks: DEPRECATED */
551         LOG_PERROR = 0x20,  /* log to stderr as well */
552     }
553 
554     //FACILITY
555     enum {
556         LOG_KERN   = (0<<3),  /* kernel messages */
557         LOG_USER   = (1<<3),  /* random user-level messages */
558         LOG_MAIL   = (2<<3),  /* mail system */
559         LOG_DAEMON = (3<<3),  /* system daemons */
560         LOG_AUTH   = (4<<3),  /* security/authorization messages */
561         LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
562         LOG_LPR    = (6<<3),  /* line printer subsystem */
563         LOG_NEWS   = (7<<3),  /* network news subsystem */
564         LOG_UUCP   = (8<<3),  /* UUCP subsystem */
565         LOG_CRON   = (9<<3),  /* clock daemon */
566         LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
567         LOG_FTP    =  (11<<3), /* ftp daemon */
568 
569         /* other codes through 15 reserved for system use */
570         LOG_LOCAL0 = (16<<3), /* reserved for local use */
571         LOG_LOCAL1 = (17<<3), /* reserved for local use */
572         LOG_LOCAL2 = (18<<3), /* reserved for local use */
573         LOG_LOCAL3 = (19<<3), /* reserved for local use */
574         LOG_LOCAL4 = (20<<3), /* reserved for local use */
575         LOG_LOCAL5 = (21<<3), /* reserved for local use */
576         LOG_LOCAL6 = (22<<3), /* reserved for local use */
577         LOG_LOCAL7 = (23<<3), /* reserved for local use */
578 
579         LOG_NFACILITIES = 24,  /* current number of facilities */
580     }
581 
582     int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
583     int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
584 
585     void openlog (const char *, int __option, int __facility);
586     int  setlogmask (int __mask);
587     void syslog (int __pri, const char *__fmt, ...);
588     void closelog();
589 }
590