statvfs(3) Library Functions Manual statvfs(3) statvfs, fstatvfs - LIBRARY Standard C library (libc, -lc) #include int statvfs(const char *restrict path, struct statvfs *restrict buf); int fstatvfs(int fd, struct statvfs *buf); statvfs() . path , . buf statvfs, : struct statvfs { unsigned long f_bsize; /* */ unsigned long f_frsize; /* */ fsblkcnt_t f_blocks; /* f_frsize */ fsblkcnt_t f_bfree; /* */ fsblkcnt_t f_bavail; /* */ fsfilcnt_t f_files; /* inodes */ fsfilcnt_t f_ffree; /* inodes */ fsfilcnt_t f_favail; /* inodes */ unsigned long f_fsid; /* */ unsigned long f_flag; /* */ unsigned long f_namemax; /* */ }; fsblkcnt_t fsfilcnt_t . unsigned long. f_flag -- , . : ST_MANDLOCK (mandatory) ( fcntl(2)). ST_NOATIME ; mount(2). ST_NODEV . ST_NODIRATIME ; mount(2). ST_NOEXEC . ST_NOSUID set-user-ID set-group-ID exec(3) . ST_RDONLY . ST_RELATIME atime mtime/ctime; mount(2). ST_SYNCHRONOUS ( O_SYNC open(2)). , . fstatvfs() fd. On success, zero is returned. On error, -1 is returned, and errno is set to indicate the error. EACCES (statvfs()) path (. path_resolution(7)). EBADF (fstatvfs()) fd . EFAULT Buf path . EINTR ; signal(7). EIO -. ELOOP (statvfs()) path. ENAMETOOLONG (statvfs()) path. ENOENT (statvfs()) , path, . ENOMEM . ENOSYS . ENOTDIR (statvfs()) path . EOVERFLOW , . attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |statvfs(), fstatvfs() | | MT-Safe | +----------------------------+----------------------------------------------------------+--------------------------+ POSIX.1 f_flag ST_NOSUID ST_RDONLY. _GNU_SOURCE. Linux statfs(2) fstatfs(2). glibc pathconf(path, _PC_REC_XFER_ALIGN); pathconf(path, _PC_ALLOC_SIZE_MIN); pathconf(path, _PC_REC_MIN_XFER_SIZE); , , f_frsize, f_frsize f_bsize, statvfs() path. Under Linux, f_favail is always the same as f_ffree, and there's no way for a filesystem to report otherwise. This is not an issue, since no filesystems with an inode root reservation exist. POSIX.1-2008. POSIX.1-2001. Before glibc 2.13, statvfs() populated the bits of the f_flag field by scanning the mount options shown in /proc/mounts. However, starting with Linux 2.6.36, the underlying statfs(2) system call provides the necessary information via the f_flags field, and since glibc 2.13, the statvfs() function will use information from that field rather than scanning /proc/mounts. . statfs(2) Alexander Golubev , Azamat Hackimov , Hotellook, Nikita , Spiros Georgaras , Vladislav , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . statvfs(3)