Index: kern/subr_prf.c =================================================================== RCS file: /cvsroot/src/sys/kern/subr_prf.c,v retrieving revision 1.142 diff -u -u -r1.142 subr_prf.c --- kern/subr_prf.c 8 Sep 2011 18:15:56 -0000 1.142 +++ kern/subr_prf.c 29 Sep 2011 20:10:19 -0000 @@ -199,10 +199,19 @@ void panic(const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + vpanic(fmt, ap); + va_end(ap); +} + +void +vpanic(const char *fmt, va_list ap) +{ CPU_INFO_ITERATOR cii; struct cpu_info *ci, *oci; int bootopt; - va_list ap; static char scratchstr[256]; /* stores panic message */ spldebug_stop(); @@ -253,15 +262,12 @@ /* first time in panic - store fmt first for precaution */ panicstr = fmt; - va_start(ap, fmt); vsnprintf(scratchstr, sizeof(scratchstr), fmt, ap); printf("%s", scratchstr); panicstr = scratchstr; } else { - va_start(ap, fmt); vprintf(fmt, ap); } - va_end(ap); printf("\n"); if (msgbufenabled && msgbufp->msg_magic == MSG_MAGIC) Index: kern/vfs_vnode.c =================================================================== RCS file: /cvsroot/src/sys/kern/vfs_vnode.c,v retrieving revision 1.10 diff -u -u -r1.10 vfs_vnode.c --- kern/vfs_vnode.c 1 Sep 2011 09:04:08 -0000 1.10 +++ kern/vfs_vnode.c 29 Sep 2011 20:10:20 -0000 @@ -162,7 +162,7 @@ static vnode_t * getcleanvnode(void); static void vrele_thread(void *); -static void vpanic(vnode_t *, const char *); +static void vnpanic(vnode_t *, const char *); /* Routines having to do with the management of the vnode table. */ extern int (**dead_vnodeop_p)(void *); @@ -657,7 +657,7 @@ if (__predict_false(vp->v_op == dead_vnodeop_p && (vp->v_iflag & (VI_CLEAN|VI_XLOCK)) == 0)) { - vpanic(vp, "dead but not clean"); + vnpanic(vp, "dead but not clean"); } /* @@ -670,7 +670,7 @@ return; } if (vp->v_usecount <= 0 || vp->v_writecount != 0) { - vpanic(vp, "vrelel: bad ref count"); + vnpanic(vp, "vrelel: bad ref count"); } KASSERT((vp->v_iflag & VI_XLOCK) == 0); @@ -702,7 +702,7 @@ error = vn_lock(vp, LK_EXCLUSIVE); if (error != 0) { /* XXX */ - vpanic(vp, "vrele: unable to lock %p"); + vnpanic(vp, "vrele: unable to lock %p"); } defer = false; } else if ((vp->v_iflag & VI_LAYER) != 0) { @@ -953,7 +953,7 @@ KASSERT((vp->v_iflag & VI_MARKER) == 0); if (vp->v_holdcnt <= 0) { - vpanic(vp, "holdrelel: holdcnt vp %p"); + vnpanic(vp, "holdrelel: holdcnt vp %p"); } vp->v_holdcnt--; @@ -1043,7 +1043,7 @@ /* Disassociate the underlying file system from the vnode. */ if (VOP_RECLAIM(vp)) { - vpanic(vp, "vclean: cannot reclaim"); + vnpanic(vp, "vclean: cannot reclaim"); } KASSERT(vp->v_data == NULL); @@ -1217,7 +1217,7 @@ } void -vpanic(vnode_t *vp, const char *msg) +vnpanic(vnode_t *vp, const char *msg) { #ifdef DIAGNOSTIC Index: lib/libkern/kern_assert.c =================================================================== RCS file: /cvsroot/src/sys/lib/libkern/kern_assert.c,v retrieving revision 1.1 diff -u -u -r1.1 kern_assert.c --- lib/libkern/kern_assert.c 19 Jan 2010 22:28:30 -0000 1.1 +++ lib/libkern/kern_assert.c 29 Sep 2011 20:10:20 -0000 @@ -39,14 +39,14 @@ #endif void -kern_assert(const char *t, const char *f, int l, const char *e) +kern_assert(const char *fmt, ...) { - + va_list ap; #ifdef _KERNEL if (panicstr != NULL) return; #endif - - panic("kernel %sassertion \"%s\" failed: file \"%s\", line %d", - t, e, f, l); + va_start(ap, fmt); + vpanic(fmt, ap); + va_end(ap); } Index: lib/libkern/libkern.h =================================================================== RCS file: /cvsroot/src/sys/lib/libkern/libkern.h,v retrieving revision 1.101 diff -u -u -r1.101 libkern.h --- lib/libkern/libkern.h 27 Sep 2011 01:02:39 -0000 1.101 +++ lib/libkern/libkern.h 29 Sep 2011 20:10:20 -0000 @@ -37,7 +37,6 @@ #include <sys/types.h> #include <sys/inttypes.h> #include <sys/null.h> -#include <sys/systm.h> #ifndef LIBKERN_INLINE #define LIBKERN_INLINE static __inline @@ -181,7 +180,7 @@ #define assert(e) ((void)0) #else #define assert(e) (__predict_true((e)) ? (void)0 : \ - panic(__KASSERTSTR, "", #e, __FILE__, __LINE__)) + kern_assert(__KASSERTSTR, "", #e, __FILE__, __LINE__)) #endif #ifdef __COVERITY__ @@ -205,11 +204,11 @@ #define _DIAGASSERT(a) assert(a) #define KASSERTMSG(e, msg, ...) \ (__predict_true((e)) ? (void)0 : \ - panic(__KASSERTSTR msg, "diagnostic ", #e, \ + kern_assert(__KASSERTSTR msg, "diagnostic ", #e, \ __FILE__, __LINE__, ## __VA_ARGS__)) #define KASSERT(e) (__predict_true((e)) ? (void)0 : \ - panic(__KASSERTSTR, "diagnostic ", #e, \ + kern_assert(__KASSERTSTR, "diagnostic ", #e, \ __FILE__, __LINE__)) #endif @@ -224,11 +223,11 @@ #else #define KDASSERTMSG(e, msg, ...) \ (__predict_true((e)) ? (void)0 : \ - panic(__KASSERTSTR msg, "debugging ", #e, \ + kern_assert(__KASSERTSTR msg, "debugging ", #e, \ __FILE__, __LINE__, ## __VA_ARGS__)) #define KDASSERT(e) (__predict_true((e)) ? (void)0 : \ - panic(__KASSERTSTR, "debugging ", #e, \ + kern_assert(__KASSERTSTR, "debugging ", #e, \ __FILE__, __LINE__)) #endif @@ -300,7 +299,7 @@ #define ffs(x) __builtin_ffs(x) #endif -void kern_assert(const char *, const char *, int, const char *); +void kern_assert(const char *, ...); unsigned int bcdtobin(unsigned int); unsigned int Index: sys/systm.h =================================================================== RCS file: /cvsroot/src/sys/sys/systm.h,v retrieving revision 1.248 diff -u -u -r1.248 systm.h --- sys/systm.h 17 Jul 2011 20:54:54 -0000 1.248 +++ sys/systm.h 29 Sep 2011 20:10:32 -0000 @@ -226,13 +226,22 @@ void printf(const char *, ...) __attribute__((__format__(__printf__,1,2))); + int sprintf(char *, const char *, ...) __attribute__((__format__(__printf__,2,3))); + int snprintf(char *, size_t, const char *, ...) __attribute__((__format__(__printf__,3,4))); -void vprintf(const char *, va_list); -int vsprintf(char *, const char *, va_list); -int vsnprintf(char *, size_t, const char *, va_list); + +void vprintf(const char *, va_list) + __attribute__((__format__(__printf__,1,0))); + +int vsprintf(char *, const char *, va_list) + __attribute__((__format__(__printf__,2,0))); + +int vsnprintf(char *, size_t, const char *, va_list) + __attribute__((__format__(__printf__,3,0))); + int humanize_number(char *, size_t, uint64_t, const char *, int); void twiddle(void); @@ -241,6 +250,8 @@ void panic(const char *, ...) __dead __attribute__((__format__(__printf__,1,2))); +void vpanic(const char *, va_list) + __dead __attribute__((__format__(__printf__,1,0))); void uprintf(const char *, ...) __attribute__((__format__(__printf__,1,2))); void uprintf_locked(const char *, ...)