Function nc::ioctl[][src]

pub fn ioctl(fd: i32, cmd: i32, arg: usize) -> Result<(), Errno>
Expand description

Control device.

let path = "/tmp/nc-ioctl";
let ret = nc::open(path, nc::O_WRONLY | nc::O_CREAT, 0o644);
assert!(ret.is_ok());
let fd = ret.unwrap();
let mut attr: i32 = 0;
let cmd = -2146933247; // nc::FS_IOC_GETFLAGS
let ret = nc::ioctl(fd, cmd, &mut attr as *mut i32 as usize);
assert!(ret.is_ok());
println!("attr: {}", attr);

assert!(nc::close(fd).is_ok());
assert!(nc::unlink(path).is_ok());