mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
Prevent anyone else from wasting time w/ sigqueue(2)
It turns out there *is* an obviously portable way... except it's not-so-obviously not portable after all. POSIX specifies that sigqueue(2) can be used to validate pid and signo separately, returning EINVAL in the specific case of an invalid or unsupported signal number. This would be perfect... if only it were actually implemented.
This commit is contained in:
parent
67ac23c70e
commit
9cf56047fb
1 changed files with 3 additions and 2 deletions
|
@ -135,9 +135,10 @@ static void print_blocked_signals() {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// There is no obviously portable way to get the maximum number of signals.
|
||||
// POSIX says sigqueue(2) can be used with signo 0 to validate the pid and signo parameters,
|
||||
// but it is missing from OpenBSD and returns ENOSYS (not implemented) under WSL.
|
||||
// Here we limit it to 32 because strsignal on OpenBSD returns "Unknown signal" for anything
|
||||
// above.
|
||||
// NetBSD taps out at 63, Linux at 64.
|
||||
// above, while NetBSD taps out at 63, and Linux at 64.
|
||||
for (int sig = 1; sig < 33; sig++) {
|
||||
if (sigismember(&sigs, sig)) {
|
||||
print_signal(sig);
|
||||
|
|
Loading…
Reference in a new issue