Provide siginfo_t data in signal handler

signal.sigwaitinfo() returns (some of) the information from siginfo_t, however this information is not available in a signal handler set by signal.signal, and there is no way to get at it after the signal has been caught using such a handler.

In particular this is important when receiving SIGCHLD, as you need to know si_pid and si_code being CLD_EXITED, CLD_CONTINUED or CLD_STOPPED make a pretty big difference :slight_smile:

To not introduce a backwards incompatibility, callbacks would probably need to be registered with another function than signal.signal. In C, that function is called sigaction, and I propose using the same name.

If it is impossible (for data allocation reasons) to do this, providing a way to get the information from the last signal, post fact, once execution has returned to the code that was interrupted by the signal, might be good enough and allow passing this to an async signal handler in asyncio.