MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kassert_panic

Function kassert_panic

freebsd/kern/kern_shutdown.c:768–828  ·  view source on GitHub ↗

* Called by KASSERT, this decides if we will panic * or if we will log via printf and/or ktr. */

Source from the content-addressed store, hash-verified

766 * or if we will log via printf and/or ktr.
767 */
768void
769kassert_panic(const char *fmt, ...)
770{
771 static char buf[256];
772 va_list ap;
773
774 va_start(ap, fmt);
775 (void)vsnprintf(buf, sizeof(buf), fmt, ap);
776 va_end(ap);
777
778 /*
779 * If we are suppressing secondary panics, log the warning but do not
780 * re-enter panic/kdb.
781 */
782 if (panicstr != NULL && kassert_suppress_in_panic) {
783 if (kassert_do_log) {
784 printf("KASSERT failed: %s\n", buf);
785#ifdef KDB
786 if (trace_all_panics && trace_on_panic)
787 kdb_backtrace();
788#endif
789 }
790 return;
791 }
792
793 /*
794 * panic if we're not just warning, or if we've exceeded
795 * kassert_log_panic_at warnings.
796 */
797 if (!kassert_warn_only ||
798 (kassert_log_panic_at > 0 &&
799 kassert_warnings >= kassert_log_panic_at)) {
800 va_start(ap, fmt);
801 vpanic(fmt, ap);
802 /* NORETURN */
803 }
804#ifdef KTR
805 if (kassert_do_ktr)
806 CTR0(ktr_mask, buf);
807#endif /* KTR */
808 /*
809 * log if we've not yet met the mute limit.
810 */
811 if (kassert_do_log &&
812 (kassert_log_mute_at == 0 ||
813 kassert_warnings < kassert_log_mute_at)) {
814 static struct timeval lasterr;
815 static int curerr;
816
817 if (ppsratecheck(&lasterr, &curerr, kassert_log_pps_limit)) {
818 printf("KASSERT failed: %s\n", buf);
819 kdb_backtrace();
820 }
821 }
822#ifdef KDB
823 if (kassert_do_kdb) {
824 kdb_enter(KDB_WHY_KASSERT, buf);
825 }

Callers 15

tcp_log_remove_bucketFunction · 0.85
witness_initFunction · 0.85
witness_checkorderFunction · 0.85
witness_upgradeFunction · 0.85
witness_downgradeFunction · 0.85
witness_unlockFunction · 0.85
witness_thread_exitFunction · 0.85
witness_warnFunction · 0.85
enrollFunction · 0.85
itismychildFunction · 0.85
witness_saveFunction · 0.85

Calls 6

vsnprintfFunction · 0.85
kdb_backtraceFunction · 0.85
kdb_enterFunction · 0.85
printfFunction · 0.70
vpanicFunction · 0.70
ppsratecheckFunction · 0.70

Tested by

no test coverage detected