devela::_dep::nc

Function prlimit64

pub unsafe fn prlimit64(
    pid: i32,
    resource: i32,
    new_limit: Option<&rlimit64_t>,
    old_limit: Option<&mut rlimit64_t>,
) -> Result<(), i32> 
Available on crate feature dep_nc only.
Expand description

Get/set the resource limits of an arbitary process.

§Examples

let mut old_limit = nc::rlimit64_t::default();
let ret = unsafe { nc::prlimit64(nc::getpid(), nc::RLIMIT_NOFILE, None, Some(&mut old_limit)) };
assert!(ret.is_ok());
assert!(old_limit.rlim_cur > 0);
assert!(old_limit.rlim_max > 0);