@@ -126,6 +126,8 @@ libc_enum! {
126
126
PTRACE_SYSEMU_SINGLESTEP ,
127
127
#[ cfg( all( target_os = "linux" , target_env = "gnu" ) ) ]
128
128
PTRACE_GET_SYSCALL_INFO ,
129
+ PTRACE_GETSIGMASK ,
130
+ PTRACE_SETSIGMASK ,
129
131
}
130
132
}
131
133
@@ -325,7 +327,7 @@ fn ptrace_get_data<T>(request: Request, pid: Pid) -> Result<T> {
325
327
libc:: ptrace (
326
328
request as RequestType ,
327
329
libc:: pid_t:: from ( pid) ,
328
- ptr :: null_mut :: < T > ( ) ,
330
+ mem :: size_of :: < T > ( ) ,
329
331
data. as_mut_ptr ( ) as * const _ as * const c_void ,
330
332
)
331
333
} ;
@@ -371,6 +373,11 @@ pub fn getsiginfo(pid: Pid) -> Result<siginfo_t> {
371
373
ptrace_get_data :: < siginfo_t > ( Request :: PTRACE_GETSIGINFO , pid)
372
374
}
373
375
376
+ /// Get sigmask as with `ptrace(PTRACE_GETSIGMASK,...)`
377
+ pub fn getsigmask ( pid : Pid ) -> Result < u64 > {
378
+ ptrace_get_data :: < u64 > ( Request :: PTRACE_GETSIGMASK , pid)
379
+ }
380
+
374
381
/// Get ptrace syscall info as with `ptrace(PTRACE_GET_SYSCALL_INFO,...)`
375
382
/// Only available on Linux 5.3+
376
383
#[ cfg( all( target_os = "linux" , target_env = "gnu" ) ) ]
@@ -404,6 +411,19 @@ pub fn setsiginfo(pid: Pid, sig: &siginfo_t) -> Result<()> {
404
411
}
405
412
}
406
413
414
+ /// Set sigmask as with `ptrace(PTRACE_SETSIGMASK,...)`
415
+ pub fn setsigmask ( pid : Pid , mask : u64 ) -> Result < ( ) > {
416
+ unsafe {
417
+ ptrace_other (
418
+ Request :: PTRACE_SETSIGMASK ,
419
+ pid,
420
+ mem:: size_of :: < u64 > ( ) as _ ,
421
+ & mask as * const _ as * mut c_void ,
422
+ )
423
+ . map ( drop)
424
+ }
425
+ }
426
+
407
427
/// Sets the process as traceable, as with `ptrace(PTRACE_TRACEME, ...)`
408
428
///
409
429
/// Indicates that this process is to be traced by its parent.
0 commit comments