Compilation issues due to process_vm_writev API updates
Trying to compile this with rust 1.64.0 nightly yields the following error:
warning: use of deprecated associated function `nix::sys::uio::IoVec::<&'a [u8]>::from_slice`: Use `IoSlice::new` instead
--> src/snapshot.rs:179:43
|
179 | local_iovecs.push(uio::IoVec::from_slice(data));
| ^^^^^^^^^^
error[E0308]: mismatched types
--> src/snapshot.rs:187:46
|
187 | uio::process_vm_writev(self.pid, &local_iovecs, &remote_iovecs)
| ^^^^^^^^^^^^^ expected slice, found struct `Vec`
|
= note: expected reference `&[IoSlice<'_>]`
found reference `&Vec<IoVec<&[u8]>>`
For more information about this error, try `rustc --explain E0308`.
warning: `ptrace_test` (bin "ptrace_test") generated 5 warnings
error: could not compile `ptrace_test` due to previous error; 5 warnings emitted
I believe there a few issues with old/deprecated methods and as per documentation:
pub fn process_vm_writev(
pid: Pid,
local_iov: &[IoSlice<'_>],
remote_iov: &[RemoteIoVec]
) -> Result<usize>
Write data directly to another process’s virtual memory (see process_vm_writev(2)).
local_iov is a list of IoSlices containing the data to be written, and remote_iov is a list of RemoteIoVecs identifying where the data should be written in the target process. On success, returns the number of bytes written, which will always be a whole number of remote_iov chunk
They probably changed the API as the local_iov now requires an IoSlice while you were developing this.
Sorry I don't have experience with the slices otherwise I'd love to send a PR
Thanks