summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Jacques Bernard-Gundol <jjbg@cvs.openbsd.org>2001-10-24 08:16:43 +0000
committerJean-Jacques Bernard-Gundol <jjbg@cvs.openbsd.org>2001-10-24 08:16:43 +0000
commitdab7fa54300ebdfe67399b7ae0db895888157c2a (patch)
treeca74c2edb5bbd260a106b689c3ae65a42c55bb12
parentd63faf6dea63e4725598059c282c6c69d1787061 (diff)
syslog_r() implementation. deraadt@ ok.
-rw-r--r--kerberosV/src/lib/krb5/log.c53
-rw-r--r--lib/libc/gen/syslog.3113
-rw-r--r--lib/libc/gen/syslog.c263
-rw-r--r--lib/libc/shlib_version2
-rw-r--r--lib/libc_r/shlib_version2
-rw-r--r--sys/sys/syslog.h28
6 files changed, 343 insertions, 118 deletions
diff --git a/kerberosV/src/lib/krb5/log.c b/kerberosV/src/lib/krb5/log.c
index 64c51a2d946..f179503ba38 100644
--- a/kerberosV/src/lib/krb5/log.c
+++ b/kerberosV/src/lib/krb5/log.c
@@ -33,7 +33,7 @@
#include "krb5_locl.h"
-RCSID("$KTH: log.c,v 1.25 2000/09/17 21:46:07 assar Exp $");
+RCSID("$KTH: log.c,v 1.26 2001/05/14 06:14:49 assar Exp $");
struct facility {
int min;
@@ -120,11 +120,14 @@ krb5_initlog(krb5_context context,
krb5_log_facility **fac)
{
krb5_log_facility *f = calloc(1, sizeof(*f));
- if(f == NULL)
+ if(f == NULL) {
+ krb5_set_error_string (context, "malloc: out of memory");
return ENOMEM;
+ }
f->program = strdup(program);
if(f->program == NULL){
free(f);
+ krb5_set_error_string (context, "malloc: out of memory");
return ENOMEM;
}
*fac = f;
@@ -141,8 +144,10 @@ krb5_addlog_func(krb5_context context,
void *data)
{
struct facility *fp = log_realloc(fac);
- if(fp == NULL)
+ if(fp == NULL) {
+ krb5_set_error_string (context, "malloc: out of memory");
return ENOMEM;
+ }
fp->min = min;
fp->max = max;
fp->log = log;
@@ -151,8 +156,9 @@ krb5_addlog_func(krb5_context context,
return 0;
}
+/* Avoid conflict with syslog_data in syslog.h, rename to syslog_d */
-struct syslog_data{
+struct syslog_d{
int priority;
};
@@ -162,7 +168,7 @@ log_syslog(const char *time,
void *data)
{
- struct syslog_data *s = data;
+ struct syslog_d *s = data;
syslog(s->priority, "%s", msg);
}
@@ -178,11 +184,13 @@ open_syslog(krb5_context context,
krb5_log_facility *facility, int min, int max,
const char *sev, const char *fac)
{
- struct syslog_data *sd = malloc(sizeof(*sd));
+ struct syslog_d *sd = malloc(sizeof(*sd));
int i;
- if(sd == NULL)
+ if(sd == NULL) {
+ krb5_set_error_string (context, "malloc: out of memory");
return ENOMEM;
+ }
i = find_value(sev, syslogvals);
if(i == -1)
i = LOG_ERR;
@@ -232,8 +240,10 @@ open_file(krb5_context context, krb5_log_facility *fac, int min, int max,
char *filename, char *mode, FILE *f, int keep_open)
{
struct file_data *fd = malloc(sizeof(*fd));
- if(fd == NULL)
+ if(fd == NULL) {
+ krb5_set_error_string (context, "malloc: out of memory");
return ENOMEM;
+ }
fd->filename = filename;
fd->mode = mode;
fd->fd = f;
@@ -245,11 +255,13 @@ open_file(krb5_context context, krb5_log_facility *fac, int min, int max,
krb5_error_code
-krb5_addlog_dest(krb5_context context, krb5_log_facility *f, const char *p)
+krb5_addlog_dest(krb5_context context, krb5_log_facility *f, const char *orig)
{
krb5_error_code ret = 0;
int min = 0, max = -1, n;
char c;
+ const char *p = orig;
+
n = sscanf(p, "%d%c%d/", &min, &c, &max);
if(n == 2){
if(c == '/') {
@@ -263,7 +275,10 @@ krb5_addlog_dest(krb5_context context, krb5_log_facility *f, const char *p)
}
if(n){
p = strchr(p, '/');
- if(p == NULL) return HEIM_ERR_LOG_PARSE;
+ if(p == NULL) {
+ krb5_set_error_string (context, "failed to parse \"%s\"", orig);
+ return HEIM_ERR_LOG_PARSE;
+ }
p++;
}
if(strcmp(p, "STDERR") == 0){
@@ -275,17 +290,26 @@ krb5_addlog_dest(krb5_context context, krb5_log_facility *f, const char *p)
FILE *file = NULL;
int keep_open = 0;
fn = strdup(p + 5);
- if(fn == NULL)
+ if(fn == NULL) {
+ krb5_set_error_string (context, "malloc: out of memory");
return ENOMEM;
+ }
if(p[4] == '='){
int i = open(fn, O_WRONLY | O_CREAT |
O_TRUNC | O_APPEND, 0666);
- if(i < 0)
- return errno;
+ if(i < 0) {
+ ret = errno;
+ krb5_set_error_string (context, "open(%s): %s", fn,
+ strerror(ret));
+ return ret;
+ }
file = fdopen(i, "a");
if(file == NULL){
+ ret = errno;
close(i);
- return errno;
+ krb5_set_error_string (context, "fdopen(%s): %s", fn,
+ strerror(ret));
+ return ret;
}
keep_open = 1;
}
@@ -303,6 +327,7 @@ krb5_addlog_dest(krb5_context context, krb5_log_facility *f, const char *p)
facility = "AUTH";
ret = open_syslog(context, f, min, max, severity, facility);
}else{
+ krb5_set_error_string (context, "unknown log type: %s", p);
ret = HEIM_ERR_LOG_PARSE; /* XXX */
}
return ret;
diff --git a/lib/libc/gen/syslog.3 b/lib/libc/gen/syslog.3
index 36f998b8ee2..3f09655a030 100644
--- a/lib/libc/gen/syslog.3
+++ b/lib/libc/gen/syslog.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: syslog.3,v 1.12 2001/07/27 16:41:20 marc Exp $
+.\" $OpenBSD: syslog.3,v 1.13 2001/10/24 08:16:42 jjbg Exp $
.\"
.\" Copyright (c) 1985, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -36,10 +36,15 @@
.Os
.Sh NAME
.Nm syslog ,
+.Nm syslog_r,
.Nm vsyslog ,
+.Nm vsyslog_r,
.Nm openlog ,
+.Nm openlog_r,
.Nm closelog ,
-.Nm setlogmask
+.Nm closelog_r,
+.Nm setlogmask,
+.Nm setlogmask_r
.Nd control system log
.Sh SYNOPSIS
.Fd #include <syslog.h>
@@ -47,13 +52,36 @@
.Ft void
.Fn syslog "int priority" "const char *message" "..."
.Ft void
+.Fn syslog_r "int priority" "struct syslog_data *data" "const char *message" "..."
+.Ft void
.Fn vsyslog "int priority" "const char *message" "va_list args"
.Ft void
+.Fn vsyslog_r "int priority" "struct syslog_data *data" "const char *message" "va_list args"
+.Ft void
.Fn openlog "const char *ident" "int logopt" "int facility"
.Ft void
+.Fn openlog_r "const char *ident" "int logopt" "int facility" "struct syslog_data *data"
+.Ft void
.Fn closelog void
+.Ft void
+.Fn closelog_r "struct syslog_data *data"
.Ft int
.Fn setlogmask "int maskpri"
+.Ft int
+.Fn setlogmask_r "int maskpri" "struct syslog_data *data"
+.Bd -literal
+
+struct syslog_data {
+ int log_file;
+ int connected;
+ int opened;
+ int log_stat;
+ const char *log_tag;
+ int log_fac;
+ int log_mask;
+};
+
+#define SYSLOG_DATA_INIT {-1, 0, 0, 0, NULL, LOG_USER, 0xff}
.Sh DESCRIPTION
The
.Fn syslog
@@ -76,6 +104,39 @@ see
A trailing newline is added if none is present.
.Pp
The
+.Fn syslog_r
+function is a reentrant version of the
+.Xr syslog 3
+function. It takes a pointer to a
+.Fa syslog_data
+structure which is used to store
+information. This parameter must be initialized before
+.Fn syslog_r
+is called. The SYSLOG_DATA_INIT constant is used for this purpose.
+The
+.Fa syslog_data
+structure is composed of the following elements:
+.Bl -tag -width connected
+.It Dv log_file
+contains the file descriptor of the file where the message is logged.
+.It Dv connected
+indicates if connect has been done
+.It Dv opened
+indicates if
+.Xr openlog_r 3
+has been called.
+.It Dv log_stat
+status bits, set by
+.Xr openlog_r 3
+.It Dv log_tag
+string to tag the entry with
+.It Dv log_fac
+facility code
+.It Dv log_mask
+mask of priorities to be logged
+.El
+.Pp
+The
.Fn vsyslog
function is an alternate form in which the arguments have already been captured
using the variable-length argument facilities of
@@ -116,6 +177,16 @@ normally of use only when debugging a program.
.El
.Pp
The
+.Fn vsyslog_r
+is used the same way than
+.Fn vsyslog
+except than it takes an additional pointer on a
+.Fa syslog_data
+structure. It is a reentrant version of the
+.Fn vsyslog
+function described above.
+.Pp
+The
.Fn openlog
function provides for more specialized processing of the messages sent by
.Fn syslog
@@ -210,8 +281,22 @@ through
.El
.Pp
The
+.Fn openlog_r
+function is the reentrant version of the
+.Fn openlog
+function. It takes an additional pointer on a
+.Fa syslog_data
+structure. This function must be used in conjunction with the other
+reentrant functions.
+.Pp
+The
.Fn closelog
-function can be used to close the log file.
+function can be used to close the log file.
+.Fn closelog_r
+do the same thing but in a reentrant way and takes an additional
+pointer on a
+.Fa syslog_data
+structure.
.Pp
The
.Fn setlogmask
@@ -232,18 +317,32 @@ the mask for all priorities up to and including
is given by the macro
.Fn LOG_UPTO toppri ; .
The default allows all priorities to be logged.
+.Pp
+The
+.Fn setlogmask_r
+function is the reentrant version of
+.Fn setlogmask .
+It takes an additional pointer on a
+.Fa syslog_data
+structure.
.Sh RETURN VALUES
The
.Fn closelog ,
+.Fn closelog_r ,
.Fn openlog ,
+.Fn openlog_r ,
.Fn syslog ,
-and
+.Fn syslog_r ,
.Fn vsyslog
+and
+.Fn vsyslog_r
functions return no value.
.Pp
-The routine
+The routines
.Fn setlogmask
-always returns the previous log mask level.
+and
+.Fn setlogmask_r
+always return the previous log mask level.
.Sh EXAMPLES
.Bd -literal -offset indent -compact
syslog(LOG_ALERT, "who: internal error 23");
@@ -263,6 +362,8 @@ syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m");
These
functions appeared in
.Bx 4.2 .
+The reentrant functions appeared in
+.Ox 3.1 .
.Sh CAVEATS
It is important never to pass a string with user-supplied data as a
format without using
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index fa6b9511921..beabbcce9ba 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: syslog.c,v 1.11 2001/08/18 22:56:22 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: syslog.c,v 1.12 2001/10/24 08:16:42 jjbg Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -56,17 +56,15 @@ static char rcsid[] = "$OpenBSD: syslog.c,v 1.11 2001/08/18 22:56:22 deraadt Exp
#include <varargs.h>
#endif
-static int LogFile = -1; /* fd for log */
-static int connected; /* have done connect */
-static int opened; /* have done openlog() */
-static int LogStat = 0; /* status bits, set by openlog() */
-static const char *LogTag = NULL; /* string to tag the entry with */
-static int LogFacility = LOG_USER; /* default facility code */
-static int LogMask = 0xff; /* mask of priorities to be logged */
+static struct syslog_data sdata = SYSLOG_DATA_INIT;
+
extern char *__progname; /* Program name, from crt0. */
static void disconnectlog __P((void)); /* disconnect from syslogd */
static void connectlog __P((void)); /* (re)connect to syslogd */
+static void disconnectlog_r __P((struct syslog_data *));
+static void connectlog_r __P((struct syslog_data *));
+
/*
* syslog, vsyslog --
* print message on log file; output is intended for syslogd(8).
@@ -98,8 +96,76 @@ vsyslog(pri, fmt, ap)
register const char *fmt;
va_list ap;
{
- register int cnt;
- register char ch, *p, *t;
+ vsyslog_r(pri, &sdata, fmt, ap);
+}
+
+static void
+disconnectlog()
+{
+ disconnectlog_r(&sdata);
+}
+
+static void
+connectlog()
+{
+ connectlog_r(&sdata);
+}
+
+void
+openlog(ident, logstat, logfac)
+ const char *ident;
+ int logstat, logfac;
+{
+ openlog_r(ident, logstat, logfac, &sdata);
+}
+
+void
+closelog()
+{
+ closelog_r(&sdata);
+}
+
+/* setlogmask -- set the log mask level */
+int
+setlogmask(pmask)
+ int pmask;
+{
+ return setlogmask_r(pmask, &sdata);
+}
+
+/* Reentrant version of syslog, i.e. syslog_r() */
+
+void
+#ifdef __STDC__
+syslog_r(int pri, struct syslog_data *data, const char *fmt, ...)
+#else
+syslog_r(pri, data, fmt, va_alist)
+ int pri;
+ struct syslog_data *data;
+ char *fmt;
+ va_dcl
+#endif
+{
+ va_list ap;
+
+#ifdef __STDC__
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
+ vsyslog_r(pri, data, fmt, ap);
+ va_end(ap);
+}
+
+void
+vsyslog_r(pri, data, fmt, ap)
+ int pri;
+ struct syslog_data *data;
+ const char *fmt;
+ va_list ap;
+{
+ int cnt;
+ char ch, *p, *t;
time_t now;
int fd, saved_errno;
#define TBUF_LEN 2048
@@ -110,65 +176,64 @@ vsyslog(pri, fmt, ap)
#define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
/* Check for invalid bits. */
if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
- syslog(INTERNALLOG,
- "syslog: unknown facility/priority: %x", pri);
+ if (data == &sdata) {
+ syslog(INTERNALLOG,
+ "syslog: unknown facility/priority: %x", pri);
+ } else {
+ syslog_r(INTERNALLOG, data,
+ "syslog_r: unknown facility/priority: %x", pri);
+ }
pri &= LOG_PRIMASK|LOG_FACMASK;
}
/* Check priority against setlogmask values. */
- if (!(LOG_MASK(LOG_PRI(pri)) & LogMask))
+ if (!(LOG_MASK(LOG_PRI(pri)) & data->log_mask))
return;
saved_errno = errno;
- /* Set default facility if none specified. */
- if ((pri & LOG_FACMASK) == 0)
- pri |= LogFacility;
+ /* If we have been called through syslog(), no need for reentrancy. */
+ if (data == &sdata)
+ (void)time(&now);
+
+ p = tbuf;
+ tbuf_left = TBUF_LEN;
+
+#define DEC() \
+ do { \
+ if (prlen < 0) \
+ prlen = 0; \
+ if (prlen >= tbuf_left) \
+ prlen = tbuf_left - 1; \
+ p += prlen; \
+ tbuf_left -= prlen; \
+ } while (0)
+
+ prlen = snprintf(p, tbuf_left, "<%d>", pri);
+ DEC();
- /* Build the message. */
-
- /*
- * Although it's tempting, we can't ignore the possibility of
- * overflowing the buffer when assembling the "fixed" portion
- * of the message. Strftime's "%h" directive expands to the
- * locale's abbreviated month name, but if the user has the
- * ability to construct to his own locale files, it may be
- * arbitrarily long.
+ /*
+ * syslogd will expand time automagically for reentrant case, and
+ * for normal case, just do like before
*/
- (void)time(&now);
-
- p = tbuf;
- tbuf_left = TBUF_LEN;
-
-#define DEC() \
- do { \
- if (prlen < 0) \
- prlen = 0; \
- else if (prlen >= tbuf_left) \
- prlen = tbuf_left - 1; \
- p += prlen; \
- tbuf_left -= prlen; \
- } while (0)
-
- prlen = snprintf(p, tbuf_left, "<%d>", pri);
- DEC();
-
- prlen = strftime(p, tbuf_left, "%h %e %T ", localtime(&now));
- DEC();
+ if (data == &sdata) {
+ prlen = strftime(p, tbuf_left, "%h %e %T ", localtime(&now));
+ DEC();
+ }
- if (LogStat & LOG_PERROR)
+ if (data->log_stat & LOG_PERROR)
stdp = p;
- if (LogTag == NULL)
- LogTag = __progname;
- if (LogTag != NULL) {
- prlen = snprintf(p, tbuf_left, "%s", LogTag);
+ if (data->log_tag == NULL)
+ data->log_tag = __progname;
+ if (data->log_tag != NULL) {
+ prlen = snprintf(p, tbuf_left, "%s", data->log_tag);
DEC();
}
- if (LogStat & LOG_PID) {
+ if (data->log_stat & LOG_PID) {
prlen = snprintf(p, tbuf_left, "[%d]", getpid());
DEC();
}
- if (LogTag != NULL) {
+ if (data->log_tag != NULL) {
if (tbuf_left > 1) {
*p++ = ':';
tbuf_left--;
@@ -179,15 +244,18 @@ vsyslog(pri, fmt, ap)
}
}
- /*
- * We wouldn't need this mess if printf handled %m, or if
- * strerror() had been invented before syslog().
- */
+ /* strerror() is not reentrant */
+
for (t = fmt_cpy, fmt_left = FMT_LEN; (ch = *fmt); ++fmt) {
if (ch == '%' && fmt[1] == 'm') {
++fmt;
- prlen = snprintf(t, fmt_left, "%s",
- strerror(saved_errno));
+ if (data == &sdata) {
+ prlen = snprintf(t, fmt_left, "%s",
+ strerror(saved_errno));
+ } else {
+ prlen = snprintf(t, fmt_left, "Error %d",
+ saved_errno);
+ }
if (prlen >= fmt_left)
prlen = fmt_left - 1;
t += prlen;
@@ -206,7 +274,7 @@ vsyslog(pri, fmt, ap)
cnt = p - tbuf;
/* Output to stderr if requested. */
- if (LogStat & LOG_PERROR) {
+ if (data->log_stat & LOG_PERROR) {
struct iovec iov[2];
iov[0].iov_base = stdp;
@@ -217,19 +285,19 @@ vsyslog(pri, fmt, ap)
}
/* Get connected, output the message to the local logger. */
- if (!opened)
- openlog(LogTag, LogStat, 0);
- connectlog();
- if (send(LogFile, tbuf, cnt, 0) >= 0)
+ if (!data->opened)
+ openlog_r(data->log_tag, data->log_stat, 0, data);
+ connectlog_r(data);
+ if (send(data->log_file, tbuf, cnt, 0) >= 0)
return;
/*
* If the send() failed, the odds are syslogd was restarted.
* Make one (only) attempt to reconnect to /dev/log.
*/
- disconnectlog();
- connectlog();
- if (send(LogFile, tbuf, cnt, 0) >= 0)
+ disconnectlog_r(data);
+ connectlog_r(data);
+ if (send(data->log_file, tbuf, cnt, 0) >= 0)
return;
/*
@@ -237,7 +305,7 @@ vsyslog(pri, fmt, ap)
* if console blocks everything will. Make sure the error reported
* is the one from the syslogd failure.
*/
- if (LogStat & LOG_CONS &&
+ if (data->log_stat & LOG_CONS &&
(fd = open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) {
struct iovec iov[2];
@@ -252,79 +320,84 @@ vsyslog(pri, fmt, ap)
}
static void
-disconnectlog()
+disconnectlog_r(data)
+ struct syslog_data *data;
{
/*
* If the user closed the FD and opened another in the same slot,
* that's their problem. They should close it before calling on
* system services.
*/
- if (LogFile != -1) {
- close(LogFile);
- LogFile = -1;
+ if (data->log_file != -1) {
+ close(data->log_file);
+ data->log_file = -1;
}
- connected = 0; /* retry connect */
+ data->connected = 0; /* retry connect */
}
static void
-connectlog()
+connectlog_r(data)
+ struct syslog_data *data;
{
struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */
- if (LogFile == -1) {
- if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1)
+ if (data->log_file == -1) {
+ if ((data->log_file = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1)
return;
- (void)fcntl(LogFile, F_SETFD, 1);
+ (void)fcntl(data->log_file, F_SETFD, 1);
}
- if (LogFile != -1 && !connected) {
+ if (data->log_file != -1 && !data->connected) {
memset(&SyslogAddr, '\0', sizeof(SyslogAddr));
SyslogAddr.sun_len = sizeof(SyslogAddr);
SyslogAddr.sun_family = AF_UNIX;
strlcpy(SyslogAddr.sun_path, _PATH_LOG,
sizeof(SyslogAddr.sun_path));
- if (connect(LogFile, (struct sockaddr *)&SyslogAddr,
+ if (connect(data->log_file, (struct sockaddr *)&SyslogAddr,
sizeof(SyslogAddr)) == -1) {
- (void)close(LogFile);
- LogFile = -1;
+ (void)close(data->log_file);
+ data->log_file = -1;
} else
- connected = 1;
+ data->connected = 1;
}
}
void
-openlog(ident, logstat, logfac)
+openlog_r(ident, logstat, logfac, data)
const char *ident;
int logstat, logfac;
+ struct syslog_data *data;
{
if (ident != NULL)
- LogTag = ident;
- LogStat = logstat;
+ data->log_tag = ident;
+ data->log_stat = logstat;
if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
- LogFacility = logfac;
+ data->log_fac = logfac;
- if (LogStat & LOG_NDELAY) /* open immediately */
- connectlog();
+ if (data->log_stat & LOG_NDELAY) /* open immediately */
+ connectlog_r(data);
- opened = 1; /* ident and facility has been set */
+ data->opened = 1; /* ident and facility has been set */
}
void
-closelog()
+closelog_r(data)
+ struct syslog_data *data;
{
- (void)close(LogFile);
- LogFile = -1;
- connected = 0;
+ (void)close(data->log_file);
+ data->log_file = -1;
+ data->connected = 0;
}
/* setlogmask -- set the log mask level */
int
-setlogmask(pmask)
+setlogmask_r(pmask, data)
int pmask;
+ struct syslog_data *data;
{
int omask;
- omask = LogMask;
+ omask = data->log_mask;
if (pmask != 0)
- LogMask = pmask;
+ data->log_mask = pmask;
return (omask);
}
diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version
index d72ba6e418c..e10615e1a3b 100644
--- a/lib/libc/shlib_version
+++ b/lib/libc/shlib_version
@@ -1,2 +1,2 @@
major=28
-minor=0 # note: remember to update minor in ../libc_r/shlib_version
+minor=1 # note: remember to update minor in ../libc_r/shlib_version
diff --git a/lib/libc_r/shlib_version b/lib/libc_r/shlib_version
index 9c1551636c5..1394f4e4035 100644
--- a/lib/libc_r/shlib_version
+++ b/lib/libc_r/shlib_version
@@ -1,2 +1,2 @@
major=6
-minor=0
+minor=1
diff --git a/sys/sys/syslog.h b/sys/sys/syslog.h
index cc967f33c6c..3f642d79b87 100644
--- a/sys/sys/syslog.h
+++ b/sys/sys/syslog.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslog.h,v 1.5 1998/02/10 18:41:57 deraadt Exp $ */
+/* $OpenBSD: syslog.h,v 1.6 2001/10/24 08:16:42 jjbg Exp $ */
/* $NetBSD: syslog.h,v 1.14 1996/04/03 20:46:44 christos Exp $ */
/*
@@ -36,6 +36,9 @@
* @(#)syslog.h 8.1 (Berkeley) 6/2/93
*/
+#ifndef _SYS_SYSLOG_H_
+#define _SYS_SYSLOG_H_
+
#define _PATH_LOG "/dev/log"
/*
@@ -144,6 +147,20 @@ CODE facilitynames[] = {
};
#endif
+/* Used by reentrant functions */
+
+struct syslog_data {
+ int log_file;
+ int connected;
+ int opened;
+ int log_stat;
+ const char *log_tag;
+ int log_fac;
+ int log_mask;
+};
+
+#define SYSLOG_DATA_INIT {-1, 0, 0, 0, NULL, LOG_USER, 0xff}
+
#ifdef _KERNEL
#define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */
#endif
@@ -186,6 +203,13 @@ int setlogmask __P((int));
void syslog __P((int, const char *, ...))
__attribute__((__format__(__printf__,2,3)));
void vsyslog __P((int, const char *, _BSD_VA_LIST_));
+void closelog_r __P((struct syslog_data *));
+void openlog_r __P((const char *, int, int, struct syslog_data *));
+int setlogmask_r __P((int, struct syslog_data *));
+void syslog_r __P((int, struct syslog_data *, const char *, ...))
+ __attribute__((__format__(__printf__,3,4)));
+void vsyslog_r __P((int, struct syslog_data *, const char *,
+ _BSD_VA_LIST_));
__END_DECLS
#else /* !_KERNEL */
@@ -198,3 +222,5 @@ int addlog __P((const char *, ...))
void logwakeup __P((void));
#endif /* !_KERNEL */
+#endif /* !_SYS_SYSLOG_H_ */
+