Function openat2
pub unsafe fn openat2<P>(
dirfd: i32,
pathname: P,
how: &mut open_how_t,
) -> Result<i32, i32> ⓘ
Available on crate feature
dep_nc
only.Expand description
Open and possibly create a file (extended)
§Examples
let path = "/etc/passwd";
let mut how = nc::open_how_t{
flags: nc::O_RDONLY as u64,
..Default::default()
};
let ret = unsafe { nc::openat2(nc::AT_FDCWD, path, &mut how) };
assert!(ret.is_ok());
let fd = ret.unwrap();
let ret = unsafe { nc::close(fd) };
assert!(ret.is_ok());