Skip to content

Using the correct type of sighandler_t windows #1637

@vorner

Description

@vorner

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.O-windowsbreakage-candidate

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions