linux-sysprog · beginner · ~15 min

Can the signal be caught?

Know the two uncatchable signals.

Challenge

Implement int is_catchable(int sig) returning 0 for SIGKILL and SIGSTOP (which can never be caught or ignored) and 1 for any other signal.

Starter code

#include <signal.h>

int is_catchable(int sig) {
    /* TODO */
    return 1;
}

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