1 //! ::statvfs implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysstatvfs.h.html 2 3 use crate::unix::{ 4 header::fcntl::O_PATH, 5 platform, 6 }; 7 8 //pub const ST_RDONLY 9 //pub const ST_NOSUID 10 11 // #[no_mangle] 12 // pub extern "C" fn fstatvfs(fildes: ::c_int, buf: *mut ::statvfs) -> ::c_int { 13 // platform::pal::fstatvfs(fildes, buf) 14 // } 15 16 #[no_mangle] 17 pub unsafe extern "C" fn statvfs(file: *const ::c_char, buf: *mut ::statvfs) -> ::c_int { 18 let fd = platform::pal::open(file as *const ::c_char, O_PATH, 0); 19 if fd < 0 { 20 return -1; 21 } 22 23 let res = platform::pal::fstatvfs(fd, buf); 24 25 platform::pal::close(fd); 26 27 res 28 } 29