Module Name:    src
Committed By:   reinoud
Date:           Thu Sep 15 12:23:51 UTC 2011

Modified Files:
        src/sys/arch/usermode/include: thunk.h
        src/sys/arch/usermode/usermode: thunk.c

Log Message:
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!


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/usermode/usermode/thunk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.33 src/sys/arch/usermode/include/thunk.h:1.34
--- src/sys/arch/usermode/include/thunk.h:1.33	Wed Sep 14 18:26:24 2011
+++ src/sys/arch/usermode/include/thunk.h	Thu Sep 15 12:23:51 2011
@@ -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 <jmcne...@invisible.ca>
@@ -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);

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.37 src/sys/arch/usermode/usermode/thunk.c:1.38
--- src/sys/arch/usermode/usermode/thunk.c:1.37	Wed Sep 14 18:26:24 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Thu Sep 15 12:23:51 2011
@@ -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 <jmcne...@invisible.ca>
@@ -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)
 {

Reply via email to