//! Functionality for reading a remote process's memory use crate::{errors::CopyFromProcessError, ptrace_dumper::PtraceDumper, Pid}; enum Style { /// Uses [`process_vm_readv`](https://linux.die.net/man/2/process_vm_readv) /// to read the memory. /// /// This is not available on old <3.2 (really, ancient) kernels, and requires /// the same permissions as ptrace VirtualMem, /// Reads the memory from `/proc//mem` /// /// Available on basically all versions of Linux, but could fail if the process /// has insufficient privileges, ie ptrace File(std::fs::File), /// Reads the memory with [ptrace (`PTRACE_PEEKDATA`)](https://man7.org/linux/man-pages/man2/ptrace.2.html) /// /// Reads data one word at a time, so slow, but fairly reliable, as long as /// the process can be ptraced Ptrace, /// No methods succeeded, generally there isn't a case where failing a syscall /// will work if called again Unavailable { vmem: nix::Error, file: nix::Error, ptrace: nix::Error, }, } pub struct MemReader { /// The pid of the child to read pid: nix::unistd::Pid, style: Option