Skip to content

Commit

Permalink
Merge #1294
Browse files Browse the repository at this point in the history
1294: Add allow(unused_unsafe) to some functions. r=asomers a=vi



Co-authored-by: Vitaly _Vi Shukela <[email protected]>
  • Loading branch information
bors[bot] and vi authored Sep 19, 2020
2 parents bf77f50 + 4db701d commit 2c24405
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/sys/quota.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::errno::Errno;
struct QuotaCmd(QuotaSubCmd, QuotaType);

impl QuotaCmd {
#[allow(unused_unsafe)]
fn as_int(&self) -> c_int {
unsafe { libc::QCMD(self.0 as i32, self.1 as i32) }
}
Expand Down
9 changes: 9 additions & 0 deletions src/sys/wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,35 +117,43 @@ impl WaitStatus {
}
}

#[allow(unused_unsafe)]
fn exited(status: i32) -> bool {
unsafe { libc::WIFEXITED(status) }
}

#[allow(unused_unsafe)]
fn exit_status(status: i32) -> i32 {
unsafe { libc::WEXITSTATUS(status) }
}

#[allow(unused_unsafe)]
fn signaled(status: i32) -> bool {
unsafe { libc::WIFSIGNALED(status) }
}

#[allow(unused_unsafe)]
fn term_signal(status: i32) -> Result<Signal> {
Signal::try_from(unsafe { libc::WTERMSIG(status) })
}

#[allow(unused_unsafe)]
fn dumped_core(status: i32) -> bool {
unsafe { libc::WCOREDUMP(status) }
}

#[allow(unused_unsafe)]
fn stopped(status: i32) -> bool {
unsafe { libc::WIFSTOPPED(status) }
}

#[allow(unused_unsafe)]
fn stop_signal(status: i32) -> Result<Signal> {
Signal::try_from(unsafe { 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
Expand All @@ -159,6 +167,7 @@ fn stop_additional(status: i32) -> c_int {
(status >> 16) as c_int
}

#[allow(unused_unsafe)]
fn continued(status: i32) -> bool {
unsafe { libc::WIFCONTINUED(status) }
}
Expand Down

0 comments on commit 2c24405

Please sign in to comment.