From: Alan T. DeKok Date: Fri, 18 Sep 2015 14:09:54 +0000 (-0400) Subject: Don't grab SIGUSR1 and SIGUSR2. X-Git-Tag: release_3_0_10~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5333d5d179da3256e337a4836d6366bbfc73b16d;p=thirdparty%2Ffreeradius-server.git Don't grab SIGUSR1 and SIGUSR2. There are now debug commands for getting talloc reports --- diff --git a/src/lib/debug.c b/src/lib/debug.c index 3c08926e0ae..a56e4ec2d91 100644 --- a/src/lib/debug.c +++ b/src/lib/debug.c @@ -434,7 +434,7 @@ fr_bt_marker_t *fr_backtrace_attach(UNUSED fr_cbuff_t **cbuff, UNUSED TALLOC_CTX static int _panic_on_free(UNUSED char *foo) { - fr_fault(SIGUSR1); + fr_fault(SIGABRT); return -1; /* this should make the free fail */ } @@ -619,7 +619,7 @@ static int fr_fault_check_permissions(void) * * @param sig caught */ -void fr_fault(int sig) +NEVER_RETURNS void fr_fault(int sig) { char cmd[sizeof(panic_action) + 20]; char *out = cmd; @@ -635,11 +635,8 @@ void fr_fault(int sig) * as it may interfere with the operation of the debugger. * If something calls us directly we just raise the signal and let * the debugger handle it how it wants. - * - * The only exception are SIGUSR1 and SIGUSR2 which print out various - * debugging info, and should be allowed to continue. */ - if ((fr_debug_state == DEBUG_STATE_ATTACHED) && (sig != SIGUSR1) && (sig != SIGUSR2)) { + if (fr_debug_state == DEBUG_STATE_ATTACHED) { FR_FAULT_LOG("RAISING SIGNAL: %s", strsignal(sig)); raise(sig); goto finish; @@ -745,11 +742,6 @@ void fr_fault(int sig) FR_FAULT_LOG("Panic action exited with %i", code); finish: -#ifdef SIGUSR1 - if (sig == SIGUSR1) { - return; - } -#endif fr_exit_now(1); } @@ -858,16 +850,6 @@ int fr_log_talloc_report(TALLOC_CTX *ctx) return 0; } -/** Signal handler to print out a talloc memory report - * - * @param sig caught - */ -static void _fr_fault_mem_report(int sig) -{ - FR_FAULT_LOG("CAUGHT SIGNAL: %s", strsignal(sig)); - - if (fr_log_talloc_report(NULL) < 0) fr_perror("memreport"); -} static int _fr_disable_null_tracking(UNUSED bool *p) { @@ -992,13 +974,6 @@ int fr_fault_setup(char const *cmd, char const *program) case DEBUG_STATE_ATTACHED: break; } -#ifdef SIGUSR1 - if (fr_set_signal(SIGUSR1, fr_fault) < 0) return -1; -#endif - -#ifdef SIGUSR2 - if (fr_set_signal(SIGUSR2, _fr_fault_mem_report) < 0) return -1; -#endif /* * Needed for memory reports @@ -1102,8 +1077,8 @@ bool fr_assert_cond(char const *file, int line, char const *expr, bool cond) { if (!cond) { FR_FAULT_LOG("SOFT ASSERT FAILED %s[%u]: %s", file, line, expr); -#if !defined(NDEBUG) && defined(SIGUSR1) - fr_fault(SIGUSR1); +#if !defined(NDEBUG) + fr_fault(SIGABRT); #endif return false; }