@@ -73,6 +73,10 @@ mod ffi {
73
73
74
74
/// Performs a ptrace request. If the request in question is provided by a specialised function
75
75
/// this function will return an unsupported operation error.
76
+ #[ deprecated(
77
+ since="0.10.0" ,
78
+ note="usages of `ptrace()` should be replaced with the specialized helper functions instead"
79
+ ) ]
76
80
pub unsafe fn ptrace ( request : ptrace:: PtraceRequest , pid : Pid , addr : * mut c_void , data : * mut c_void ) -> Result < c_long > {
77
81
use self :: ptrace:: * ;
78
82
@@ -106,8 +110,9 @@ fn ptrace_get_data<T>(request: ptrace::PtraceRequest, pid: Pid) -> Result<T> {
106
110
Ok ( data)
107
111
}
108
112
109
- fn ptrace_other ( request : ptrace:: PtraceRequest , pid : Pid , addr : * mut c_void , data : * mut c_void ) -> Result < c_long > {
110
- Errno :: result ( unsafe { ffi:: ptrace ( request, pid. into ( ) , addr, data) } ) . map ( |_| 0 )
113
+ /// Performs a general ptrace request.
114
+ unsafe fn ptrace_other ( request : ptrace:: PtraceRequest , pid : Pid , addr : * mut c_void , data : * mut c_void ) -> Result < c_long > {
115
+ Errno :: result ( ffi:: ptrace ( request, pid. into ( ) , addr, data) ) . map ( |_| 0 )
111
116
}
112
117
113
118
/// Set options, as with `ptrace(PTRACE_SETOPTIONS,...)`.
@@ -150,7 +155,7 @@ pub fn setsiginfo(pid: Pid, sig: &siginfo_t) -> Result<()> {
150
155
/// This is the only ptrace request to be issued by the tracee.
151
156
pub fn traceme ( ) -> Result < ( ) > {
152
157
unsafe {
153
- ptrace (
158
+ ptrace_other (
154
159
ptrace:: PTRACE_TRACEME ,
155
160
Pid :: from_raw ( 0 ) ,
156
161
ptr:: null_mut ( ) ,
@@ -164,7 +169,7 @@ pub fn traceme() -> Result<()> {
164
169
/// Arranges for the tracee to be stopped at the next entry to or exit from a system call.
165
170
pub fn syscall ( pid : Pid ) -> Result < ( ) > {
166
171
unsafe {
167
- ptrace (
172
+ ptrace_other (
168
173
ptrace:: PTRACE_SYSCALL ,
169
174
pid,
170
175
ptr:: null_mut ( ) ,
@@ -178,7 +183,7 @@ pub fn syscall(pid: Pid) -> Result<()> {
178
183
/// Attaches to the process specified in pid, making it a tracee of the calling process.
179
184
pub fn attach ( pid : Pid ) -> Result < ( ) > {
180
185
unsafe {
181
- ptrace (
186
+ ptrace_other (
182
187
ptrace:: PTRACE_ATTACH ,
183
188
pid,
184
189
ptr:: null_mut ( ) ,
@@ -197,7 +202,7 @@ pub fn cont<T: Into<Option<Signal>>>(pid: Pid, sig: T) -> Result<()> {
197
202
None => ptr:: null_mut ( ) ,
198
203
} ;
199
204
unsafe {
200
- ptrace ( ptrace:: PTRACE_CONT , pid, ptr:: null_mut ( ) , data) . map ( |_| ( ) ) // ignore the useless return value
205
+ ptrace_other ( ptrace:: PTRACE_CONT , pid, ptr:: null_mut ( ) , data) . map ( |_| ( ) ) // ignore the useless return value
201
206
}
202
207
}
203
208
0 commit comments