1 /* $NetBSD: ntp_syslog.h,v 1.6 2020/05/25 20:47:20 christos Exp $ */ 2 3 /* 4 * A hack for platforms which require specially built syslog facilities 5 */ 6 7 #ifndef NTP_SYSLOG_H 8 #define NTP_SYSLOG_H 9 10 #include <ntp_types.h> /* u_int32 type */ 11 12 #ifdef VMS 13 extern void msyslog(); 14 extern void mvsyslog(); 15 #else 16 # ifndef SYS_VXWORKS 17 # include <syslog.h> 18 # endif 19 #endif /* VMS */ 20 #include <stdio.h> 21 22 extern int syslogit; 23 extern int msyslog_term; /* duplicate to stdout/err */ 24 extern int msyslog_term_pid; 25 extern int msyslog_include_timestamp; 26 extern FILE * syslog_file; /* if syslogit is FALSE, log to 27 this file and not syslog */ 28 extern char * syslog_fname; 29 extern char * syslog_abs_fname; 30 31 #if defined(VMS) || defined (SYS_VXWORKS) 32 #define LOG_EMERG 0 /* system is unusable */ 33 #define LOG_ALERT 1 /* action must be taken immediately */ 34 #define LOG_CRIT 2 /* critical conditions */ 35 #define LOG_ERR 3 /* error conditions */ 36 #define LOG_WARNING 4 /* warning conditions */ 37 #define LOG_NOTICE 5 /* normal but signification condition */ 38 #define LOG_INFO 6 /* informational */ 39 #define LOG_DEBUG 7 /* debug-level messages */ 40 #endif /* VMS || VXWORKS */ 41 42 /* 43 * syslog output control 44 */ 45 #define NLOG_INFO 0x00000001 46 #define NLOG_EVENT 0x00000002 47 #define NLOG_STATUS 0x00000004 48 #define NLOG_STATIST 0x00000008 49 50 #define NLOG_OSYS 0 /* offset for system flags */ 51 #define NLOG_SYSMASK 0x0000000F /* system log events */ 52 #define NLOG_SYSINFO 0x00000001 /* system info log events */ 53 #define NLOG_SYSEVENT 0x00000002 /* system events */ 54 #define NLOG_SYSSTATUS 0x00000004 /* system status (sync/unsync) */ 55 #define NLOG_SYSSTATIST 0x00000008 /* system statistics output */ 56 57 #define NLOG_OPEER 4 /* offset for peer flags */ 58 #define NLOG_PEERMASK 0x000000F0 /* peer log events */ 59 #define NLOG_PEERINFO 0x00000010 /* peer info log events */ 60 #define NLOG_PEEREVENT 0x00000020 /* peer events */ 61 #define NLOG_PEERSTATUS 0x00000040 /* peer status (sync/unsync) */ 62 #define NLOG_PEERSTATIST 0x00000080 /* peer statistics output */ 63 64 #define NLOG_OCLOCK 8 /* offset for clock flags */ 65 #define NLOG_CLOCKMASK 0x00000F00 /* clock log events */ 66 #define NLOG_CLOCKINFO 0x00000100 /* clock info log events */ 67 #define NLOG_CLOCKEVENT 0x00000200 /* clock events */ 68 #define NLOG_CLOCKSTATUS 0x00000400 /* clock status (sync/unsync) */ 69 #define NLOG_CLOCKSTATIST 0x00000800 /* clock statistics output */ 70 71 #define NLOG_OSYNC 12 /* offset for sync flags */ 72 #define NLOG_SYNCMASK 0x0000F000 /* sync log events */ 73 #define NLOG_SYNCINFO 0x00001000 /* sync info log events */ 74 #define NLOG_SYNCEVENT 0x00002000 /* sync events */ 75 #define NLOG_SYNCSTATUS 0x00004000 /* sync status (sync/unsync) */ 76 #define NLOG_SYNCSTATIST 0x00008000 /* sync statistics output */ 77 78 extern u_int32 ntp_syslogmask; 79 80 #define NLOG(bits) if (ntp_syslogmask & (bits)) 81 82 #define LOGIF(nlog_suffix, msl_args) \ 83 do { \ 84 NLOG(NLOG_##nlog_suffix) /* like "if (...) */ \ 85 msyslog msl_args; \ 86 } while (FALSE) 87 88 extern int change_iobufs(int how); 89 /* how: 0->unbuffered, 1->linebuffer, 2->full */ 90 91 #endif /* NTP_SYSLOG_H */ 92