vorner / signal-hook

Rust library allowing to register multiple handlers for the same signal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not compile on Haiku due to usage of `SIGIO` constant

link2xt opened this issue · comments

signal-hook attempts to import SIGIO here:

SIGABRT, SIGALRM, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT, SIGIO,

then uses it here:

SIGIO is a BSD name for the standard SIGPOLL, which is defined on Haiku:
https://github.com/haiku/haiku/blob/ae7d733d42435619cf76e0ab21a2c7af59dcf84f/headers/posix/signal.h#L142

Given that SIGPOLL is also obsolete according to the POSIX standard and is going to be removed in future versions, I think the correct solution is not to import either of them. SIGIO/SIGPOLL should not be generated unless you explicitly opt in via fcntl: https://www.gnu.org/software/libc/manual/html_node/Interrupt-Input.html

This is the only problem that prevents usage of signal-hook on Haiku, so fixing it will allow compiling the crate there.

Hello

On systems that do have the signals, it is desirable to know how it behaves (the second link you have). So, my suggestion is:

  • If it's available under a different name, provide an alias/define the constant (eg. const SIGIO: c_int = SIGPOLL)
  • If it's not available at all, omit it from the list.

I don't really have much free time these days, so if you want to send a PR, it would speed things up. If you can also include the platform in CI, so we know it keeps working, it would be even better.