OLD | NEW |
1 #ifndef _SYSLOG_H | 1 #ifndef _SYSLOG_H |
2 #define _SYSLOG_H | 2 #define _SYSLOG_H |
3 | 3 |
4 #ifdef __cplusplus | 4 #ifdef __cplusplus |
5 extern "C" { | 5 extern "C" { |
6 #endif | 6 #endif |
7 | 7 |
8 #include <features.h> | 8 #include <features.h> |
9 | 9 |
10 #define LOG_EMERG 0 | 10 #define LOG_EMERG 0 |
11 #define LOG_ALERT 1 | 11 #define LOG_ALERT 1 |
12 #define LOG_CRIT 2 | 12 #define LOG_CRIT 2 |
13 #define LOG_ERR 3 | 13 #define LOG_ERR 3 |
14 #define LOG_WARNING 4 | 14 #define LOG_WARNING 4 |
15 #define LOG_NOTICE 5 | 15 #define LOG_NOTICE 5 |
16 #define LOG_INFO 6 | 16 #define LOG_INFO 6 |
17 #define LOG_DEBUG 7 | 17 #define LOG_DEBUG 7 |
18 | 18 |
19 #define LOG_PRIMASK 7 | 19 #define LOG_PRIMASK 7 |
20 #define LOG_PRI(p) ((p)&LOG_PRIMASK) | 20 #define LOG_PRI(p) ((p)&LOG_PRIMASK) |
21 #define»LOG_MAKEPRI(f, p) (((f)<<3)|(p)) | 21 #define LOG_MAKEPRI(f, p) (((f) << 3) | (p)) |
22 | 22 |
23 #define LOG_MASK(p) (1<<(p)) | 23 #define LOG_MASK(p) (1 << (p)) |
24 #define LOG_UPTO(p) ((1<<((p)+1))-1) | 24 #define LOG_UPTO(p) ((1 << ((p) + 1)) - 1) |
25 | 25 |
26 #define LOG_KERN (0<<3) | 26 #define LOG_KERN (0 << 3) |
27 #define LOG_USER (1<<3) | 27 #define LOG_USER (1 << 3) |
28 #define LOG_MAIL (2<<3) | 28 #define LOG_MAIL (2 << 3) |
29 #define LOG_DAEMON (3<<3) | 29 #define LOG_DAEMON (3 << 3) |
30 #define LOG_AUTH (4<<3) | 30 #define LOG_AUTH (4 << 3) |
31 #define LOG_SYSLOG (5<<3) | 31 #define LOG_SYSLOG (5 << 3) |
32 #define LOG_LPR (6<<3) | 32 #define LOG_LPR (6 << 3) |
33 #define LOG_NEWS (7<<3) | 33 #define LOG_NEWS (7 << 3) |
34 #define LOG_UUCP (8<<3) | 34 #define LOG_UUCP (8 << 3) |
35 #define LOG_CRON (9<<3) | 35 #define LOG_CRON (9 << 3) |
36 #define»LOG_AUTHPRIV (10<<3) | 36 #define LOG_AUTHPRIV (10 << 3) |
37 #define»LOG_FTP (11<<3) | 37 #define LOG_FTP (11 << 3) |
38 | 38 |
39 #define LOG_LOCAL0 (16<<3) | 39 #define LOG_LOCAL0 (16 << 3) |
40 #define LOG_LOCAL1 (17<<3) | 40 #define LOG_LOCAL1 (17 << 3) |
41 #define LOG_LOCAL2 (18<<3) | 41 #define LOG_LOCAL2 (18 << 3) |
42 #define LOG_LOCAL3 (19<<3) | 42 #define LOG_LOCAL3 (19 << 3) |
43 #define LOG_LOCAL4 (20<<3) | 43 #define LOG_LOCAL4 (20 << 3) |
44 #define LOG_LOCAL5 (21<<3) | 44 #define LOG_LOCAL5 (21 << 3) |
45 #define LOG_LOCAL6 (22<<3) | 45 #define LOG_LOCAL6 (22 << 3) |
46 #define LOG_LOCAL7 (23<<3) | 46 #define LOG_LOCAL7 (23 << 3) |
47 | 47 |
48 #define LOG_NFACILITIES 24 | 48 #define LOG_NFACILITIES 24 |
49 #define LOG_FACMASK 0x3f8 | 49 #define LOG_FACMASK 0x3f8 |
50 #define LOG_FAC(p) (((p)&LOG_FACMASK)>>3) | 50 #define LOG_FAC(p) (((p)&LOG_FACMASK) >> 3) |
51 | 51 |
52 #define LOG_PID 0x01 | 52 #define LOG_PID 0x01 |
53 #define LOG_CONS 0x02 | 53 #define LOG_CONS 0x02 |
54 #define LOG_ODELAY 0x04 | 54 #define LOG_ODELAY 0x04 |
55 #define LOG_NDELAY 0x08 | 55 #define LOG_NDELAY 0x08 |
56 #define LOG_NOWAIT 0x10 | 56 #define LOG_NOWAIT 0x10 |
57 #define LOG_PERROR 0x20 | 57 #define LOG_PERROR 0x20 |
58 | 58 |
59 void closelog (void); | 59 void closelog(void); |
60 void openlog (const char *, int, int); | 60 void openlog(const char*, int, int); |
61 int setlogmask (int); | 61 int setlogmask(int); |
62 void syslog (int, const char *, ...); | 62 void syslog(int, const char*, ...); |
63 | 63 |
64 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | 64 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
65 #define _PATH_LOG "/dev/log" | 65 #define _PATH_LOG "/dev/log" |
66 #define __NEED_va_list | 66 #define __NEED_va_list |
67 #include <bits/alltypes.h> | 67 #include <bits/alltypes.h> |
68 void vsyslog (int, const char *, va_list); | 68 void vsyslog(int, const char*, va_list); |
69 #if defined(SYSLOG_NAMES) | 69 #if defined(SYSLOG_NAMES) |
70 #define»INTERNAL_NOPRI 0x10 | 70 #define INTERNAL_NOPRI 0x10 |
71 #define»INTERNAL_MARK (LOG_NFACILITIES<<3) | 71 #define INTERNAL_MARK (LOG_NFACILITIES << 3) |
72 typedef struct { | 72 typedef struct { |
73 » char *c_name; | 73 char* c_name; |
74 » int c_val; | 74 int c_val; |
75 } CODE; | 75 } CODE; |
76 #define prioritynames ((CODE *)(const CODE []){ \ | 76 #define prioritynames \ |
77 » { "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, \ | 77 ((CODE*)(const CODE[]){{"alert", LOG_ALERT}, \ |
78 » { "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, \ | 78 {"crit", LOG_CRIT}, \ |
79 » { "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, \ | 79 {"debug", LOG_DEBUG}, \ |
80 » { "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, \ | 80 {"emerg", LOG_EMERG}, \ |
81 » { "warn", LOG_WARNING }, { "warning", LOG_WARNING }, { 0, -1 } }) | 81 {"err", LOG_ERR}, \ |
82 #define facilitynames ((CODE *)(const CODE []){ \ | 82 {"error", LOG_ERR}, \ |
83 » { "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, \ | 83 {"info", LOG_INFO}, \ |
84 » { "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, \ | 84 {"none", INTERNAL_NOPRI}, \ |
85 » { "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, \ | 85 {"notice", LOG_NOTICE}, \ |
86 » { "mark", INTERNAL_MARK }, { "news", LOG_NEWS }, \ | 86 {"panic", LOG_EMERG}, \ |
87 » { "security", LOG_AUTH }, { "syslog", LOG_SYSLOG }, \ | 87 {"warn", LOG_WARNING}, \ |
88 » { "user", LOG_USER }, { "uucp", LOG_UUCP }, \ | 88 {"warning", LOG_WARNING}, \ |
89 » { "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, \ | 89 {0, -1}}) |
90 » { "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, \ | 90 #define facilitynames \ |
91 » { "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, \ | 91 ((CODE*)(const CODE[]){{"auth", LOG_AUTH}, \ |
92 » { "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { 0, -1 } }) | 92 {"authpriv", LOG_AUTHPRIV}, \ |
| 93 {"cron", LOG_CRON}, \ |
| 94 {"daemon", LOG_DAEMON}, \ |
| 95 {"ftp", LOG_FTP}, \ |
| 96 {"kern", LOG_KERN}, \ |
| 97 {"lpr", LOG_LPR}, \ |
| 98 {"mail", LOG_MAIL}, \ |
| 99 {"mark", INTERNAL_MARK}, \ |
| 100 {"news", LOG_NEWS}, \ |
| 101 {"security", LOG_AUTH}, \ |
| 102 {"syslog", LOG_SYSLOG}, \ |
| 103 {"user", LOG_USER}, \ |
| 104 {"uucp", LOG_UUCP}, \ |
| 105 {"local0", LOG_LOCAL0}, \ |
| 106 {"local1", LOG_LOCAL1}, \ |
| 107 {"local2", LOG_LOCAL2}, \ |
| 108 {"local3", LOG_LOCAL3}, \ |
| 109 {"local4", LOG_LOCAL4}, \ |
| 110 {"local5", LOG_LOCAL5}, \ |
| 111 {"local6", LOG_LOCAL6}, \ |
| 112 {"local7", LOG_LOCAL7}, \ |
| 113 {0, -1}}) |
93 #endif | 114 #endif |
94 #endif | 115 #endif |
95 | 116 |
96 #ifdef __cplusplus | 117 #ifdef __cplusplus |
97 } | 118 } |
98 #endif | 119 #endif |
99 | 120 |
100 #endif | 121 #endif |
OLD | NEW |