µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
statvfs.h
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ distribution.
3 * (https://github.com/micro-os-plus)
4 * Copyright (c) 2018 Liviu Ionescu.
5 *
6 * Permission is hereby granted, free of charge, to any person
7 * obtaining a copy of this software and associated documentation
8 * files (the "Software"), to deal in the Software without
9 * restriction, including without limitation the rights to use,
10 * copy, modify, merge, publish, distribute, sublicense, and/or
11 * sell copies of the Software, and to permit persons to whom
12 * the Software is furnished to do so, subject to the following
13 * conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */
27
28#ifndef POSIX_IO_SYS_STATVFS_H_
29#define POSIX_IO_SYS_STATVFS_H_
30
31// ----------------------------------------------------------------------------
32
33#include <unistd.h>
34
35#if defined(_POSIX_VERSION)
36
37#pragma GCC diagnostic push
38#if defined(__clang__)
39#pragma clang diagnostic ignored "-Wgnu-include-next"
40#endif
41#include_next <sys/statvfs.h>
42#pragma GCC diagnostic pop
43
44#else
45
46#include <sys/types.h>
47
48#ifdef __cplusplus
49extern "C"
50{
51#endif
52
53// ----------------------------------------------------------------------------
54
55// Read-only file system.
56#define ST_RDONLY 0x00000001
57
58// Does not support the semantics of the ST_ISUID and ST_ISGID file mode bits.
59#define ST_NOSUID 0x00000002
60
61 struct statvfs
62 {
63 unsigned long f_bsize; // File system block size.
64 unsigned long f_frsize; // Fundamental file system block size.
65 fsblkcnt_t f_blocks; // Total number of blocks on file system in units of f_frsize.
66 fsblkcnt_t f_bfree; // Total number of free blocks.
67 fsblkcnt_t f_bavail; // Number of free blocks available to non-privileged process.
68 fsfilcnt_t f_files; // Total number of file serial numbers.
69 fsfilcnt_t f_ffree; // Total number of free file serial numbers.
70 fsfilcnt_t f_favail; // Number of file serial numbers available to non-privileged process.
71 unsigned long f_fsid; // File system ID.
72 unsigned long f_flag; // Bit mask of f_flag values.
73 unsigned long f_namemax; // Maximum filename length.
74 };
75
76 int
77 fstatvfs (int fildes, struct statvfs *buf);
78
79#pragma GCC diagnostic push
80#pragma GCC diagnostic ignored "-Wshadow"
81
82 int
83 statvfs (const char* path, struct statvfs* buf);
84
85// ----------------------------------------------------------------------------
86
87#pragma GCC diagnostic pop
88
89#ifdef __cplusplus
90}
91#endif
92
93#endif /* defined(_POSIX_VERSION) */
94
95#endif /* POSIX_IO_SYS_STATVFS_H_ */
int fstatvfs(int fildes, struct statvfs *buf)
unsigned long f_namemax
Definition statvfs.h:73
unsigned long f_fsid
Definition statvfs.h:71
unsigned long f_bsize
Definition statvfs.h:63
fsblkcnt_t f_bavail
Definition statvfs.h:67
fsfilcnt_t f_files
Definition statvfs.h:68
fsfilcnt_t f_ffree
Definition statvfs.h:69
fsfilcnt_t f_favail
Definition statvfs.h:70
fsblkcnt_t f_blocks
Definition statvfs.h:65
fsblkcnt_t f_bfree
Definition statvfs.h:66
unsigned long f_flag
Definition statvfs.h:72
unsigned long f_frsize
Definition statvfs.h:64