summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Zoeller <rtzoeller@rtzoeller.com>2022-03-20 09:24:21 -0500
committerRyan Zoeller <rtzoeller@rtzoeller.com>2022-03-20 09:24:21 -0500
commitff6f8b8a26c8d61f4341e441acf405402b46a430 (patch)
treed237a89895ce0d9572fc5c8a4e9bb8bb97f508cf
parent445a4387ada6e71e226aaf9d6087174bd5102843 (diff)
downloadnix-ff6f8b8a26c8d61f4341e441acf405402b46a430.zip
Redox renamed sigaction.sa_handler to .sa_sigaction
-rw-r--r--Cargo.toml2
-rw-r--r--src/sys/signal.rs36
2 files changed, 3 insertions, 35 deletions
diff --git a/Cargo.toml b/Cargo.toml
index e5b0831e..1e2aad22 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,7 +27,7 @@ targets = [
]
[dependencies]
-libc = { version = "0.2.115", features = [ "extra_traits" ] }
+libc = { version = "0.2.121", features = [ "extra_traits" ] }
bitflags = "1.1"
cfg-if = "1.0"
diff --git a/src/sys/signal.rs b/src/sys/signal.rs
index f10a2133..f982b4e7 100644
--- a/src/sys/signal.rs
+++ b/src/sys/signal.rs
@@ -670,21 +670,12 @@ impl SigAction {
/// is the `SigAction` variant). `mask` specifies other signals to block during execution of
/// the signal-catching function.
pub fn new(handler: SigHandler, flags: SaFlags, mask: SigSet) -> SigAction {
- #[cfg(target_os = "redox")]
- unsafe fn install_sig(p: *mut libc::sigaction, handler: SigHandler) {
- (*p).sa_handler = match handler {
- SigHandler::SigDfl => libc::SIG_DFL,
- SigHandler::SigIgn => libc::SIG_IGN,
- SigHandler::Handler(f) => f as *const extern fn(libc::c_int) as usize,
- };
- }
-
- #[cfg(not(target_os = "redox"))]
unsafe fn install_sig(p: *mut libc::sigaction, handler: SigHandler) {
(*p).sa_sigaction = match handler {
SigHandler::SigDfl => libc::SIG_DFL,
SigHandler::SigIgn => libc::SIG_IGN,
SigHandler::Handler(f) => f as *const extern fn(libc::c_int) as usize,
+ #[cfg(not(target_os = "redox"))]
SigHandler::SigAction(f) => f as *const extern fn(libc::c_int, *mut libc::siginfo_t, *mut libc::c_void) as usize,
};
}
@@ -716,12 +707,11 @@ impl SigAction {
}
/// Returns the action's handler.
- #[cfg(not(target_os = "redox"))]
- #[cfg_attr(docsrs, doc(cfg(all())))]
pub fn handler(&self) -> SigHandler {
match self.sigaction.sa_sigaction {
libc::SIG_DFL => SigHandler::SigDfl,
libc::SIG_IGN => SigHandler::SigIgn,
+ #[cfg(not(target_os = "redox"))]
p if self.flags().contains(SaFlags::SA_SIGINFO) =>
SigHandler::SigAction(
// Safe for one of two reasons:
@@ -749,28 +739,6 @@ impl SigAction {
as extern fn(libc::c_int)),
}
}
-
- /// Returns the action's handler.
- #[cfg(target_os = "redox")]
- #[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn handler(&self) -> SigHandler {
- match self.sigaction.sa_handler {
- libc::SIG_DFL => SigHandler::SigDfl,
- libc::SIG_IGN => SigHandler::SigIgn,
- p => SigHandler::Handler(
- // Safe for one of two reasons:
- // * The SigHandler was created by SigHandler::new, in which
- // case the pointer is correct, or
- // * The SigHandler was created by signal or sigaction, which
- // are unsafe functions, so the caller should've somehow
- // ensured that it is correctly initialized.
- unsafe{
- *(&p as *const usize
- as *const extern fn(libc::c_int))
- }
- as extern fn(libc::c_int)),
- }
- }
}
/// Changes the action taken by a process on receipt of a specific signal.