Implement vlog() (varargs version of log()).

This commit is contained in:
thorpej 1999-08-27 01:14:15 +00:00
parent dcb4cadef7
commit 0038e42900
2 changed files with 27 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_prf.c,v 1.63 1999/07/27 21:50:37 thorpej Exp $ */
/* $NetBSD: subr_prf.c,v 1.64 1999/08/27 01:14:15 thorpej Exp $ */
/*-
* Copyright (c) 1986, 1988, 1991, 1993
@ -258,6 +258,30 @@ log(level, fmt, va_alist)
logwakeup(); /* wake up anyone waiting for log msgs */
}
/*
* vlog: write to the log buffer [already have va_alist]
*/
void
vlog(level, fmt, ap)
int level;
const char *fmt;
va_list ap;
{
int s;
KPRINTF_MUTEX_ENTER(s);
klogpri(level); /* log the level first */
kprintf(fmt, TOLOG, NULL, NULL, ap);
if (!log_open)
kprintf(fmt, TOCONS, NULL, NULL, ap);
KPRINTF_MUTEX_EXIT(s);
logwakeup(); /* wake up anyone waiting for log msgs */
}
/*
* logpri: log the priority level to the klog
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: syslog.h,v 1.20 1999/03/19 00:15:45 perry Exp $ */
/* $NetBSD: syslog.h,v 1.21 1999/08/27 01:14:16 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
@ -198,6 +198,7 @@ __END_DECLS
void logpri __P((int));
void log __P((int, const char *, ...))
__kprintf_attribute__((__format__(__kprintf__,2,3)));
void vlog __P((int, const char *, _BSD_VA_LIST_));
void addlog __P((const char *, ...))
__kprintf_attribute__((__format__(__kprintf__,1,2)));
void logwakeup __P((void));