@@ -148,6 +148,8 @@ libc_enum! {
148148 PTRACE_SYSEMU_SINGLESTEP ,
149149 #[ cfg( all( target_os = "linux" , target_env = "gnu" ) ) ]
150150 PTRACE_GET_SYSCALL_INFO ,
151+ #[ cfg( all( target_os = "linux" , target_env = "gnu" ) ) ]
152+ PTRACE_SET_SYSCALL_INFO ,
151153 }
152154}
153155
@@ -576,6 +578,21 @@ pub fn syscall_info(pid: Pid) -> Result<libc::ptrace_syscall_info> {
576578 ptrace_get_data :: < libc:: ptrace_syscall_info > ( Request :: PTRACE_GET_SYSCALL_INFO , pid)
577579}
578580
581+ /// Set the information of the syscall that caused the stop, as with
582+ /// `ptrace(PTRACE_SET_SYSCALL_INFO, ...`.
583+ #[ cfg( all( target_os = "linux" , target_env = "gnu" ) ) ]
584+ pub fn set_syscall_info ( pid : Pid , syscall_info : & libc:: ptrace_syscall_info ) -> Result < ( ) > {
585+ let res = unsafe {
586+ libc:: ptrace (
587+ Request :: PTRACE_SET_SYSCALL_INFO as RequestType ,
588+ libc:: pid_t:: from ( pid) ,
589+ mem:: size_of :: < libc:: ptrace_syscall_info > ( ) ,
590+ syscall_info as * const _ as * const c_void ,
591+ )
592+ } ;
593+ Errno :: result ( res) . map ( drop)
594+ }
595+
579596/// Sets the process as traceable, as with `ptrace(PTRACE_TRACEME, ...)`
580597///
581598/// Indicates that this process is to be traced by its parent.
0 commit comments