]> git.ipfire.org Git - thirdparty/gcc.git/blob - libphobos/libdruntime/core/sys/posix/sys/statvfs.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / libphobos / libdruntime / core / sys / posix / sys / statvfs.d
1 /++
2 D header file correspoding to sys/statvfs.h.
3
4 Copyright: Copyright 2012 -
5 License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
6 Authors: Robert Klotzner and $(HTTP jmdavisprog.com, Jonathan M Davis)
7 Standards: $(HTTP http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_statvfs.h.html,
8 The Open Group Base Specifications Issue 7 IEEE Std 1003.1, 2018 Edition)
9 +/
10 module core.sys.posix.sys.statvfs;
11 private import core.stdc.config;
12 private import core.sys.posix.config;
13 public import core.sys.posix.sys.types;
14
15 version (Posix):
16 extern (C) :
17 nothrow:
18 @nogc:
19
20 version (CRuntime_Glibc) {
21 static if (__WORDSIZE == 32)
22 {
23 version=_STATVFSBUF_F_UNUSED;
24 }
25 struct statvfs_t
26 {
27 c_ulong f_bsize;
28 c_ulong f_frsize;
29 fsblkcnt_t f_blocks;
30 fsblkcnt_t f_bfree;
31 fsblkcnt_t f_bavail;
32 fsfilcnt_t f_files;
33 fsfilcnt_t f_ffree;
34 fsfilcnt_t f_favail;
35 c_ulong f_fsid;
36 version (_STATVFSBUF_F_UNUSED)
37 {
38 int __f_unused;
39 }
40 c_ulong f_flag;
41 c_ulong f_namemax;
42 int[6] __f_spare;
43 }
44 /* Definitions for the flag in `f_flag'. These definitions should be
45 kept in sync with the definitions in <sys/mount.h>. */
46 static if (__USE_GNU)
47 {
48 enum FFlag
49 {
50 ST_RDONLY = 1, /* Mount read-only. */
51 ST_NOSUID = 2,
52 ST_NODEV = 4, /* Disallow access to device special files. */
53 ST_NOEXEC = 8, /* Disallow program execution. */
54 ST_SYNCHRONOUS = 16, /* Writes are synced at once. */
55 ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */
56 ST_WRITE = 128, /* Write on file/directory/symlink. */
57 ST_APPEND = 256, /* Append-only file. */
58 ST_IMMUTABLE = 512, /* Immutable file. */
59 ST_NOATIME = 1024, /* Do not update access times. */
60 ST_NODIRATIME = 2048, /* Do not update directory access times. */
61 ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */
62
63 }
64 } /* Use GNU. */
65 else
66 { // Posix defined:
67 enum FFlag
68 {
69 ST_RDONLY = 1, /* Mount read-only. */
70 ST_NOSUID = 2
71 }
72 }
73
74 static if ( __USE_FILE_OFFSET64 )
75 {
76 int statvfs64 (const char * file, statvfs_t* buf);
77 alias statvfs64 statvfs;
78
79 int fstatvfs64 (int fildes, statvfs_t *buf) @trusted;
80 alias fstatvfs64 fstatvfs;
81 }
82 else
83 {
84 int statvfs (const char * file, statvfs_t* buf);
85 int fstatvfs (int fildes, statvfs_t *buf);
86 }
87
88 }
89 else version (NetBSD)
90 {
91 enum _VFS_MNAMELEN = 1024;
92 enum _VFS_NAMELEN = 32;
93
94 struct fsid_t
95 {
96 int[2] __fsid_val;
97 }
98
99 struct statvfs_t
100 {
101 c_ulong f_flag;
102 c_ulong f_bsize;
103 c_ulong f_frsize;
104 c_ulong f_iosize;
105 fsblkcnt_t f_blocks;
106 fsblkcnt_t f_bfree;
107 fsblkcnt_t f_bavail;
108 fsblkcnt_t f_bresvd;
109 fsfilcnt_t f_files;
110 fsfilcnt_t f_ffree;
111 fsfilcnt_t f_favail;
112 fsfilcnt_t f_fresvd;
113 ulong f_syncreads;
114 ulong f_syncwrites;
115 ulong f_asyncreads;
116 ulong f_asyncwrites;
117 fsid_t f_fsidx;
118 c_ulong f_fsid;
119 c_ulong f_namemax;
120 int f_owner;
121 int[4] f_spare;
122 char[_VFS_NAMELEN] f_fstypename;
123 char[_VFS_MNAMELEN] f_mntonname;
124 char[_VFS_MNAMELEN] f_mntfromname;
125 }
126
127 enum FFlag
128 {
129 ST_RDONLY = 1, /* Mount read-only. */
130 ST_NOSUID = 2
131 }
132
133 int statvfs (const char * file, statvfs_t* buf);
134 int fstatvfs (int fildes, statvfs_t *buf) @trusted;
135 }
136 else version (FreeBSD)
137 {
138 import core.sys.freebsd.sys.mount;
139
140 // @@@DEPRECATED_2.091@@@
141 deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h")
142 alias MFSNAMELEN = core.sys.freebsd.sys.mount.MFSNAMELEN;
143
144 // @@@DEPRECATED_2.091@@@
145 deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h")
146 alias MNAMELEN = core.sys.freebsd.sys.mount.MNAMELEN;
147
148 // @@@DEPRECATED_2.091@@@
149 deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h")
150 alias fsid_t = core.sys.freebsd.sys.mount.fsid_t;
151
152 // @@@DEPRECATED_2.091@@@
153 deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h")
154 alias statfs_t = core.sys.freebsd.sys.mount.statfs_t;
155
156 // @@@DEPRECATED_2.091@@@
157 deprecated("Values moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h")
158 enum FFlag
159 {
160 // @@@DEPRECATED_2.091@@@
161 MNT_RDONLY = 1, /* read only filesystem */
162
163 // @@@DEPRECATED_2.091@@@
164 MNT_SYNCHRONOUS = 2, /* fs written synchronously */
165
166 // @@@DEPRECATED_2.091@@@
167 MNT_NOEXEC = 4, /* can't exec from filesystem */
168
169 // @@@DEPRECATED_2.091@@@
170 MNT_NOSUID = 8, /* don't honor setuid fs bits */
171
172 // @@@DEPRECATED_2.091@@@
173 MNT_NFS4ACLS = 16, /* enable NFS version 4 ACLs */
174
175 // @@@DEPRECATED_2.091@@@
176 MNT_UNION = 32, /* union with underlying fs */
177
178 // @@@DEPRECATED_2.091@@@
179 MNT_ASYNC = 64, /* fs written asynchronously */
180
181 // @@@DEPRECATED_2.091@@@
182 MNT_SUIDDIR = 128, /* special SUID dir handling */
183
184 // @@@DEPRECATED_2.091@@@
185 MNT_SOFTDEP = 256, /* using soft updates */
186
187 // @@@DEPRECATED_2.091@@@
188 MNT_NOSYMFOLLOW = 512, /* do not follow symlinks */
189
190 // @@@DEPRECATED_2.091@@@
191 MNT_GJOURNAL = 1024, /* GEOM journal support enabled */
192
193 // @@@DEPRECATED_2.091@@@
194 MNT_MULTILABEL = 2048, /* MAC support for objects */
195
196 // @@@DEPRECATED_2.091@@@
197 MNT_ACLS = 4096, /* ACL support enabled */
198
199 // @@@DEPRECATED_2.091@@@
200 MNT_NOATIME = 8192, /* dont update file access time */
201
202 // @@@DEPRECATED_2.091@@@
203 MNT_NOCLUSTERR = 16384, /* disable cluster read */
204
205 // @@@DEPRECATED_2.091@@@
206 MNT_NOCLUSTERW = 32768, /* disable cluster write */
207
208 // @@@DEPRECATED_2.091@@@
209 MNT_SUJ = 65536, /* using journaled soft updates */
210
211 // @@@DEPRECATED_2.091@@@
212 MNT_AUTOMOUNTED = 131072 /* mounted by automountd(8) */
213 }
214
215 deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h")
216 alias statfs = core.sys.freebsd.sys.mount.statfs;
217
218 deprecated("Moved to core.sys.freebsd.sys.mount to correspond to C header file sys/mount.h")
219 alias fstatfs = core.sys.freebsd.sys.mount.fstatfs;
220
221 struct statvfs_t
222 {
223 fsblkcnt_t f_bavail;
224 fsblkcnt_t f_bfree;
225 fsblkcnt_t f_blocks;
226 fsfilcnt_t f_favail;
227 fsfilcnt_t f_ffree;
228 fsfilcnt_t f_files;
229 ulong f_bsize;
230 ulong f_flag;
231 ulong f_frsize;
232 ulong f_fsid;
233 ulong f_namemax;
234 }
235
236 enum uint ST_RDONLY = 0x1;
237 enum uint ST_NOSUID = 0x2;
238
239 int fstatvfs(int, statvfs_t*);
240 int statvfs(const char*, statvfs_t*);
241 }
242 else
243 {
244 struct statvfs_t
245 {
246 c_ulong f_bsize;
247 c_ulong f_frsize;
248 fsblkcnt_t f_blocks;
249 fsblkcnt_t f_bfree;
250 fsblkcnt_t f_bavail;
251 fsfilcnt_t f_files;
252 fsfilcnt_t f_ffree;
253 fsfilcnt_t f_favail;
254 c_ulong f_fsid;
255 c_ulong f_flag;
256 c_ulong f_namemax;
257 }
258
259 enum FFlag
260 {
261 ST_RDONLY = 1, /* Mount read-only. */
262 ST_NOSUID = 2
263 }
264
265 int statvfs (const char * file, statvfs_t* buf);
266 int fstatvfs (int fildes, statvfs_t *buf) @trusted;
267 }