linux-sysprog · intermediate · ~15 min
Detect the SA_SIGINFO flag.
The SA_SIGINFO flag selects the three-argument sa_sigaction handler, which receives signal details and context instead of just the signal number. Test for it.
Implement int gets_siginfo(int flags) that returns 1 if the SA_SIGINFO bit is set in flags, else 0.
flags: an sa_flags value (bitmask).1 if SA_SIGINFO is set, else 0.
gets_siginfo(SA_SIGINFO) -> 1
gets_siginfo(SA_RESTART) -> 0
flags: an sa_flags bitmask.
1 if the SA_SIGINFO bit is set, else 0.
#include <signal.h>
int gets_siginfo(int flags) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.