linux-sysprog · intermediate · ~15 min

Does the default action terminate?

Recall which signals kill by default.

Challenge

Implement int default_terminates(int sig) returning 1 if the signal's default action terminates the process for SIGINT, SIGTERM, SIGKILL, SIGQUIT, SIGSEGV, else 0.

Starter code

#include <signal.h>

int default_terminates(int sig) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.