devela::_dep::nc::call

Function newfstatat

pub unsafe fn newfstatat<P>(
    dfd: i32,
    filename: P,
    statbuf: &mut stat_t,
    flag: i32,
) -> Result<(), i32> 
where P: AsRef<Path>,
Available on crate feature dep_nc only.
Expand description

Get file status.

§Examples

let path = "/etc/passwd";
let mut stat = nc::stat_t::default();
let ret = unsafe { nc::newfstatat(nc::AT_FDCWD, path, &mut stat, nc::AT_SYMLINK_NOFOLLOW) };
assert!(ret.is_ok());
assert!(nc::S_ISREG(stat.st_mode as nc::mode_t));