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 11 #ifndef __SYS_STATFS_H__ 12 #define __SYS_STATFS_H__ 13 14 #include <stddef.h> 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 #ifdef RT_USING_MUSLLIBC 21 /* this is required for musl <sys/statfs.h> */ 22 #ifndef _POSIX_SOURCE 23 #define _POSIX_SOURCE 24 #include_next <sys/statfs.h> 25 /* limiting influence of _POSIX_SOURCE */ 26 #undef _POSIX_SOURCE 27 28 #else /* def _POSIX_SOURCE */ 29 #include_next <sys/statfs.h> 30 #endif 31 #else 32 struct statfs 33 { 34 size_t f_bsize; /* block size */ 35 size_t f_blocks; /* total data blocks in file system */ 36 size_t f_bfree; /* free blocks in file system */ 37 size_t f_bavail; /* free blocks available to unprivileged user*/ 38 }; 39 40 int statfs(const char *path, struct statfs *buf); 41 int fstatfs(int fd, struct statfs *buf); 42 43 #endif 44 45 #ifdef __cplusplus 46 } 47 #endif 48 49 #endif 50