Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/2326.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
make SigAction repr(transparent) & can be converted to/from the libc raw type
14 changes: 14 additions & 0 deletions src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,11 +753,25 @@ pub enum SigHandler {
}

/// Action to take on receipt of a signal. Corresponds to `sigaction`.
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct SigAction {
sigaction: libc::sigaction
}

impl From<libc::sigaction> for SigAction {
fn from(value: libc::sigaction) -> Self {
Self {
sigaction: value
}
}
}
impl From<SigAction> for libc::sigaction {
fn from(value: SigAction) -> libc::sigaction {
value.sigaction
}
}

impl SigAction {
/// Creates a new action.
///
Expand Down