linux-sysprog · beginner · ~15 min

Is it a termination signal?

Group the process-ending signals.

Challenge

Implement int is_termination_signal(int sig) returning 1 for SIGINT, SIGTERM, SIGKILL, SIGQUIT (signals that ask a process to end), else 0.

Starter code

#include <signal.h>

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

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