FSTATVFS(3POSIX)
π FSTATVFS(3POSIX) π
okay so bestie, this one lives in the POSIX Programmer's Manual (yes, the whole POSIX Programmer's Manual, we're fancy like that) β¨
π«Ά PROLOG π«Ά
real talk before we even start: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the deets on Linux behavior, bestie), or the interface may not be implemented on Linux at all. no cap. π
β¨ NAME β¨
fstatvfs, statvfs β get file system information π
π SYNOPSIS π
#include <sys/statvfs.h>
int fstatvfs(int fildes, struct statvfs *buf);
int statvfs(const char *restrict path, struct statvfs *restrict buf);
π DESCRIPTION π
okay so here's the tea. the fstatvfs() function shall obtain information about the file system containing the file referenced by fildes. π¦
the statvfs() function shall obtain information about the file system containing the file named by path. π
for both functions, the buf argument is a pointer to a statvfs structure that shall be filled. and listen β read, write, or execute permission of the named file is not required. we love a low-effort icon. π₯
the following flags can be returned in the f_flag member:
ST_RDONLYβ read-only file system. it's giving "look but don't touch" πST_NOSUIDβ setuid/setgid bits ignored byexec. the bits are literally being ghosted π
it is unspecified whether all members of the statvfs structure have meaningful values on all file systems. so like... some of them might just be vibes. don't come for me. π
β RETURN VALUE β
upon successful completion, statvfs() shall return 0. otherwise, it shall return -1 and set errno to indicate the error. periodt. π
π ERRORS π
the fstatvfs() and statvfs() functions shall fail if:
EIOβ an I/O error occurred while reading the file system. the file system said "not today" πEINTRβ a signal was caught during execution of the function. rude of it, honestly πEOVERFLOWβ one of the values to be returned cannot be represented correctly in the structure pointed to bybuf. it's too much for the struct, the struct is overwhelmed, relatable πΈ
the fstatvfs() function shall fail if:
EBADFβ thefildesargument is not an open file descriptor. bestie that fd is not fding π§
the statvfs() function shall fail if:
EACCESβ search permission is denied on a component of the path prefix. no entry for you π«ELOOPβ a loop exists in symbolic links encountered during resolution of thepathargument. the symlinks are going in circles fr fr πENAMETOOLONGβ the length of a component of a pathname is longer than{NAME_MAX}. it's giving main character name that's too long for the credits πENOENTβ a component ofpathdoes not name an existing file orpathis an empty string. nothing there. ghost town. πENOTDIRβ a component of the path prefix names an existing file that is neither a directory nor a symbolic link to a directory, or thepathargument contains at least one non-<slash>character and ends with one or more trailing<slash>characters and the last pathname component names an existing file that is neither a directory nor a symbolic link to a directory. (yes that's the whole sentence, i'm not cutting it, every word is load-bearing π )
the statvfs() function may fail if:
ELOOPβ more than{SYMLOOP_MAX}symbolic links were encountered during resolution of thepathargument. like okay we get it, you're linking πENAMETOOLONGβ the length of a pathname exceeds{PATH_MAX}, or pathname resolution of a symbolic link produced an intermediate result with a length that exceeds{PATH_MAX}. too long. iconic behavior honestly but no β
the following sections are informative. (aka: the lore, not the law π)
πΈ EXAMPLES πΈ
π Obtaining File System Information Using fstatvfs()
the following example shows how to obtain file system information for the file system upon which the file named /home/cnd/mod1 resides, using the fstatvfs() function. the /home/cnd/mod1 file is opened with read/write privileges and the open file descriptor is passed to the fstatvfs() function. π
#include <sys/statvfs.h>
#include <fcntl.h>
struct statvfs buffer;
int status;
...
fildes = open("/home/cnd/mod1", O_RDWR);
status = fstatvfs(fildes, &buffer);
π¦ Obtaining File System Information Using statvfs()
the following example shows how to obtain file system information for the file system upon which the file named /home/cnd/mod1 resides, using the statvfs() function. π
#include <sys/statvfs.h>
struct statvfs buffer;
int status;
...
status = statvfs("/home/cnd/mod1", &buffer);
π APPLICATION USAGE π
None. nothing. empty. the silence is the message. π«Ά
β RATIONALE β
None. no thoughts, head empty, standard says nothing, we move π
π FUTURE DIRECTIONS π
None. the future is unspecified and honestly? slay. β¨
π₯ SEE ALSO π₯
chmod(), chown(), creat(), dup(), exec, fcntl(), link(), mknod(), open(), pipe(), read(), time(), unlink(), utime(), write() π
the Base Definitions volume of POSIX.1β2017, <sys_statvfs.h> π
π COPYRIGHT π
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 . π
okay that's the whole page bestie, and the sign-off is literally IEEE/The Open Group, 2017 β that's the source and the date, we're giving them their flowers π, and the page itself is FSTATVFS(3POSIX) if you ever need to summon it again. go forth and statvfs() responsibly, mwah ππ¦β¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms