devela::_dep::nc::call

Function lstat

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

Get file status about a file, without following symbolic.

§Examples

let path = "/etc/passwd";
let mut stat = nc::stat_t::default();
let ret = unsafe { nc::lstat(path, &mut stat) };
assert!(ret.is_ok());
// Check fd is a regular file.
assert!(nc::S_ISREG(stat.st_mode as nc::mode_t));