summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1998-09-06 06:25:18 +0000
committerache <ache@FreeBSD.org>1998-09-06 06:25:18 +0000
commitb9386dfd70628078e594d978a5f89ffc314add64 (patch)
tree978f2fa32090f19da6e307f2a8d3bfe8279d0f91 /sys
parentdfdc8cd38c61441f5e768b4a792d3200bf926727 (diff)
downloadFreeBSD-src-b9386dfd70628078e594d978a5f89ffc314add64.zip
FreeBSD-src-b9386dfd70628078e594d978a5f89ffc314add64.tar.gz
Store formatted panic string in static buffer to make it available later
for savecore. Previous code give only panic format to savecore
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_shutdown.c11
-rw-r--r--sys/kern/subr_prf.c15
-rw-r--r--sys/sys/systm.h3
3 files changed, 22 insertions, 7 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index eddeb34..0f8b502 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
- * $Id: kern_shutdown.c,v 1.36 1998/08/19 20:20:52 des Exp $
+ * $Id: kern_shutdown.c,v 1.37 1998/08/23 14:18:08 des Exp $
*/
#include "opt_ddb.h"
@@ -399,6 +399,7 @@ panic(const char *fmt, ...)
{
int bootopt;
va_list ap;
+ static char buf[256];
bootopt = RB_AUTOBOOT | RB_DUMP;
if (panicstr)
@@ -406,11 +407,12 @@ panic(const char *fmt, ...)
else
panicstr = fmt;
- printf("panic: ");
va_start(ap, fmt);
- vprintf(fmt, ap);
+ (void)vsprintf(buf, fmt, ap);
+ if (panicstr == fmt)
+ panicstr = buf;
va_end(ap);
- printf("\n");
+ printf("panic: %s\n", buf);
#ifdef SMP
/* three seperate prints in case of an unmapped page and trap */
printf("mp_lock = %08x; ", mp_lock);
@@ -499,4 +501,3 @@ rm_at_shutdown(bootlist_fn function, void *arg)
}
return (count);
}
-
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 0932081..f18a71a 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
- * $Id: subr_prf.c,v 1.48 1998/07/15 02:32:11 bde Exp $
+ * $Id: subr_prf.c,v 1.49 1998/08/10 14:27:34 bde Exp $
*/
#include <sys/param.h>
@@ -316,6 +316,19 @@ sprintf(char *buf, const char *cfmt, ...)
}
/*
+ * Scaled down version of vsprintf(3).
+ */
+int
+vsprintf(char *buf, const char *cfmt, va_list ap)
+{
+ int retval;
+
+ retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap);
+ buf[retval] = '\0';
+ return retval;
+}
+
+/*
* Put a number (base <= 16) in a buffer in reverse order; return an
* optional length and a pointer to the NULL terminated (preceded?)
* buffer.
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 6a1d0f2..9a93478 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)systm.h 8.7 (Berkeley) 3/29/95
- * $Id: systm.h,v 1.73 1998/07/13 06:45:17 bde Exp $
+ * $Id: systm.h,v 1.74 1998/08/05 18:18:06 bde Exp $
*/
#ifndef _SYS_SYSTM_H_
@@ -110,6 +110,7 @@ int printf __P((const char *, ...)) __printflike(1, 2);
int sprintf __P((char *buf, const char *, ...)) __printflike(2, 3);
void uprintf __P((const char *, ...)) __printflike(1, 2);
void vprintf __P((const char *, _BSD_VA_LIST_)) __printflike(1, 0);
+int vsprintf __P((char *buf, const char *, _BSD_VA_LIST_)) __printflike(2, 0);
void ttyprintf __P((struct tty *, const char *, ...)) __printflike(2, 3);
void bcopy __P((const void *from, void *to, size_t len));
OpenPOWER on IntegriCloud