FreeBSD/sys/kern/kern_shutdown.c
/*
 * Called by KASSERT, this decides if we will panic
 * or if we will log via printf and/or ktr.
 */
Called by KASSERT, this decides if we will panic
or if we will log via printf and/or ktr.
Called by KASSERT this decides if we will panic or if we will log via printf and / or ktr .
void
kassert_panic(const char *fmt, ...)
{
	static char buf[256];
	va_list ap;
	va_start(ap, fmt);
	(void)vsnprintf(buf, sizeof(buf), fmt, ap);
	va_end(ap);
	if (!kassert_warn_only ||
	    (kassert_log_panic_at > 0 &&
	     kassert_warnings >= kassert_log_panic_at)) {
		va_start(ap, fmt);
		vpanic(fmt, ap);
	}
#ifdef KTR
	if (kassert_do_ktr)
		CTR0(ktr_mask, buf);
#endif 
	if (kassert_do_log &&
	    (kassert_log_mute_at == 0 ||
	     kassert_warnings < kassert_log_mute_at)) {
		static  struct timeval lasterr;
		static  int curerr;
		if (ppsratecheck(&lasterr, &curerr, kassert_log_pps_limit)) {
			printf("KASSERT failed: %s\n", buf);
			kdb_backtrace();
		}
	}
#ifdef KDB
	if (kassert_do_kdb) {
		kdb_enter(KDB_WHY_KASSERT, buf);
	}
#endif
	atomic_add_int(&kassert_warnings, 1);
}
void kassert_panic ( const char * fmt , ... ) { static char buf [ 256 ] ; va_list ap ; va_start ( ap , fmt ) ; ( void ) vsnprintf ( buf , sizeof ( buf ) , fmt , ap ) ; va_end ( ap ) ; if ( ! kassert_warn_only || ( kassert_log_panic_at > 0 && kassert_warnings >= kassert_log_panic_at ) ) { va_start ( ap , fmt ) ; vpanic ( fmt , ap ) ; } #ifdef KTR if ( kassert_do_ktr ) CTR0 ( ktr_mask , buf ) ; #endif if ( kassert_do_log && ( kassert_log_mute_at == 0 || kassert_warnings < kassert_log_mute_at ) ) { static struct timeval lasterr ; static int curerr ; if ( ppsratecheck ( & lasterr , & curerr , kassert_log_pps_limit ) ) { printf ( " \n " , buf ) ; kdb_backtrace ( ) ; } } #ifdef KDB if ( kassert_do_kdb ) { kdb_enter ( KDB_WHY_KASSERT , buf ) ; } #endif atomic_add_int ( & kassert_warnings , 1 ) ; }
Called by KASSERT, this decides if we will panic
 or if we will log via printf and/or ktr.
Called by KASSERT this decides if we will panic or if we will log via printf and / or ktr .
/*
	 * panic if we're not just warning, or if we've exceeded
	 * kassert_log_panic_at warnings.
	 */ /* NORETURN */ /* KTR */ /*
	 * log if we've not yet met the mute limit.
	 */