mod.rs 668 B

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