Blame misc/sys/syslog.h

Packit 6c4009
/*
Packit 6c4009
 * Copyright (c) 1982, 1986, 1988, 1993
Packit 6c4009
 *	The Regents of the University of California.  All rights reserved.
Packit 6c4009
 *
Packit 6c4009
 * Redistribution and use in source and binary forms, with or without
Packit 6c4009
 * modification, are permitted provided that the following conditions
Packit 6c4009
 * are met:
Packit 6c4009
 * 1. Redistributions of source code must retain the above copyright
Packit 6c4009
 *    notice, this list of conditions and the following disclaimer.
Packit 6c4009
 * 2. Redistributions in binary form must reproduce the above copyright
Packit 6c4009
 *    notice, this list of conditions and the following disclaimer in the
Packit 6c4009
 *    documentation and/or other materials provided with the distribution.
Packit 6c4009
 * 4. Neither the name of the University nor the names of its contributors
Packit 6c4009
 *    may be used to endorse or promote products derived from this software
Packit 6c4009
 *    without specific prior written permission.
Packit 6c4009
 *
Packit 6c4009
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
Packit 6c4009
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 6c4009
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 6c4009
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
Packit 6c4009
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 6c4009
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit 6c4009
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit 6c4009
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit 6c4009
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit 6c4009
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit 6c4009
 * SUCH DAMAGE.
Packit 6c4009
 *
Packit 6c4009
 *	@(#)syslog.h	8.1 (Berkeley) 6/2/93
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef _SYS_SYSLOG_H
Packit 6c4009
#define _SYS_SYSLOG_H 1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
#define __need___va_list
Packit 6c4009
#include <stdarg.h>
Packit 6c4009
Packit 6c4009
/* This file defines _PATH_LOG.  */
Packit 6c4009
#include <bits/syslog-path.h>
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * priorities/facilities are encoded into a single 32-bit quantity, where the
Packit 6c4009
 * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
Packit 6c4009
 * (0-big number).  Both the priorities and the facilities map roughly
Packit 6c4009
 * one-to-one to strings in the syslogd(8) source code.  This mapping is
Packit 6c4009
 * included in this file.
Packit 6c4009
 *
Packit 6c4009
 * priorities (these are ordered)
Packit 6c4009
 */
Packit 6c4009
#define	LOG_EMERG	0	/* system is unusable */
Packit 6c4009
#define	LOG_ALERT	1	/* action must be taken immediately */
Packit 6c4009
#define	LOG_CRIT	2	/* critical conditions */
Packit 6c4009
#define	LOG_ERR		3	/* error conditions */
Packit 6c4009
#define	LOG_WARNING	4	/* warning conditions */
Packit 6c4009
#define	LOG_NOTICE	5	/* normal but significant condition */
Packit 6c4009
#define	LOG_INFO	6	/* informational */
Packit 6c4009
#define	LOG_DEBUG	7	/* debug-level messages */
Packit 6c4009
Packit 6c4009
#define	LOG_PRIMASK	0x07	/* mask to extract priority part (internal) */
Packit 6c4009
				/* extract priority */
Packit 6c4009
#define	LOG_PRI(p)	((p) & LOG_PRIMASK)
Packit 6c4009
#define	LOG_MAKEPRI(fac, pri)	((fac) | (pri))
Packit 6c4009
Packit 6c4009
#ifdef SYSLOG_NAMES
Packit 6c4009
#define	INTERNAL_NOPRI	0x10	/* the "no priority" priority */
Packit 6c4009
				/* mark "facility" */
Packit 6c4009
#define	INTERNAL_MARK	LOG_MAKEPRI(LOG_NFACILITIES << 3, 0)
Packit 6c4009
typedef struct _code {
Packit 6c4009
	char	*c_name;
Packit 6c4009
	int	c_val;
Packit 6c4009
} CODE;
Packit 6c4009
Packit 6c4009
CODE prioritynames[] =
Packit 6c4009
  {
Packit 6c4009
    { "alert", LOG_ALERT },
Packit 6c4009
    { "crit", LOG_CRIT },
Packit 6c4009
    { "debug", LOG_DEBUG },
Packit 6c4009
    { "emerg", LOG_EMERG },
Packit 6c4009
    { "err", LOG_ERR },
Packit 6c4009
    { "error", LOG_ERR },		/* DEPRECATED */
Packit 6c4009
    { "info", LOG_INFO },
Packit 6c4009
    { "none", INTERNAL_NOPRI },		/* INTERNAL */
Packit 6c4009
    { "notice", LOG_NOTICE },
Packit 6c4009
    { "panic", LOG_EMERG },		/* DEPRECATED */
Packit 6c4009
    { "warn", LOG_WARNING },		/* DEPRECATED */
Packit 6c4009
    { "warning", LOG_WARNING },
Packit 6c4009
    { NULL, -1 }
Packit 6c4009
  };
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* facility codes */
Packit 6c4009
#define	LOG_KERN	(0<<3)	/* kernel messages */
Packit 6c4009
#define	LOG_USER	(1<<3)	/* random user-level messages */
Packit 6c4009
#define	LOG_MAIL	(2<<3)	/* mail system */
Packit 6c4009
#define	LOG_DAEMON	(3<<3)	/* system daemons */
Packit 6c4009
#define	LOG_AUTH	(4<<3)	/* security/authorization messages */
Packit 6c4009
#define	LOG_SYSLOG	(5<<3)	/* messages generated internally by syslogd */
Packit 6c4009
#define	LOG_LPR		(6<<3)	/* line printer subsystem */
Packit 6c4009
#define	LOG_NEWS	(7<<3)	/* network news subsystem */
Packit 6c4009
#define	LOG_UUCP	(8<<3)	/* UUCP subsystem */
Packit 6c4009
#define	LOG_CRON	(9<<3)	/* clock daemon */
Packit 6c4009
#define	LOG_AUTHPRIV	(10<<3)	/* security/authorization messages (private) */
Packit 6c4009
#define	LOG_FTP		(11<<3)	/* ftp daemon */
Packit 6c4009
Packit 6c4009
	/* other codes through 15 reserved for system use */
Packit 6c4009
#define	LOG_LOCAL0	(16<<3)	/* reserved for local use */
Packit 6c4009
#define	LOG_LOCAL1	(17<<3)	/* reserved for local use */
Packit 6c4009
#define	LOG_LOCAL2	(18<<3)	/* reserved for local use */
Packit 6c4009
#define	LOG_LOCAL3	(19<<3)	/* reserved for local use */
Packit 6c4009
#define	LOG_LOCAL4	(20<<3)	/* reserved for local use */
Packit 6c4009
#define	LOG_LOCAL5	(21<<3)	/* reserved for local use */
Packit 6c4009
#define	LOG_LOCAL6	(22<<3)	/* reserved for local use */
Packit 6c4009
#define	LOG_LOCAL7	(23<<3)	/* reserved for local use */
Packit 6c4009
Packit 6c4009
#define	LOG_NFACILITIES	24	/* current number of facilities */
Packit 6c4009
#define	LOG_FACMASK	0x03f8	/* mask to extract facility part */
Packit 6c4009
				/* facility of pri */
Packit 6c4009
#define	LOG_FAC(p)	(((p) & LOG_FACMASK) >> 3)
Packit 6c4009
Packit 6c4009
#ifdef SYSLOG_NAMES
Packit 6c4009
CODE facilitynames[] =
Packit 6c4009
  {
Packit 6c4009
    { "auth", LOG_AUTH },
Packit 6c4009
    { "authpriv", LOG_AUTHPRIV },
Packit 6c4009
    { "cron", LOG_CRON },
Packit 6c4009
    { "daemon", LOG_DAEMON },
Packit 6c4009
    { "ftp", LOG_FTP },
Packit 6c4009
    { "kern", LOG_KERN },
Packit 6c4009
    { "lpr", LOG_LPR },
Packit 6c4009
    { "mail", LOG_MAIL },
Packit 6c4009
    { "mark", INTERNAL_MARK },		/* INTERNAL */
Packit 6c4009
    { "news", LOG_NEWS },
Packit 6c4009
    { "security", LOG_AUTH },		/* DEPRECATED */
Packit 6c4009
    { "syslog", LOG_SYSLOG },
Packit 6c4009
    { "user", LOG_USER },
Packit 6c4009
    { "uucp", LOG_UUCP },
Packit 6c4009
    { "local0", LOG_LOCAL0 },
Packit 6c4009
    { "local1", LOG_LOCAL1 },
Packit 6c4009
    { "local2", LOG_LOCAL2 },
Packit 6c4009
    { "local3", LOG_LOCAL3 },
Packit 6c4009
    { "local4", LOG_LOCAL4 },
Packit 6c4009
    { "local5", LOG_LOCAL5 },
Packit 6c4009
    { "local6", LOG_LOCAL6 },
Packit 6c4009
    { "local7", LOG_LOCAL7 },
Packit 6c4009
    { NULL, -1 }
Packit 6c4009
  };
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * arguments to setlogmask.
Packit 6c4009
 */
Packit 6c4009
#define	LOG_MASK(pri)	(1 << (pri))		/* mask for one priority */
Packit 6c4009
#define	LOG_UPTO(pri)	((1 << ((pri)+1)) - 1)	/* all priorities through pri */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Option flags for openlog.
Packit 6c4009
 *
Packit 6c4009
 * LOG_ODELAY no longer does anything.
Packit 6c4009
 * LOG_NDELAY is the inverse of what it used to be.
Packit 6c4009
 */
Packit 6c4009
#define	LOG_PID		0x01	/* log the pid with each message */
Packit 6c4009
#define	LOG_CONS	0x02	/* log on the console if errors in sending */
Packit 6c4009
#define	LOG_ODELAY	0x04	/* delay open until first syslog() (default) */
Packit 6c4009
#define	LOG_NDELAY	0x08	/* don't delay open */
Packit 6c4009
#define	LOG_NOWAIT	0x10	/* don't wait for console forks: DEPRECATED */
Packit 6c4009
#define	LOG_PERROR	0x20	/* log to stderr as well */
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
/* Close descriptor used to write to system logger.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
extern void closelog (void);
Packit 6c4009
Packit 6c4009
/* Open connection to system logger.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
extern void openlog (const char *__ident, int __option, int __facility);
Packit 6c4009
Packit 6c4009
/* Set the log mask level.  */
Packit 6c4009
extern int setlogmask (int __mask) __THROW;
Packit 6c4009
Packit 6c4009
/* Generate a log message using FMT string and option arguments.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
extern void syslog (int __pri, const char *__fmt, ...)
Packit 6c4009
     __attribute__ ((__format__ (__printf__, 2, 3)));
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
/* Generate a log message using FMT and using arguments pointed to by AP.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
Packit 6c4009
     __attribute__ ((__format__ (__printf__, 2, 0)));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Define some macros helping to catch buffer overflows.  */
Packit 6c4009
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
Packit 6c4009
# include <bits/syslog.h>
Packit 6c4009
#endif
Packit 6c4009
#ifdef __LDBL_COMPAT
Packit 6c4009
# include <bits/syslog-ldbl.h>
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* sys/syslog.h */