Skip to content

Commit

Permalink
Run rustfmt on ptrace.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
marmistrz committed Jul 20, 2017
1 parent b04cb78 commit 2a295c6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/sys/ptrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,19 @@ type Word = usize;
/// Makes the `PTRACE_SYSCALL` request to ptrace
pub fn syscall(pid: Pid) -> Result<()> {
unsafe {
ptrace(ptrace::PTRACE_SYSCALL, pid, ptr::null_mut(), ptr::null_mut()).map(|_| ()) // ignore the useless return value
ptrace(
ptrace::PTRACE_SYSCALL,
pid,
ptr::null_mut(),
ptr::null_mut(),
).map(|_| ()) // ignore the useless return value
}
}

/// Makes the `PTRACE_PEEKUSER` request to ptrace
pub fn peekuser(pid: Pid, reg: Register) -> Result<Word> {
let reg_arg = (reg as i32) as *mut c_void;
unsafe {
ptrace(ptrace::PTRACE_PEEKUSER, pid, reg_arg, ptr::null_mut()).map(|r| r as Word)
}
unsafe { ptrace(ptrace::PTRACE_PEEKUSER, pid, reg_arg, ptr::null_mut()).map(|r| r as Word) }
}

/// Makes the `PTRACE_POKEUSER` request to ptrace
Expand Down Expand Up @@ -228,7 +231,12 @@ pub fn traceme() -> Result<()> {
/// This function allows to access arbitrary data in the traced process
/// and may crash the inferior if used incorrectly and is thus marked `unsafe`.
pub unsafe fn peekdata(pid: Pid, addr: usize) -> Result<Word> {
ptrace(ptrace::PTRACE_PEEKDATA, pid, addr as *mut c_void, ptr::null_mut()).map(|r| r as Word)
ptrace(
ptrace::PTRACE_PEEKDATA,
pid,
addr as *mut c_void,
ptr::null_mut(),
).map(|r| r as Word)
}

/// Makes the `PTRACE_POKEDATA` request to ptrace
Expand Down

0 comments on commit 2a295c6

Please sign in to comment.