Subversion Repositories SvarDOS

Rev

Rev 616 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
207 mateuszvis 1
/*!\file sys/syslog.h
2
 * syslog() facility.
3
 */
4
 
5
/*
6
 * Copyright (c) 1982, 1986, 1988, 1993
7
 *	The Regents of the University of California.  All rights reserved.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions
11
 * are met:
12
 * 1. Redistributions of source code must retain the above copyright
13
 *    notice, this list of conditions and the following disclaimer.
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in the
16
 *    documentation and/or other materials provided with the distribution.
17
 * 3. All advertising materials mentioning features or use of this software
18
 *    must display the following acknowledgement:
19
 *	This product includes software developed by the University of
20
 *	California, Berkeley and its contributors.
21
 * 4. Neither the name of the University nor the names of its contributors
22
 *    may be used to endorse or promote products derived from this software
23
 *    without specific prior written permission.
24
 *
25
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35
 * SUCH DAMAGE.
36
 *
37
 *	@(#)syslog.h	8.1 (Berkeley) 6/2/93
38
 * $Id: syslog.h,v 1.15 1997/10/06 20:37:01 joerg Exp $
39
 */
40
 
41
#ifndef __SYS_SYSLOG_H
42
#define __SYS_SYSLOG_H
43
 
44
#ifndef _PATH_LOG
45
#define	_PATH_LOG	"/var/run/log"
46
#endif
47
 
48
#ifndef _PATH_OLDLOG
49
#define _PATH_OLDLOG    "/dev/log"      /* backward compatibility */
50
#endif
51
 
52
/*
53
 * priorities/facilities are encoded into a single 32-bit quantity, where the
54
 * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
55
 * (0-big number).  Both the priorities and the facilities map roughly
56
 * one-to-one to strings in the syslogd(8) source code.  This mapping is
57
 * included in this file.
58
 *
59
 * priorities (these are ordered)
60
 */
61
#define	LOG_EMERG	0	/* system is unusable */
62
#define	LOG_ALERT	1	/* action must be taken immediately */
63
#define	LOG_CRIT	2	/* critical conditions */
64
#define	LOG_ERR		3	/* error conditions */
65
#define	LOG_WARNING	4	/* warning conditions */
66
#define	LOG_NOTICE	5	/* normal but significant condition */
67
#define	LOG_INFO	6	/* informational */
68
#define	LOG_DEBUG	7	/* debug-level messages */
69
 
70
#define	LOG_PRIMASK	0x07	/* mask to extract priority part (internal) */
71
				/* extract priority */
72
#define	LOG_PRI(p)	((p) & LOG_PRIMASK)
73
#define	LOG_MAKEPRI(fac, pri)	((fac) | (pri))
74
 
75
#define INTERNAL_NOPRI  0x10    /* the "no priority" priority */
76
				/* mark "facility" */
77
#define	INTERNAL_MARK	LOG_MAKEPRI((LOG_NFACILITIES<<3), 0)
78
 
79
typedef struct _code {
80
        unsigned long c_val;
81
        const char   *c_name;
82
      } CODE;
83
 
84
extern CODE prioritynames[13];
85
 
86
/* facility codes */
87
#define	LOG_KERN	(0<<3)	/* kernel messages */
88
#define	LOG_USER	(1<<3)	/* random user-level messages */
89
#define	LOG_MAIL	(2<<3)	/* mail system */
90
#define	LOG_DAEMON	(3<<3)	/* system daemons */
91
#define	LOG_AUTH	(4<<3)	/* security/authorization messages */
92
#define	LOG_SYSLOG	(5<<3)	/* messages generated internally by syslogd */
93
#define	LOG_LPR		(6<<3)	/* line printer subsystem */
94
#define	LOG_NEWS	(7<<3)	/* network news subsystem */
95
#define	LOG_UUCP	(8<<3)	/* UUCP subsystem */
96
#define	LOG_CRON	(9<<3)	/* clock daemon */
97
#define	LOG_AUTHPRIV	(10<<3)	/* security/authorization messages (private) */
98
				/* Facility #10 clashes in DEC UNIX, where */
99
				/* it's defined as LOG_MEGASAFE for AdvFS  */
100
				/* event logging.                          */
101
#define	LOG_FTP		(11<<3)	/* ftp daemon */
102
#define	LOG_NTP		(12<<3)	/* NTP subsystem */
103
 
104
	/* other codes through 15 reserved for system use */
105
#define	LOG_LOCAL0	(16<<3)	/* reserved for local use */
106
#define	LOG_LOCAL1	(17<<3)	/* reserved for local use */
107
#define	LOG_LOCAL2	(18<<3)	/* reserved for local use */
108
#define	LOG_LOCAL3	(19<<3)	/* reserved for local use */
109
#define	LOG_LOCAL4	(20<<3)	/* reserved for local use */
110
#define	LOG_LOCAL5	(21<<3)	/* reserved for local use */
111
#define	LOG_LOCAL6	(22<<3)	/* reserved for local use */
112
#define	LOG_LOCAL7	(23<<3)	/* reserved for local use */
113
 
114
#define	LOG_NFACILITIES	24	/* current number of facilities */
115
#define	LOG_FACMASK	0x03f8	/* mask to extract facility part */
116
				/* facility of pri */
117
#define	LOG_FAC(p)	(((p) & LOG_FACMASK) >> 3)
118
 
119
extern CODE facilitynames[24];
120
 
121
/*
122
 * arguments to setlogmask.
123
 */
124
#define	LOG_MASK(pri)	(1 << (pri))		/* mask for one priority */
125
#define	LOG_UPTO(pri)	((1 << ((pri)+1)) - 1)	/* all priorities through pri */
126
 
127
/*
128
 * Option flags for openlog.
129
 *
130
 * LOG_ODELAY no longer does anything.
131
 * LOG_NDELAY is the inverse of what it used to be.
132
 */
133
#define	LOG_PID		0x01	/* log the pid with each message */
134
#define	LOG_CONS	0x02	/* log on the console if errors in sending */
135
#define	LOG_ODELAY	0x04	/* delay open until first syslog() (default) */
136
#define	LOG_NDELAY	0x08	/* don't delay open */
137
#define	LOG_NOWAIT	0x10	/* don't wait for console forks: DEPRECATED */
138
#define	LOG_PERROR	0x20	/* log to stderr as well */
139
 
140
#include <stdarg.h>
141
 
142
#ifndef __SYS_W32API_H
143
#include <sys/w32api.h>
144
#endif
145
 
146
#ifndef __SYS_CDEFS_H
147
#include <sys/cdefs.h>
148
#endif
149
 
150
__BEGIN_DECLS
151
 
152
W32_FUNC void  closelog   (void);
153
W32_FUNC void  openlog    (const char *, int, int);
154
W32_FUNC int   setlogmask (int);
155
W32_FUNC void  syslog     (int, const char *, ...);
156
W32_FUNC void  vsyslog    (int, const char *, va_list);
157
 
158
__END_DECLS
159
 
160
#endif