devela::_dep::nc::call

Function acct

pub unsafe fn acct<P>(filename: Option<P>) -> Result<(), i32> 
where P: AsRef<Path>,
Available on crate feature dep_nc only.
Expand description

Switch process accounting.

§Examples

let path = "/tmp/nc-acct";
let fd = unsafe { nc::openat(nc::AT_FDCWD, path, nc::O_WRONLY | nc::O_CREAT, 0o644) };
assert!(fd.is_ok());
let fd = fd.unwrap();
let ret = unsafe { nc::close(fd) };
assert!(ret.is_ok());
let ret = unsafe { nc::acct(Some(path)) };
assert_eq!(ret, Err(nc::EPERM));
let ret = unsafe { nc::unlinkat(nc::AT_FDCWD, path, 0) };
assert!(ret.is_ok());