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/).
55
66## [ Unreleased] - ReleaseDate
77### 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+
812- Added ` Signal::as_str() ` : returns signal name as ` &'static str `
913 (#[ 1138] ( https://github.com/nix-rust/nix/pull/1138 ) )
1014
Original file line number Diff line number Diff line change @@ -315,6 +315,21 @@ pub fn attach(pid: Pid) -> Result<()> {
315315 }
316316}
317317
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+
318333/// Detaches the current running process, as with `ptrace(PTRACE_DETACH, ...)`
319334///
320335/// Detaches from the process specified in pid allowing it to run freely
You can’t perform that action at this time.
0 commit comments