1
0

statfs.h 977 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-03-27 xqyjlj adapt musl
  9. */
  10. #ifndef __SYS_STATFS_H__
  11. #define __SYS_STATFS_H__
  12. #include <stddef.h>
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #ifdef RT_USING_MUSLLIBC
  17. /* this is required for musl <sys/statfs.h> */
  18. #ifndef _POSIX_SOURCE
  19. #define _POSIX_SOURCE
  20. #include_next <sys/statfs.h>
  21. /* limiting influence of _POSIX_SOURCE */
  22. #undef _POSIX_SOURCE
  23. #else /* def _POSIX_SOURCE */
  24. #include_next <sys/statfs.h>
  25. #endif
  26. #else
  27. struct statfs
  28. {
  29. size_t f_bsize; /* block size */
  30. size_t f_blocks; /* total data blocks in file system */
  31. size_t f_bfree; /* free blocks in file system */
  32. size_t f_bavail; /* free blocks available to unprivileged user*/
  33. };
  34. int statfs(const char *path, struct statfs *buf);
  35. int fstatfs(int fd, struct statfs *buf);
  36. #endif
  37. #ifdef __cplusplus
  38. }
  39. #endif
  40. #endif