File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
6
6
## [ Unreleased] - ReleaseDate
7
7
### Added
8
+ - Added ` ptrace::seize() ` : similar to ` attach() ` on Linux
9
+ but with better-defined semantics.
10
+ (#[ 1154] ( https://github.com/nix-rust/nix/pull/1154 ) )
11
+
8
12
- Added ` Signal::as_str() ` : returns signal name as ` &'static str `
9
13
(#[ 1138] ( https://github.com/nix-rust/nix/pull/1138 ) )
10
14
Original file line number Diff line number Diff line change @@ -315,6 +315,21 @@ pub fn attach(pid: Pid) -> Result<()> {
315
315
}
316
316
}
317
317
318
+ /// Attach to a running process, as with `ptrace(PTRACE_SEIZE, ...)`
319
+ ///
320
+ /// Attaches to the process specified in pid, making it a tracee of the calling process.
321
+ #[ cfg( all( target_os = "linux" , not( any( target_arch = "mips" , target_arch = "mips64" ) ) ) ) ]
322
+ pub fn seize ( pid : Pid , options : Options ) -> Result < ( ) > {
323
+ unsafe {
324
+ ptrace_other (
325
+ Request :: PTRACE_SEIZE ,
326
+ pid,
327
+ ptr:: null_mut ( ) ,
328
+ options. bits ( ) as * mut c_void ,
329
+ ) . map ( drop) // ignore the useless return value
330
+ }
331
+ }
332
+
318
333
/// Detaches the current running process, as with `ptrace(PTRACE_DETACH, ...)`
319
334
///
320
335
/// Detaches from the process specified in pid allowing it to run freely
You can’t perform that action at this time.
0 commit comments