Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode Implement a dprintf_debug() analog to apri...



details:   https://anonhg.NetBSD.org/src/rev/ff50f06e5c26
branches:  trunk
changeset: 769588:ff50f06e5c26
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Thu Sep 15 12:23:51 2011 +0000

description:
Implement a dprintf_debug() analog to aprint_debug() but printing it to stderr
using vdprintf() to bypass the kernel buffer. It is currently printing only on
the -x boot flag but might get a more specific one since its quite verbose!

diffstat:

 sys/arch/usermode/include/thunk.h  |   4 +++-
 sys/arch/usermode/usermode/thunk.c |  19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diffs (62 lines):

diff -r 7d90f0b9fe72 -r ff50f06e5c26 sys/arch/usermode/include/thunk.h
--- a/sys/arch/usermode/include/thunk.h Thu Sep 15 12:01:18 2011 +0000
+++ b/sys/arch/usermode/include/thunk.h Thu Sep 15 12:23:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.33 2011/09/14 18:26:24 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.34 2011/09/15 12:23:51 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -69,6 +69,8 @@
 
 struct aiocb;
 
+void   dprintf_debug(const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
+
 int    thunk_setitimer(int, const struct thunk_itimerval *, struct thunk_itimerval *);
 int    thunk_gettimeofday(struct thunk_timeval *, void *);
 unsigned int thunk_getcounter(void);
diff -r 7d90f0b9fe72 -r ff50f06e5c26 sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c        Thu Sep 15 12:01:18 2011 +0000
+++ b/sys/arch/usermode/usermode/thunk.c        Thu Sep 15 12:23:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.37 2011/09/14 18:26:24 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.38 2011/09/15 12:23:51 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -28,11 +28,12 @@
 
 #include <sys/cdefs.h>
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.37 2011/09/14 18:26:24 reinoud Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.38 2011/09/15 12:23:51 reinoud Exp $");
 #endif
 
 #include <sys/types.h>
 #include <sys/mman.h>
+#include <sys/reboot.h>
 #include <machine/vmparam.h>
 
 #include <aio.h>
@@ -59,6 +60,20 @@
 #define MAP_ANON MAP_ANONYMOUS
 #endif
 
+extern int boothowto;
+
+void
+dprintf_debug(const char *fmt, ...)
+{
+        if (boothowto & AB_DEBUG) {
+                va_list ap;
+
+                va_start(ap, fmt);
+                vdprintf(2, fmt, ap);
+                va_end(ap);
+        }
+}
+
 static void
 thunk_to_timeval(const struct thunk_timeval *ttv, struct timeval *tv)
 {



Home | Main Index | Thread Index | Old Index