Skip to content

Commit c68fb33

Browse files
committed
Add pokeuser
1 parent f6dd339 commit c68fb33

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/sys/ptrace.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ pub fn peekuser(pid: Pid, reg: Register) -> Result<Word> {
204204
}
205205
}
206206

207+
/// Makes the `PTRACE_PEEKUSER` request to ptrace
208+
pub unsafe fn pokeuser(pid: Pid, reg: Register, val: Word) -> Result<()> {
209+
let reg_arg = (reg as u64) as *mut c_void;
210+
ptrace(ptrace::PTRACE_POKEUSER, pid, reg_arg, val as *mut c_void).map(|_| ()) // ignore the useless return value
211+
}
212+
213+
207214
/// Sets the process as traceable with `PTRACE_TRACEME`
208215
pub fn traceme() -> Result<()> {
209216
unsafe {

0 commit comments

Comments
 (0)