µ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++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2018-2025 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software
6 * for any purpose is hereby granted, under the terms of the MIT license.
7 *
8 * If a copy of the license was not distributed with this file, it can
9 * be obtained from https://opensource.org/licenses/mit.
10 */
11
12#ifndef POSIX_IO_SYS_STATVFS_H_
13#define POSIX_IO_SYS_STATVFS_H_
14
15// ----------------------------------------------------------------------------
16
17#include <unistd.h>
18
19#if defined(_POSIX_VERSION)
20
21#pragma GCC diagnostic push
22#if defined(__clang__)
23#pragma clang diagnostic ignored "-Wgnu-include-next"
24#endif
25#include_next <sys/statvfs.h>
26#pragma GCC diagnostic pop
27
28#else
29
30#include <sys/types.h>
31
32#ifdef __cplusplus
33extern "C"
34{
35#endif
36
37// ----------------------------------------------------------------------------
38
39// Read-only file system.
40#define ST_RDONLY 0x00000001
41
42// Does not support the semantics of the ST_ISUID and ST_ISGID file mode bits.
43#define ST_NOSUID 0x00000002
44
45 struct statvfs
46 {
47 unsigned long f_bsize; // File system block size.
48 unsigned long f_frsize; // Fundamental file system block size.
49 fsblkcnt_t f_blocks; // Total number of blocks on file system in units of
50 // f_frsize.
51 fsblkcnt_t f_bfree; // Total number of free blocks.
52 fsblkcnt_t
53 f_bavail; // Number of free blocks available to non-privileged process.
54 fsfilcnt_t f_files; // Total number of file serial numbers.
55 fsfilcnt_t f_ffree; // Total number of free file serial numbers.
56 fsfilcnt_t f_favail; // Number of file serial numbers available to
57 // non-privileged process.
58 unsigned long f_fsid; // File system ID.
59 unsigned long f_flag; // Bit mask of f_flag values.
60 unsigned long f_namemax; // Maximum filename length.
61 };
62
63 int
64 fstatvfs (int fildes, struct statvfs* buf);
65
66#pragma GCC diagnostic push
67#if defined(__clang__)
68#elif defined(__GNUC__)
69#pragma GCC diagnostic ignored "-Wshadow"
70#endif
71
72 int
73 statvfs (const char* path, struct statvfs* buf);
74
75 // --------------------------------------------------------------------------
76
77#pragma GCC diagnostic pop
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif /* defined(_POSIX_VERSION) */
84
85#endif /* POSIX_IO_SYS_STATVFS_H_ */
int fstatvfs(int fildes, struct statvfs *buf)
unsigned long f_namemax
Definition statvfs.h:60
unsigned long f_fsid
Definition statvfs.h:58
unsigned long f_bsize
Definition statvfs.h:47
fsblkcnt_t f_bavail
Definition statvfs.h:53
fsfilcnt_t f_files
Definition statvfs.h:54
fsfilcnt_t f_ffree
Definition statvfs.h:55
fsfilcnt_t f_favail
Definition statvfs.h:56
fsblkcnt_t f_blocks
Definition statvfs.h:49
fsblkcnt_t f_bfree
Definition statvfs.h:51
unsigned long f_flag
Definition statvfs.h:59
unsigned long f_frsize
Definition statvfs.h:48