linux-sysprog · intermediate · ~15 min
Distinguish a signalled death from a normal exit.
Emulate WIFSIGNALED: implement int was_signaled(int wstatus) returning 1 if the low 7 bits of wstatus are a real signal number (non-zero and not 0x7f, which means 'stopped'), else 0.
int was_signaled(int wstatus) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.