os/ossrv/genericopenlibs/openenvcore/include/sys/syslog.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*-
sl@0
     2
 * Copyright (c) 1982, 1986, 1988, 1993
sl@0
     3
 *	The Regents of the University of California.  All rights reserved.
sl@0
     4
 *
sl@0
     5
 * Redistribution and use in source and binary forms, with or without
sl@0
     6
 * modification, are permitted provided that the following conditions
sl@0
     7
 * are met:
sl@0
     8
 * 1. Redistributions of source code must retain the above copyright
sl@0
     9
 *    notice, this list of conditions and the following disclaimer.
sl@0
    10
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    11
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    12
 *    documentation and/or other materials provided with the distribution.
sl@0
    13
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    14
 *    may be used to endorse or promote products derived from this software
sl@0
    15
 *    without specific prior written permission.
sl@0
    16
 *
sl@0
    17
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    27
 * SUCH DAMAGE.
sl@0
    28
 * © * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
sl@0
    29
 *	@(#)syslog.h	8.1 (Berkeley) 6/2/93
sl@0
    30
 * $FreeBSD: src/sys/sys/syslog.h,v 1.26 2005/01/07 02:29:24 imp Exp $
sl@0
    31
 */
sl@0
    32
sl@0
    33
#ifndef _SYS_SYSLOG_H_
sl@0
    34
#define _SYS_SYSLOG_H_
sl@0
    35
sl@0
    36
#define	_PATH_LOG	"/var/run/log"
sl@0
    37
#define	_PATH_LOG_PRIV	"/var/run/logpriv"
sl@0
    38
#define	_PATH_OLDLOG	"/dev/log"	/* backward compatibility */
sl@0
    39
sl@0
    40
/*
sl@0
    41
 * priorities/facilities are encoded into a single 32-bit quantity, where the
sl@0
    42
 * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
sl@0
    43
 * (0-big number).  Both the priorities and the facilities map roughly
sl@0
    44
 * one-to-one to strings in the syslogd(8) source code.  This mapping is
sl@0
    45
 * included in this file.
sl@0
    46
 *
sl@0
    47
 * priorities (these are ordered)
sl@0
    48
 */
sl@0
    49
#define	LOG_EMERG	0	/* system is unusable */
sl@0
    50
#define	LOG_ALERT	1	/* action must be taken immediately */
sl@0
    51
#define	LOG_CRIT	2	/* critical conditions */
sl@0
    52
#define	LOG_ERR		3	/* error conditions */
sl@0
    53
#define	LOG_WARNING	4	/* warning conditions */
sl@0
    54
#define	LOG_NOTICE	5	/* normal but significant condition */
sl@0
    55
#define	LOG_INFO	6	/* informational */
sl@0
    56
#define	LOG_DEBUG	7	/* debug-level messages */
sl@0
    57
sl@0
    58
#define	LOG_PRIMASK	0x07	/* mask to extract priority part (internal) */
sl@0
    59
				/* extract priority */
sl@0
    60
#define	LOG_PRI(p)	((p) & LOG_PRIMASK)
sl@0
    61
#define	LOG_MAKEPRI(fac, pri)	((fac) | (pri))
sl@0
    62
sl@0
    63
#ifdef SYSLOG_NAMES
sl@0
    64
#define	INTERNAL_NOPRI	0x10	/* the "no priority" priority */
sl@0
    65
				/* mark "facility" */
sl@0
    66
#define	INTERNAL_MARK	LOG_MAKEPRI((LOG_NFACILITIES<<3), 0)
sl@0
    67
typedef struct _code {
sl@0
    68
	const char	*c_name;
sl@0
    69
	int		c_val;
sl@0
    70
} CODE;
sl@0
    71
sl@0
    72
CODE prioritynames[] = {
sl@0
    73
	{ "alert",	LOG_ALERT,	},
sl@0
    74
	{ "crit",	LOG_CRIT,	},
sl@0
    75
	{ "debug",	LOG_DEBUG,	},
sl@0
    76
	{ "emerg",	LOG_EMERG,	},
sl@0
    77
	{ "err",	LOG_ERR,	},
sl@0
    78
	{ "error",	LOG_ERR,	},	/* DEPRECATED */
sl@0
    79
	{ "info",	LOG_INFO,	},
sl@0
    80
	{ "none",	INTERNAL_NOPRI,	},	/* INTERNAL */
sl@0
    81
	{ "notice",	LOG_NOTICE,	},
sl@0
    82
	{ "panic", 	LOG_EMERG,	},	/* DEPRECATED */
sl@0
    83
	{ "warn",	LOG_WARNING,	},	/* DEPRECATED */
sl@0
    84
	{ "warning",	LOG_WARNING,	},
sl@0
    85
	{ NULL,		-1,		}
sl@0
    86
};
sl@0
    87
#endif
sl@0
    88
sl@0
    89
/* facility codes */
sl@0
    90
#define	LOG_KERN	(0<<3)	/* kernel messages */
sl@0
    91
#define	LOG_USER	(1<<3)	/* random user-level messages */
sl@0
    92
#define	LOG_MAIL	(2<<3)	/* mail system */
sl@0
    93
#define	LOG_DAEMON	(3<<3)	/* system daemons */
sl@0
    94
#define	LOG_AUTH	(4<<3)	/* authorization messages */
sl@0
    95
#define	LOG_SYSLOG	(5<<3)	/* messages generated internally by syslogd */
sl@0
    96
#define	LOG_LPR		(6<<3)	/* line printer subsystem */
sl@0
    97
#define	LOG_NEWS	(7<<3)	/* network news subsystem */
sl@0
    98
#define	LOG_UUCP	(8<<3)	/* UUCP subsystem */
sl@0
    99
#define	LOG_CRON	(9<<3)	/* clock daemon */
sl@0
   100
#define	LOG_AUTHPRIV	(10<<3)	/* authorization messages (private) */
sl@0
   101
				/* Facility #10 clashes in DEC UNIX, where */
sl@0
   102
				/* it's defined as LOG_MEGASAFE for AdvFS  */
sl@0
   103
				/* event logging.                          */
sl@0
   104
#define	LOG_FTP		(11<<3)	/* ftp daemon */
sl@0
   105
#define	LOG_NTP		(12<<3)	/* NTP subsystem */
sl@0
   106
#define	LOG_SECURITY	(13<<3) /* security subsystems (firewalling, etc.) */
sl@0
   107
#define	LOG_CONSOLE	(14<<3) /* /dev/console output */
sl@0
   108
sl@0
   109
	/* other codes through 15 reserved for system use */
sl@0
   110
#define	LOG_LOCAL0	(16<<3)	/* reserved for local use */
sl@0
   111
#define	LOG_LOCAL1	(17<<3)	/* reserved for local use */
sl@0
   112
#define	LOG_LOCAL2	(18<<3)	/* reserved for local use */
sl@0
   113
#define	LOG_LOCAL3	(19<<3)	/* reserved for local use */
sl@0
   114
#define	LOG_LOCAL4	(20<<3)	/* reserved for local use */
sl@0
   115
#define	LOG_LOCAL5	(21<<3)	/* reserved for local use */
sl@0
   116
#define	LOG_LOCAL6	(22<<3)	/* reserved for local use */
sl@0
   117
#define	LOG_LOCAL7	(23<<3)	/* reserved for local use */
sl@0
   118
sl@0
   119
#define	LOG_NFACILITIES	24	/* current number of facilities */
sl@0
   120
#define	LOG_FACMASK	0x03f8	/* mask to extract facility part */
sl@0
   121
				/* facility of pri */
sl@0
   122
#define	LOG_FAC(p)	(((p) & LOG_FACMASK) >> 3)
sl@0
   123
sl@0
   124
#ifdef SYSLOG_NAMES
sl@0
   125
CODE facilitynames[] = {
sl@0
   126
	{ "auth",	LOG_AUTH,	},
sl@0
   127
	{ "authpriv",	LOG_AUTHPRIV,	},
sl@0
   128
	{ "console", 	LOG_CONSOLE,	},
sl@0
   129
	{ "cron", 	LOG_CRON,	},
sl@0
   130
	{ "daemon",	LOG_DAEMON,	},
sl@0
   131
	{ "ftp",	LOG_FTP,	},
sl@0
   132
	{ "kern",	LOG_KERN,	},
sl@0
   133
	{ "lpr",	LOG_LPR,	},
sl@0
   134
	{ "mail",	LOG_MAIL,	},
sl@0
   135
	{ "mark", 	INTERNAL_MARK,	},	/* INTERNAL */
sl@0
   136
	{ "news",	LOG_NEWS,	},
sl@0
   137
	{ "ntp",	LOG_NTP,	},
sl@0
   138
	{ "security",	LOG_SECURITY,	},
sl@0
   139
	{ "syslog",	LOG_SYSLOG,	},
sl@0
   140
	{ "user",	LOG_USER,	},
sl@0
   141
	{ "uucp",	LOG_UUCP,	},
sl@0
   142
	{ "local0",	LOG_LOCAL0,	},
sl@0
   143
	{ "local1",	LOG_LOCAL1,	},
sl@0
   144
	{ "local2",	LOG_LOCAL2,	},
sl@0
   145
	{ "local3",	LOG_LOCAL3,	},
sl@0
   146
	{ "local4",	LOG_LOCAL4,	},
sl@0
   147
	{ "local5",	LOG_LOCAL5,	},
sl@0
   148
	{ "local6",	LOG_LOCAL6,	},
sl@0
   149
	{ "local7",	LOG_LOCAL7,	},
sl@0
   150
	{ NULL,		-1,		}
sl@0
   151
};
sl@0
   152
#endif
sl@0
   153
sl@0
   154
#ifdef _KERNEL
sl@0
   155
#define	LOG_PRINTF	-1	/* pseudo-priority to indicate use of printf */
sl@0
   156
#endif
sl@0
   157
sl@0
   158
/*
sl@0
   159
 * arguments to setlogmask.
sl@0
   160
 */
sl@0
   161
#define	LOG_MASK(pri)	(1 << (pri))		/* mask for one priority */
sl@0
   162
#define	LOG_UPTO(pri)	((1 << ((pri)+1)) - 1)	/* all priorities through pri */
sl@0
   163
sl@0
   164
/*
sl@0
   165
 * Option flags for openlog.
sl@0
   166
 *
sl@0
   167
 * LOG_ODELAY no longer does anything.
sl@0
   168
 * LOG_NDELAY is the inverse of what it used to be.
sl@0
   169
 */
sl@0
   170
#define	LOG_PID		0x01	/* log the pid with each message */
sl@0
   171
#define	LOG_CONS	0x02	/* log on the console if errors in sending */
sl@0
   172
#define	LOG_ODELAY	0x04	/* delay open until first syslog() (default) */
sl@0
   173
#define	LOG_NDELAY	0x08	/* don't delay open */
sl@0
   174
#define	LOG_NOWAIT	0x10	/* don't wait for console forks: DEPRECATED */
sl@0
   175
#define	LOG_PERROR	0x20	/* log to stderr as well */
sl@0
   176
sl@0
   177
#ifdef _KERNEL
sl@0
   178
sl@0
   179
#else /* not _KERNEL */
sl@0
   180
sl@0
   181
/*
sl@0
   182
 * Don't use va_list in the vsyslog() prototype.   Va_list is typedef'd in two
sl@0
   183
 * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
sl@0
   184
 * of them here we may collide with the utility's includes.  It's unreasonable
sl@0
   185
 * for utilities to have to include one of them to include syslog.h, so we get
sl@0
   186
 * __va_list from <sys/_types.h> and use it.
sl@0
   187
 */
sl@0
   188
#include <sys/cdefs.h>
sl@0
   189
#include <sys/_types.h>
sl@0
   190
sl@0
   191
__BEGIN_DECLS
sl@0
   192
void	syslog(int, const char *, ...) __printflike(2, 3);
sl@0
   193
__END_DECLS
sl@0
   194
sl@0
   195
#endif /* !_KERNEL */
sl@0
   196
sl@0
   197
#endif