linux-sysprog · beginner · ~15 min
Identify the job-control stop signals.
Job control uses stop signals to pause a process rather than kill it. Identify them.
Implement int is_stop_signal(int sig) that returns 1 if sig is SIGSTOP or SIGTSTP, else 0.
sig: a signal number (compare against the signal.h constants).1 for SIGSTOP or SIGTSTP, else 0.
is_stop_signal(SIGSTOP) -> 1
is_stop_signal(SIGTSTP) -> 1 (Ctrl-Z)
is_stop_signal(SIGINT) -> 0
sig: a signal number from <signal.h>.
1 for SIGSTOP/SIGTSTP, else 0.
Match by the signal.h constants.
#include <signal.h>
int is_stop_signal(int sig) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.