devela::_dep::nc

Function mknod

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

Create a special or ordinary file.

§Examples

let path = "/tmp/nc-mknod";
// Create a named pipe.
let ret = unsafe { nc::mknod(path, nc::S_IFIFO | nc::S_IRUSR | nc::S_IWUSR, 0) };
assert!(ret.is_ok());
let ret = unsafe { nc::unlinkat(nc::AT_FDCWD, path, 0) };
assert!(ret.is_ok());