#[cfg(target_os = "linux")]
pub fn disable_tracing() -> anyhow::Result<()> {
const PR_SET_DUMPABLE: i32 = 4;
let ret = unsafe { libc::prctl(PR_SET_DUMPABLE, 0) };
if ret == 0 {
Ok(())
} else {
let e = nix::Error::last();
Err(anyhow::anyhow!("failed to disable PTRACE_ATTACH, agent memory may be dumpable by other processes: {}", e))
}
}
#[cfg(not(target_os = "linux"))]
pub fn disable_tracing() -> anyhow::Result<()> {
Err(anyhow::anyhow!("failed to disable PTRACE_ATTACH, agent memory may be dumpable by other processes: unimplemented on this platform"))
}