sys_statvfs.h(0P)

πŸ’– sys_statvfs.h β€” VFS File System information structure πŸ’–

okay bestie, welcome to the <sys/statvfs.h> glow-up ✨ this is the header that spills all the tea about your file system's vibe β€” how big the blocks are, how many are free, who's allowed to touch what. it's giving "filesystem receipts" and honestly? iconic. it lives in the POSIX Programmer's Manual (that's sys_statvfs.h(0P), for the record πŸŽ€).


🌸 PROLOG 🌸

so like, real talk before we dive in: this manual page is part of the POSIX Programmer's Manual. but heads up babes β€” the Linux implementation of this interface may differ (so go check the corresponding Linux manual page for the deets on Linux behavior), or the interface might not even be implemented on Linux at all 😭. no cap, always double-check.


✨ NAME ✨

sys/statvfs.h β€” VFS File System information structure πŸ¦‹


🫢 SYNOPSIS 🫢

#include <sys/statvfs.h>

that's it. that's the whole vibe. one include and you're in πŸ’…


πŸ‘‘ DESCRIPTION πŸ‘‘

okay so the <sys/statvfs.h> header shall define the statvfs structure, and that struct has to include at least these members (yes, at least β€” there could be more, main character energy):

unsigned long f_bsize    File system block size.
unsigned long f_frsize   Fundamental file system block size.
fsblkcnt_t    f_blocks   Total number of blocks on file system in units of f_frsize.
fsblkcnt_t    f_bfree    Total number of free blocks.
fsblkcnt_t    f_bavail   Number of free blocks available to
                         non-privileged process.
fsfilcnt_t    f_files    Total number of file serial numbers.
fsfilcnt_t    f_ffree    Total number of free file serial numbers.
fsfilcnt_t    f_favail   Number of file serial numbers available to
                         non-privileged process.
unsigned long f_fsid     File system ID.
unsigned long f_flag     Bit mask of f_flag values.
unsigned long f_namemax  Maximum filename length.
  • f_bsize β€” file system block size, literally the size of a block πŸ“
  • f_frsize β€” the fundamental file system block size, the base unit of the whole operation
  • f_blocks β€” total blocks on the file system, measured in units of f_frsize
  • f_bfree β€” total free blocks
  • f_bavail β€” free blocks available to a non-privileged process (so like, not root)
  • f_files β€” total number of file serial numbers
  • f_ffree β€” total free file serial numbers
  • f_favail β€” file serial numbers available to a non-privileged process
  • f_fsid β€” the file system ID, its little name tag 🏷️
  • f_flag β€” a bit mask of f_flag values
  • f_namemax β€” the maximum filename length, so you know how long you can go before it's too much πŸ’€

also, the <sys/statvfs.h> header shall define the fsblkcnt_t and fsfilcnt_t types, exactly as described in <sys/types.h>.

and it shall define these symbolic constants for the f_flag member:

  • ST_RDONLY β€” read-only file system. look but don't touch, periodt πŸš«βœ‹
  • ST_NOSUID β€” does not support the semantics of the ST_ISUID and ST_ISGID file mode bits.

these next ones shall be declared as functions and may also be defined as macros. function prototypes shall be provided:

int fstatvfs(int, struct statvfs *);
int statvfs(const char *restrict, struct statvfs *restrict);
ngl the following sections are marked as informative β€” so they're not the binding part, they're just the commentary track 🎧

πŸŽ€ APPLICATION USAGE πŸŽ€

None. (yes fr, nothing here. it said what it said πŸ™ˆ)


πŸ’œ RATIONALE πŸ’œ

None. (again β€” zero notes, the standard was feeling mysterious ✨)


🌈 FUTURE DIRECTIONS 🌈

None. (no glow-up planned, the future is now bestie πŸ’…)


⭐ SEE ALSO ⭐

  • <sys_types.h>
  • The System Interfaces volume of POSIX.1‐2017, fstatvfs()

okay legal bestie, we gotta do this part properly, no skipping 🫢

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page bestie!! πŸ¦‹βœ¨ this icon was brought to you by IEEE/The Open Group, circa 2017 β€” yeah she's been on the scene a minute but she still eats πŸ’…πŸ‘‘ mwah, go check your filesystem stats, ily 🫢

πŸ“¦ where this page comes from