Function nc::fstat [−][src]
pub fn fstat(fd: i32, statbuf: &mut stat_t) -> Result<(), Errno>
Expand description
Get file status about a file descriptor.
let path = "/tmp"; // Open folder directly. let fd = nc::open(path, nc::O_PATH, 0); assert!(fd.is_ok()); let fd = fd.unwrap(); let mut stat = nc::stat_t::default(); let ret = nc::fstat(fd, &mut stat); assert!(ret.is_ok()); // Check fd is a directory. assert_eq!((stat.st_mode & nc::S_IFMT), nc::S_IFDIR); assert!(nc::close(fd).is_ok());