summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorJan Philipp Hafer <jan.hafer@rwth-aachen.de>2021-02-14 21:07:08 +0100
committerJan Philipp Hafer <jan.hafer@rwth-aachen.de>2021-02-14 21:07:08 +0100
commit2ced7ea368c34287fb8b99442e2807851020c132 (patch)
treed61a29e2bcab0aea1a62564782ddca924868237e /src/sys
parenteaa7ffb4542bbbbd16be47969726b759b43b605d (diff)
downloadnix-2ced7ea368c34287fb8b99442e2807851020c132.zip
fix(unsafe): remove unnecessary unsafe
closes #1380 libc 0.2.82 exposes status signals with macros generating safe functions
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/wait.rs27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/sys/wait.rs b/src/sys/wait.rs
index e151e432..faf8543c 100644
--- a/src/sys/wait.rs
+++ b/src/sys/wait.rs
@@ -116,49 +116,41 @@ impl WaitStatus {
}
}
-#[allow(unused_unsafe)]
fn exited(status: i32) -> bool {
- unsafe { libc::WIFEXITED(status) }
+ libc::WIFEXITED(status)
}
-#[allow(unused_unsafe)]
fn exit_status(status: i32) -> i32 {
- unsafe { libc::WEXITSTATUS(status) }
+ libc::WEXITSTATUS(status)
}
-#[allow(unused_unsafe)]
fn signaled(status: i32) -> bool {
- unsafe { libc::WIFSIGNALED(status) }
+ libc::WIFSIGNALED(status)
}
-#[allow(unused_unsafe)]
fn term_signal(status: i32) -> Result<Signal> {
- Signal::try_from(unsafe { libc::WTERMSIG(status) })
+ Signal::try_from(libc::WTERMSIG(status))
}
-#[allow(unused_unsafe)]
fn dumped_core(status: i32) -> bool {
- unsafe { libc::WCOREDUMP(status) }
+ libc::WCOREDUMP(status)
}
-#[allow(unused_unsafe)]
fn stopped(status: i32) -> bool {
- unsafe { libc::WIFSTOPPED(status) }
+ libc::WIFSTOPPED(status)
}
-#[allow(unused_unsafe)]
fn stop_signal(status: i32) -> Result<Signal> {
- Signal::try_from(unsafe { libc::WSTOPSIG(status) })
+ Signal::try_from(libc::WSTOPSIG(status))
}
#[cfg(any(target_os = "android", target_os = "linux"))]
-#[allow(unused_unsafe)]
fn syscall_stop(status: i32) -> bool {
// From ptrace(2), setting PTRACE_O_TRACESYSGOOD has the effect
// of delivering SIGTRAP | 0x80 as the signal number for syscall
// stops. This allows easily distinguishing syscall stops from
// genuine SIGTRAP signals.
- unsafe { libc::WSTOPSIG(status) == libc::SIGTRAP | 0x80 }
+ libc::WSTOPSIG(status) == libc::SIGTRAP | 0x80
}
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -166,9 +158,8 @@ fn stop_additional(status: i32) -> c_int {
(status >> 16) as c_int
}
-#[allow(unused_unsafe)]
fn continued(status: i32) -> bool {
- unsafe { libc::WIFCONTINUED(status) }
+ libc::WIFCONTINUED(status)
}
impl WaitStatus {