sl@0: /*- sl@0: * Copyright (c) 1982, 1986, 1988, 1993 sl@0: * The Regents of the University of California. All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 4. Neither the name of the University nor the names of its contributors sl@0: * may be used to endorse or promote products derived from this software sl@0: * without specific prior written permission. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * © * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. sl@0: * @(#)syslog.h 8.1 (Berkeley) 6/2/93 sl@0: * $FreeBSD: src/sys/sys/syslog.h,v 1.26 2005/01/07 02:29:24 imp Exp $ sl@0: */ sl@0: sl@0: #ifndef _SYS_SYSLOG_H_ sl@0: #define _SYS_SYSLOG_H_ sl@0: sl@0: #define _PATH_LOG "/var/run/log" sl@0: #define _PATH_LOG_PRIV "/var/run/logpriv" sl@0: #define _PATH_OLDLOG "/dev/log" /* backward compatibility */ sl@0: sl@0: /* sl@0: * priorities/facilities are encoded into a single 32-bit quantity, where the sl@0: * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility sl@0: * (0-big number). Both the priorities and the facilities map roughly sl@0: * one-to-one to strings in the syslogd(8) source code. This mapping is sl@0: * included in this file. sl@0: * sl@0: * priorities (these are ordered) sl@0: */ sl@0: #define LOG_EMERG 0 /* system is unusable */ sl@0: #define LOG_ALERT 1 /* action must be taken immediately */ sl@0: #define LOG_CRIT 2 /* critical conditions */ sl@0: #define LOG_ERR 3 /* error conditions */ sl@0: #define LOG_WARNING 4 /* warning conditions */ sl@0: #define LOG_NOTICE 5 /* normal but significant condition */ sl@0: #define LOG_INFO 6 /* informational */ sl@0: #define LOG_DEBUG 7 /* debug-level messages */ sl@0: sl@0: #define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ sl@0: /* extract priority */ sl@0: #define LOG_PRI(p) ((p) & LOG_PRIMASK) sl@0: #define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) sl@0: sl@0: #ifdef SYSLOG_NAMES sl@0: #define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ sl@0: /* mark "facility" */ sl@0: #define INTERNAL_MARK LOG_MAKEPRI((LOG_NFACILITIES<<3), 0) sl@0: typedef struct _code { sl@0: const char *c_name; sl@0: int c_val; sl@0: } CODE; sl@0: sl@0: CODE prioritynames[] = { sl@0: { "alert", LOG_ALERT, }, sl@0: { "crit", LOG_CRIT, }, sl@0: { "debug", LOG_DEBUG, }, sl@0: { "emerg", LOG_EMERG, }, sl@0: { "err", LOG_ERR, }, sl@0: { "error", LOG_ERR, }, /* DEPRECATED */ sl@0: { "info", LOG_INFO, }, sl@0: { "none", INTERNAL_NOPRI, }, /* INTERNAL */ sl@0: { "notice", LOG_NOTICE, }, sl@0: { "panic", LOG_EMERG, }, /* DEPRECATED */ sl@0: { "warn", LOG_WARNING, }, /* DEPRECATED */ sl@0: { "warning", LOG_WARNING, }, sl@0: { NULL, -1, } sl@0: }; sl@0: #endif sl@0: sl@0: /* facility codes */ sl@0: #define LOG_KERN (0<<3) /* kernel messages */ sl@0: #define LOG_USER (1<<3) /* random user-level messages */ sl@0: #define LOG_MAIL (2<<3) /* mail system */ sl@0: #define LOG_DAEMON (3<<3) /* system daemons */ sl@0: #define LOG_AUTH (4<<3) /* authorization messages */ sl@0: #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ sl@0: #define LOG_LPR (6<<3) /* line printer subsystem */ sl@0: #define LOG_NEWS (7<<3) /* network news subsystem */ sl@0: #define LOG_UUCP (8<<3) /* UUCP subsystem */ sl@0: #define LOG_CRON (9<<3) /* clock daemon */ sl@0: #define LOG_AUTHPRIV (10<<3) /* authorization messages (private) */ sl@0: /* Facility #10 clashes in DEC UNIX, where */ sl@0: /* it's defined as LOG_MEGASAFE for AdvFS */ sl@0: /* event logging. */ sl@0: #define LOG_FTP (11<<3) /* ftp daemon */ sl@0: #define LOG_NTP (12<<3) /* NTP subsystem */ sl@0: #define LOG_SECURITY (13<<3) /* security subsystems (firewalling, etc.) */ sl@0: #define LOG_CONSOLE (14<<3) /* /dev/console output */ sl@0: sl@0: /* other codes through 15 reserved for system use */ sl@0: #define LOG_LOCAL0 (16<<3) /* reserved for local use */ sl@0: #define LOG_LOCAL1 (17<<3) /* reserved for local use */ sl@0: #define LOG_LOCAL2 (18<<3) /* reserved for local use */ sl@0: #define LOG_LOCAL3 (19<<3) /* reserved for local use */ sl@0: #define LOG_LOCAL4 (20<<3) /* reserved for local use */ sl@0: #define LOG_LOCAL5 (21<<3) /* reserved for local use */ sl@0: #define LOG_LOCAL6 (22<<3) /* reserved for local use */ sl@0: #define LOG_LOCAL7 (23<<3) /* reserved for local use */ sl@0: sl@0: #define LOG_NFACILITIES 24 /* current number of facilities */ sl@0: #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ sl@0: /* facility of pri */ sl@0: #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) sl@0: sl@0: #ifdef SYSLOG_NAMES sl@0: CODE facilitynames[] = { sl@0: { "auth", LOG_AUTH, }, sl@0: { "authpriv", LOG_AUTHPRIV, }, sl@0: { "console", LOG_CONSOLE, }, sl@0: { "cron", LOG_CRON, }, sl@0: { "daemon", LOG_DAEMON, }, sl@0: { "ftp", LOG_FTP, }, sl@0: { "kern", LOG_KERN, }, sl@0: { "lpr", LOG_LPR, }, sl@0: { "mail", LOG_MAIL, }, sl@0: { "mark", INTERNAL_MARK, }, /* INTERNAL */ sl@0: { "news", LOG_NEWS, }, sl@0: { "ntp", LOG_NTP, }, sl@0: { "security", LOG_SECURITY, }, sl@0: { "syslog", LOG_SYSLOG, }, sl@0: { "user", LOG_USER, }, sl@0: { "uucp", LOG_UUCP, }, sl@0: { "local0", LOG_LOCAL0, }, sl@0: { "local1", LOG_LOCAL1, }, sl@0: { "local2", LOG_LOCAL2, }, sl@0: { "local3", LOG_LOCAL3, }, sl@0: { "local4", LOG_LOCAL4, }, sl@0: { "local5", LOG_LOCAL5, }, sl@0: { "local6", LOG_LOCAL6, }, sl@0: { "local7", LOG_LOCAL7, }, sl@0: { NULL, -1, } sl@0: }; sl@0: #endif sl@0: sl@0: #ifdef _KERNEL sl@0: #define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */ sl@0: #endif sl@0: sl@0: /* sl@0: * arguments to setlogmask. sl@0: */ sl@0: #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ sl@0: #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ sl@0: sl@0: /* sl@0: * Option flags for openlog. sl@0: * sl@0: * LOG_ODELAY no longer does anything. sl@0: * LOG_NDELAY is the inverse of what it used to be. sl@0: */ sl@0: #define LOG_PID 0x01 /* log the pid with each message */ sl@0: #define LOG_CONS 0x02 /* log on the console if errors in sending */ sl@0: #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ sl@0: #define LOG_NDELAY 0x08 /* don't delay open */ sl@0: #define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ sl@0: #define LOG_PERROR 0x20 /* log to stderr as well */ sl@0: sl@0: #ifdef _KERNEL sl@0: sl@0: #else /* not _KERNEL */ sl@0: sl@0: /* sl@0: * Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two sl@0: * places ( and ), so if we include one sl@0: * of them here we may collide with the utility's includes. It's unreasonable sl@0: * for utilities to have to include one of them to include syslog.h, so we get sl@0: * __va_list from and use it. sl@0: */ sl@0: #include sl@0: #include sl@0: sl@0: __BEGIN_DECLS sl@0: void syslog(int, const char *, ...) __printflike(2, 3); sl@0: __END_DECLS sl@0: sl@0: #endif /* !_KERNEL */ sl@0: sl@0: #endif