Skip to content

Support custom signals for sigaction #2319

Closed
@AzariasB

Description

@AzariasB

sigaction currently only accepts the Signal enum and directly passes it to libc::sigaction as a c_int.

I'm working on a linux system that has custom signals superior to 32. And thus not declared in the Signal enum.

The idea would be to have another sigaction function that accepts directly a c_int.

Something like

pub unsafe fn sigaction_raw_signal(signal_raw: libc::c_int sigaction: &SigAction) -> Result<SigAction> {
    let mut oldact = mem::MaybeUninit::<libc::sigaction>::uninit();

    let res = libc::sigaction(signal_raw,
                              &sigaction.sigaction as *const libc::sigaction,
                              oldact.as_mut_ptr());

    Errno::result(res).map(|_| SigAction { sigaction: oldact.assume_init() })
}

It might be a bit out of scope for this library ... let me know!

I looked into implementing the function myself, but since Sigaction's fields are not public, I cannot have this function inside my own library. So another way would be to make sigaction public, but I feel like it's not ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions