diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-06-28 01:52:19 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-06-28 01:52:19 +0000 |
commit | 38cdac612c0241b967df8ff77bf066a2717d99a3 (patch) | |
tree | 9b6901c69b1c4247969a514dcb8fd4784418d7d3 | |
parent | 4aff5be8e4554e74cd1b6bfa32f08f16b3964250 (diff) |
option to log ddb output to kernel message buffer, via sysctl ddb.log
ok deraadt@ henric@ djm@
-rw-r--r-- | sys/ddb/db_output.h | 4 | ||||
-rw-r--r-- | sys/ddb/db_usrreq.c | 6 | ||||
-rw-r--r-- | sys/ddb/db_var.h | 6 | ||||
-rw-r--r-- | sys/kern/subr_prf.c | 9 |
4 files changed, 18 insertions, 7 deletions
diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h index dc9d9ca357c..58aa5cd4447 100644 --- a/sys/ddb/db_output.h +++ b/sys/ddb/db_output.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_output.h,v 1.12 2002/05/18 18:22:46 art Exp $ */ +/* $OpenBSD: db_output.h,v 1.13 2003/06/28 01:52:18 tedu Exp $ */ /* $NetBSD: db_output.h,v 1.9 1996/04/04 05:13:50 cgd Exp $ */ /* @@ -40,6 +40,8 @@ int db_printf(const char *, ...) __kprintf_attribute__((__format__(__kprintf__,1,2))); void db_end_line(int); +extern int db_log; + /* * This is a replacement for the non-standard %z, %n and %r printf formats * in db_printf. diff --git a/sys/ddb/db_usrreq.c b/sys/ddb/db_usrreq.c index bfec3e3d606..02d8fbcb58f 100644 --- a/sys/ddb/db_usrreq.c +++ b/sys/ddb/db_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_usrreq.c,v 1.7 2003/06/02 19:27:14 mickey Exp $ */ +/* $OpenBSD: db_usrreq.c,v 1.8 2003/06/28 01:52:18 tedu Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff. All rights reserved. @@ -33,6 +33,8 @@ #include <ddb/db_var.h> +int db_log; + int ddb_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) int *name; @@ -81,6 +83,8 @@ ddb_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) return (EPERM); db_console = ctlval; return (0); + case DBCTL_LOG: + return (sysctl_int(oldp, oldlenp, newp, newlen, &db_log)); default: return (EOPNOTSUPP); } diff --git a/sys/ddb/db_var.h b/sys/ddb/db_var.h index 17ede10593a..b9a1b6bbc28 100644 --- a/sys/ddb/db_var.h +++ b/sys/ddb/db_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_var.h,v 1.7 2003/06/02 19:27:14 mickey Exp $ */ +/* $OpenBSD: db_var.h,v 1.8 2003/06/28 01:52:18 tedu Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff. All rights reserved. @@ -41,7 +41,8 @@ #define DBCTL_TABSTOP 4 #define DBCTL_PANIC 5 #define DBCTL_CONSOLE 6 -#define DBCTL_MAXID 7 +#define DBCTL_LOG 7 +#define DBCTL_MAXID 8 #define CTL_DDB_NAMES { \ { NULL, 0 }, \ @@ -51,6 +52,7 @@ { "tab_stop_width", CTLTYPE_INT },\ { "panic", CTLTYPE_INT }, \ { "console", CTLTYPE_INT }, \ + { "log", CTLTYPE_INT }, \ } #ifdef _KERNEL diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 98452c4dff0..940dd6257d6 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prf.c,v 1.55 2003/06/02 23:28:06 millert Exp $ */ +/* $OpenBSD: subr_prf.c,v 1.56 2003/06/28 01:52:17 tedu Exp $ */ /* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */ /*- @@ -480,10 +480,13 @@ int db_printf(const char *fmt, ...) { va_list ap; - int retval; + int flags, retval; + flags = TODDB; + if (db_log) + flags |= TOLOG; va_start(ap, fmt); - retval = kprintf(fmt, TODDB, NULL, NULL, ap); + retval = kprintf(fmt, flags, NULL, NULL, ap); va_end(ap); return(retval); } |