MCPcopy Create free account
hub / github.com/NetSys/bess / SetTrapHandler

Function SetTrapHandler

core/debug.cc:451–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449}
450
451void SetTrapHandler() {
452 const int signals[] = {
453 SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGABRT,
454 // SIGUSR1 is special in that it is triggered by user and does not abort
455 SIGUSR1,
456 };
457
458 const int ignored_signals[] = {
459 SIGPIPE,
460 };
461
462 struct sigaction sigact;
463 size_t i;
464
465 unlink(P_tmpdir "/bessd_crash.log");
466
467 sigact.sa_sigaction = TrapHandler;
468 sigact.sa_flags = SA_RESTART | SA_SIGINFO;
469
470 for (i = 0; i < sizeof(signals) / sizeof(int); i++) {
471 int ret = sigaction(signals[i], &sigact, nullptr);
472 DCHECK_NE(ret, 1);
473 }
474
475 for (i = 0; i < sizeof(ignored_signals) / sizeof(int); i++) {
476 signal(ignored_signals[i], SIG_IGN);
477 }
478}
479
480template <typename T>
481static void DumpType() {

Callers 1

mainFunction · 0.85

Calls 1

sigactionClass · 0.70

Tested by

no test coverage detected