devela::_dep::nc

Function mknodat

pub unsafe fn mknodat<P>(
    dirfd: i32,
    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-mknodat";
// Create a named pipe.
let ret = unsafe { nc::mknodat(nc::AT_FDCWD, 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());