File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
libc/src/sys/statvfs/linux Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,10 @@ using LinuxStatFs = statfs;
26
26
#endif
27
27
28
28
LIBC_INLINE cpp::optional<LinuxStatFs> linux_statfs (const char *path) {
29
- #ifdef __clang__
30
- // Disable pattern filling for result buffer: this struct is to be populated
31
- // by the syscall.
32
- [[clang::uninitialized]]
33
- #endif
29
+ // The kernel syscall routine checks the validity of the path before filling
30
+ // the statfs structure. So, it is possible that the result is not initialized
31
+ // after the syscall. Since the struct is trvial, the compiler will generate
32
+ // pattern filling for the struct.
34
33
LinuxStatFs result;
35
34
// On 32-bit platforms, original statfs cannot handle large file systems.
36
35
// In such cases, SYS_statfs64 is defined and should be used.
@@ -47,6 +46,10 @@ LIBC_INLINE cpp::optional<LinuxStatFs> linux_statfs(const char *path) {
47
46
}
48
47
49
48
LIBC_INLINE cpp::optional<LinuxStatFs> linux_fstatfs (int fd) {
49
+ // The kernel syscall routine checks the validity of the path before filling
50
+ // the statfs structure. So, it is possible that the result is not initialized
51
+ // after the syscall. Since the struct is trvial, the compiler will generate
52
+ // pattern filling for the struct.
50
53
LinuxStatFs result;
51
54
// On 32-bit platforms, original fstatfs cannot handle large file systems.
52
55
// In such cases, SYS_fstatfs64 is defined and should be used.
You can’t perform that action at this time.
0 commit comments