1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/lib/libast/comp/syslog.h
Martijn Dekker 441dcc0483 Upgrade licence to EPL 2.0
EPL 1.0 says, in section 7: "The Program (including Contributions)
may always be distributed subject to the version of the Agreement
under which it was received. In addition, after a new version of
the Agreement is published, Contributor may elect to distribute the
Program (including its Contributions) under the new version."

The Eclipse Foundation also encourage everyone to upgrade:
https://www.eclipse.org/legal/epl-2.0/faq.php#h.60mjudroo8e5
https://www.eclipse.org/legal/epl-2.0/faq.php#h.tci84nlsqpgw

Unfortunately the new Secondary License option is not available to
us as we're not the original copyright holders and don't have the
legal power to add one. So, no GPL compatibility. Sorry.
2022-07-28 05:46:08 +02:00

112 lines
4.4 KiB
C

/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 2.0 *
* *
* A copy of the License is available at *
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html *
* (with md5 checksum 84283fa8859daf213bdda5a9f8d1be1d) *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
/*
* POSIX syslog interface definitions
*/
#ifndef _SYSLOG_H
#define _SYSLOG_H
#include <stdarg.h>
#define LOG_PRIBITS 3 /* priority bits */
#define LOG_FACBITS 7 /* facility bits */
#define LOG_PRIMASK ((1<<LOG_PRIBITS)-1)
#define LOG_FACMASK (((1<<LOG_FACBITS)-1)<<LOG_PRIBITS)
#define LOG_PRI(p) ((p)&((1<<LOG_PRIBITS)-1))
#define LOG_FAC(p) (((p)>>LOG_PRIBITS)&((1<<LOG_FACBITS)-1))
#define LOG_MAKEPRI(f,p) (((f)<<LOG_PRIBITS)|(p))
/* syslog priority severity levels */
#define LOG_EMERG 0 /* panic condition */
#define LOG_ALERT 1 /* should be corrected immediately */
#define LOG_CRIT 2 /* critical condition */
#define LOG_ERR 3 /* error condition */
#define LOG_WARNING 4 /* warning condition */
#define LOG_NOTICE 5 /* no error but may need intervention */
#define LOG_INFO 6 /* informational message */
#define LOG_DEBUG 7 /* debug message */
/* setlogmask masks */
#define LOG_MASK(s) (1<<(s)) /* individual severity s */
#define LOG_UPTO(s) ((1<<((s)+1))-1)/* up to and including s */
/* syslog facilities */
#define LOG_KERN (0<<LOG_PRIBITS) /* kernel */
#define LOG_USER (1<<LOG_PRIBITS) /* user process -- default */
#define LOG_MAIL (2<<LOG_PRIBITS) /* mail */
#define LOG_DAEMON (3<<LOG_PRIBITS) /* daemon */
#define LOG_AUTH (4<<LOG_PRIBITS) /* security/authorization */
#define LOG_SYSLOG (5<<LOG_PRIBITS) /* syslog internal */
#define LOG_LPR (6<<LOG_PRIBITS) /* line printer */
#define LOG_NEWS (7<<LOG_PRIBITS) /* network news */
#define LOG_UUCP (8<<LOG_PRIBITS) /* uucp */
#define LOG_CRON (9<<LOG_PRIBITS) /* cron */
#define LOG_AUDIT (13<<LOG_PRIBITS) /* audit daemon */
#define LOG_LFMT (14<<LOG_PRIBITS) /* logalert */
#define LOG_LOCAL0 (16<<LOG_PRIBITS) /* reserved for local use */
#define LOG_LOCAL1 (17<<LOG_PRIBITS) /* reserved for local use */
#define LOG_LOCAL2 (18<<LOG_PRIBITS) /* reserved for local use */
#define LOG_LOCAL3 (19<<LOG_PRIBITS) /* reserved for local use */
#define LOG_LOCAL4 (20<<LOG_PRIBITS) /* reserved for local use */
#define LOG_LOCAL5 (21<<LOG_PRIBITS) /* reserved for local use */
#define LOG_LOCAL6 (22<<LOG_PRIBITS) /* reserved for local use */
#define LOG_LOCAL7 (23<<LOG_PRIBITS) /* reserved for local use */
#define LOG_NFACILITIES 24
/* openlog flags */
#define LOG_PID 0x01 /* log the PID with each message */
#define LOG_CONS 0x02 /* log to console if errors in sending */
#define LOG_NDELAY 0x08 /* open right now */
#define LOG_ODELAY 0x04 /* delay open until syslog() is called */
#define LOG_NOWAIT 0x10 /* don't wait() for any child processes */
#define LOG_PERROR 0x20 /* log to stderr too */
#define LOG_LEVEL 0x40 /* tag messages with facility/level */
#ifdef LOG_TABLES
/* encoding support */
#include <ast_namval.h>
#define log_facility _log_facility
#define log_severity _log_severity
#define LOG_FACILITY(p) LOG_FAC(p) /* get facility index from pri */
#define LOG_SEVERITY(p) LOG_PRI(p) /* get severity from pri */
extern const Namval_t log_facility[];
extern const Namval_t log_severity[];
#endif
extern void closelog(void);
extern void openlog(const char*, int, int);
extern int setlogmask(int);
extern void syslog(int, const char*, ...);
extern void vsyslog(int, const char*, va_list);
#endif