Manual Pages for Linux CentOS command on man fstatfs
MyWebUniversity

Manual Pages for Linux CentOS command on man fstatfs

STATFS(2) Linux Programmer's Manual STATFS(2)

NAME

statfs, fstatfs - get file system statistics SYNOPSIS

#include /* or */ int statfs(const char *path, struct statfs *buf); int fstatfs(int fd, struct statfs *buf); DESCRIPTION The function statfs() returns information about a mounted file system. path is the pathname of any file within the mounted file system. buf is a pointer to a statfs structure defined approximately as follows:

#if WORDSIZE == 32 /* System word size */

# define SWORDTYPE int

#else /* WORDSIZE == 64 */

# define SWORDTYPE long int

#endif struct statfs { SWORDTYPE ftype; /* type of file system (see below) */ SWORDTYPE fbsize; /* optimal transfer block size */ fsblkcntt fblocks; /* total data blocks in file system */ fsblkcntt fbfree; /* free blocks in fs */ fsblkcntt fbavail; /* free blocks available to unprivileged user */ fsfilcntt ffiles; /* total file nodes in file system */ fsfilcntt fffree; /* free file nodes in fs */ fsidt ffsid; /* file system id */ SWORDTYPE fnamelen; /* maximum length of filenames */ SWORDTYPE ffrsize; /* fragment size (since Linux 2.6) */ SWORDTYPE fspare[5]; }; File system types: ADFSSUPERMAGIC 0xadf5 AFFSSUPERMAGIC 0xADFF BEFSSUPERMAGIC 0x42465331 BFSMAGIC 0x1BADFACE CIFSMAGICNUMBER 0xFF534D42 CODASUPERMAGIC 0x73757245 COHSUPERMAGIC 0x012FF7B7 CRAMFSMAGIC 0x28cd3d45 DEVFSSUPERMAGIC 0x1373 EFSSUPERMAGIC 0x00414A53 EXTSUPERMAGIC 0x137D EXT2OLDSUPERMAGIC 0xEF51 EXT2SUPERMAGIC 0xEF53 EXT3SUPERMAGIC 0xEF53 EXT4SUPERMAGIC 0xEF53 HFSSUPERMAGIC 0x4244 HPFSSUPERMAGIC 0xF995E849 HUGETLBFSMAGIC 0x958458f6 ISOFSSUPERMAGIC 0x9660 JFFS2SUPERMAGIC 0x72b6 JFSSUPERMAGIC 0x3153464a MINIXSUPERMAGIC 0x137F /* orig. minix */ MINIXSUPERMAGIC2 0x138F /* 30 char minix */ MINIX2SUPERMAGIC 0x2468 /* minix V2 */ MINIX2SUPERMAGIC2 0x2478 /* minix V2, 30 char names */ MSDOSSUPERMAGIC 0x4d44 NCPSUPERMAGIC 0x564c NFSSUPERMAGIC 0x6969 NTFSSBMAGIC 0x5346544e OPENPROMSUPERMAGIC 0x9fa1 PROCSUPERMAGIC 0x9fa0 QNX4SUPERMAGIC 0x002f REISERFSSUPERMAGIC 0x52654973 ROMFSMAGIC 0x7275 SMBSUPERMAGIC 0x517B SYSV2SUPERMAGIC 0x012FF7B6 SYSV4SUPERMAGIC 0x012FF7B5 TMPFSMAGIC 0x01021994 UDFSUPERMAGIC 0x15013346 UFSMAGIC 0x00011954 USBDEVICESUPERMAGIC 0x9fa2 VXFSSUPERMAGIC 0xa501FCF5 XENIXSUPERMAGIC 0x012FF7B4 XFSSUPERMAGIC 0x58465342 XIAFSSUPERMAGIC 0x012FD16D Nobody knows what ffsid is supposed to contain (but see below). Fields that are undefined for a particular file system are set to 0. fstatfs() returns the same information about an open file referenced by descriptor fd. RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS EACCES (statfs()) Search permission is denied for a component of the path prefix of path. (See also pathresolution(7).) EBADF (fstatfs()) fd is not a valid open file descriptor. EFAULT buf or path points to an invalid address. EINTR This call was interrupted by a signal. EIO An I/O error occurred while reading from the file system. ELOOP (statfs()) Too many symbolic links were encountered in translat‐ ing path. ENAMETOOLONG (statfs()) path is too long. ENOENT (statfs()) The file referred to by path does not exist. ENOMEM Insufficient kernel memory was available. ENOSYS The file system does not support this call. ENOTDIR (statfs()) A component of the path prefix of path is not a directory. EOVERFLOW Some values were too large to be represented in the returned struct. CONFORMING TO

Linux-specific. The Linux statfs() was inspired by the 4.4BSD one (but they do not use the same structure). NOTES The original Linux statfs() and fstatfs() system calls were not designed with extremely large file sizes in mind. Subsequently, Linux 2.6 added new statfs64() and fstatfs64() system calls that employ a new structure, statfs64. The new structure contains the same fields as the original statfs structure, but the sizes of various fields are increased, to accommodate large file sizes. The glibc statfs() and fstatfs() wrapper functions transparently deal with the kernel differ‐ ences. Some systems only have , other systems also have , where the former includes the latter. So it seems including the former is the best choice. LSB has deprecated the library calls statfs() and fstatfs() and tells us to use statvfs(2) and fstatvfs(2) instead. The ffsid field Solaris, Irix and POSIX have a system call statvfs(2) that returns a struct statvfs (defined in ) containing an unsigned long

ffsid. Linux, SunOS, HP-UX, 4.4BSD have a system call statfs() that returns a struct statfs (defined in ) containing a fsidt ffsid, where fsidt is defined as struct { int val[2]; }. The same holds for FreeBSD, except that it uses the include file . The general idea is that ffsid contains some random stuff such that the pair (ffsid,ino) uniquely determines a file. Some operating sys‐ tems use (a variation on) the device number, or the device number com‐

bined with the file-system type. Several OSes restrict giving out the ffsid field to the superuser only (and zero it for unprivileged users), because this field is used in the filehandle of the file system

when NFS-exported, and giving it out is a security concern. Under some operating systems the fsid can be used as second argument to the sysfs(2) system call. SEE ALSO stat(2), statvfs(2), pathresolution(7) COLOPHON

This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can

be found at http://www.kernel.org/doc/man-pages/.

Linux 2010-11-21 STATFS(2)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™