I'm opening this here as continuation of discussion on #1626. This also might be related to #1359.
Currently, sighandler_t is an alias to usize on Windows targets. While this works, it is strictly speaking wrong and the right type should be something like Option<extern "C" fn(c_int) -> ()>.
There are, however, concerns about the switch:
- It is an API change that might break someone's code. At least a crater run would be needed.
- What is the correct type? Due to the fact this doesn't always contain a valid function pointer, but also some marker constants (eg.
SIG_IGN, which has value of 1), it is unclear if this is correct on the Rust side. It seems the consensus is function pointers need to be non-null (solved by the Option) and properly aligned, but the alignment of function pointer on all platforms Windows currently run is 1, so for that reason this should be fine.
I'm opening this here as continuation of discussion on #1626. This also might be related to #1359.
Currently,
sighandler_tis an alias tousizeon Windows targets. While this works, it is strictly speaking wrong and the right type should be something likeOption<extern "C" fn(c_int) -> ()>.There are, however, concerns about the switch:
SIG_IGN, which has value of 1), it is unclear if this is correct on the Rust side. It seems the consensus is function pointers need to be non-null (solved by the Option) and properly aligned, but the alignment of function pointer on all platforms Windows currently run is 1, so for that reason this should be fine.