Skip to content

Commit 6b7c18d

Browse files
JohanEngelendlang-bot
authored andcommitted
Add correct statvfs_t for Musl.
1 parent 3e92cca commit 6b7c18d

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

druntime/src/core/sys/posix/sys/statvfs.d

+50
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,57 @@ version (CRuntime_Glibc) {
8484
int statvfs (const char * file, statvfs_t* buf);
8585
int fstatvfs (int fildes, statvfs_t *buf);
8686
}
87+
}
88+
else version (CRuntime_Musl)
89+
{
90+
struct statvfs_t
91+
{
92+
c_ulong f_bsize;
93+
c_ulong f_frsize;
94+
fsblkcnt_t f_blocks;
95+
fsblkcnt_t f_bfree;
96+
fsblkcnt_t f_bavail;
97+
fsfilcnt_t f_files;
98+
fsfilcnt_t f_ffree;
99+
fsfilcnt_t f_favail;
100+
static if (true /+__BYTE_ORDER == __LITTLE_ENDIAN+/)
101+
{
102+
c_ulong f_fsid;
103+
byte[2*int.sizeof-c_long.sizeof] __padding;
104+
}
105+
else
106+
{
107+
byte[2*int.sizeof-c_long.sizeof] __padding;
108+
c_ulong f_fsid;
109+
}
110+
c_ulong f_flag;
111+
c_ulong f_namemax;
112+
uint f_type;
113+
int[5] __reserved;
114+
}
115+
116+
enum FFlag
117+
{
118+
ST_RDONLY = 1, /* Mount read-only. */
119+
ST_NOSUID = 2,
120+
ST_NODEV = 4, /* Disallow access to device special files. */
121+
ST_NOEXEC = 8, /* Disallow program execution. */
122+
ST_SYNCHRONOUS = 16, /* Writes are synced at once. */
123+
ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */
124+
ST_WRITE = 128, /* Write on file/directory/symlink. */
125+
ST_APPEND = 256, /* Append-only file. */
126+
ST_IMMUTABLE = 512, /* Immutable file. */
127+
ST_NOATIME = 1024, /* Do not update access times. */
128+
ST_NODIRATIME = 2048, /* Do not update directory access times. */
129+
ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */
130+
131+
}
132+
133+
int statvfs (const char * file, statvfs_t* buf);
134+
int fstatvfs (int fildes, statvfs_t *buf);
87135

136+
alias statvfs statvfs64;
137+
alias fstatvfs fstatvfs64;
88138
}
89139
else version (NetBSD)
90140
{

0 commit comments

Comments
 (0)