devela::_dep::nc::call

Function swapon

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

Start swapping to file/device.

§Examples

let filename = "/dev/sda-no-exist";
let ret = unsafe { nc::swapon(filename, nc::SWAP_FLAG_PREFER) };
assert!(ret.is_err());
assert_eq!(ret, Err(nc::EPERM));