diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-01-21 21:59:39 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-01-21 21:59:39 +0000 |
commit | 376a7101c9729fa84f6c788e573875f4a26bb8bf (patch) | |
tree | f9c8f81c98ef79ab5d789eeaa31b91275f9f6b17 /sys/kern/subr_prf.c | |
parent | 003e7f4bee865ebaa6180ba4f606a8ad590c75fb (diff) |
support expanded panicstr; and add vsprintf back
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r-- | sys/kern/subr_prf.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index d2dbc743e94..2b9be4e3cbc 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prf.c,v 1.19 1997/12/29 14:31:16 deraadt Exp $ */ +/* $OpenBSD: subr_prf.c,v 1.20 1998/01/21 21:59:38 deraadt Exp $ */ /* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */ /*- @@ -168,17 +168,21 @@ panic(fmt, va_alist) va_dcl #endif { + static char panicbuf[512]; int bootopt; va_list ap; bootopt = RB_AUTOBOOT | RB_DUMP; + va_start(ap, fmt); if (panicstr) bootopt |= RB_NOSYNC; - else - panicstr = fmt; + else { + vsprintf(panicbuf, fmt, ap); + panicstr = panicbuf; + } - va_start(ap, fmt); printf("panic: "); + va_start(ap, fmt); vprintf(fmt, ap); printf("\n"); va_end(ap); @@ -553,6 +557,28 @@ sprintf(buf, fmt, va_alist) } /* + * vprintf: print a message to the console and the log [already have + * va_alist] + */ + +int +vsprintf(buf, fmt, ap) + char *buf; + const char *fmt; + va_list ap; +{ + int savintr; + + savintr = consintr; /* disable interrupts */ + consintr = 0; + kprintf(fmt, TOBUFONLY, NULL, NULL, ap); + if (!panicstr) + logwakeup(); + consintr = savintr; /* reenable interrupts */ + return (0); +} + +/* * kprintf: scaled down version of printf(3). * * this version based on vfprintf() from libc which was derived from |