devela::_dep::nc::call

Function statx

pub unsafe fn statx<P>(
    dirfd: i32,
    filename: P,
    flags: i32,
    mask: u32,
    buf: &mut statx_t,
) -> Result<(), i32> 
where P: AsRef<Path>,
Available on crate feature dep_nc only.
Expand description

Get file status about a file (extended).

§Examples

let path = "/etc/passwd";
let mut statx = nc::statx_t::default();
let ret = unsafe { nc::statx(nc::AT_FDCWD, path, nc::AT_SYMLINK_NOFOLLOW, nc::STATX_TYPE, &mut statx) };
assert!(ret.is_ok());
// Check fd is a regular file.
assert!(nc::S_ISREG(statx.stx_mode as nc::mode_t));