.\" Copyright (c) 1989, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)statfs.2 6.5 (Berkeley) 7/23/91 .\" .\" Modified Sat Jul 24 11:27:31 1993 by Rik Faith (faith@cs.unc.edu) .\" .TH STATFS 2 "21 August 1997" "Linux 2.0.30" "Linux Programmer's Manual" .SH NAME statfs, fstatfs \- get file system statistics .SH SYNOPSIS .B #include .sp .BI "int statfs(const char *" path ", struct statfs *" buf ); .br .BI "int fstatfs(int " fd ", struct statfs *" buf ); .SH DESCRIPTION .B statfs returns information about a mounted file system. .I path is the path name of any file within the mounted filesystem. .I buf is a pointer to a .I statfs structure defined as follows: .RS .nf struct statfs { long f_type; /* type of filesystem (see below) */ long f_bsize; /* optimal transfer block size */ long f_blocks; /* total data blocks in file system */ long f_bfree; /* free blocks in fs */ long f_bavail; /* free blocks avail to non-superuser */ long f_files; /* total file nodes in file system */ long f_ffree; /* free file nodes in fs */ fsid_t f_fsid; /* file system id */ long f_namelen; /* maximum length of filenames */ long f_spare[6]; /* spare for later */ }; File system types: linux/affs_fs.h: AFFS_SUPER_MAGIC 0xADFF linux/ext_fs.h: EXT_SUPER_MAGIC 0x137D linux/ext2_fs.h: EXT2_OLD_SUPER_MAGIC 0xEF51 EXT2_SUPER_MAGIC 0xEF53 linux/hpfs_fs.h: HPFS_SUPER_MAGIC 0xF995E849 linux/iso_fs.h: ISOFS_SUPER_MAGIC 0x9660 linux/minix_fs.h: MINIX_SUPER_MAGIC 0x137F /* orig. minix */ MINIX_SUPER_MAGIC2 0x138F /* 30 char minix */ MINIX2_SUPER_MAGIC 0x2468 /* minix V2 */ MINIX2_SUPER_MAGIC2 0x2478 /* minix V2, 30 char names */ linux/msdos_fs.h: MSDOS_SUPER_MAGIC 0x4d44 linux/ncp_fs.h: NCP_SUPER_MAGIC 0x564c linux/nfs_fs.h: NFS_SUPER_MAGIC 0x6969 linux/proc_fs.h: PROC_SUPER_MAGIC 0x9fa0 linux/smb_fs.h: SMB_SUPER_MAGIC 0x517B linux/sysv_fs.h: XENIX_SUPER_MAGIC 0x012FF7B4 SYSV4_SUPER_MAGIC 0x012FF7B5 SYSV2_SUPER_MAGIC 0x012FF7B6 COH_SUPER_MAGIC 0x012FF7B7 linux/ufs_fs.h: UFS_MAGIC 0x00011954 linux/xia_fs.h: _XIAFS_SUPER_MAGIC 0x012FD16D .fi .RE .PP Fields that are undefined for a particular file system are set to \-1. .B fstatfs returns the same information about an open file referenced by descriptor .IR fd . .SH "RETURN VALUE" On success, zero is returned. On error, \-1 is returned, and .I errno is set appropriately. .SH ERRORS For .BR statfs : .TP 0.8i .B ENOTDIR A component of the path prefix of .I path is not a directory. .TP .B ENAMETOOLONG .I path is too long. .TP .B ENOENT The file referred to by .I path does not exist. .TP .B EACCES Search permission is denied for a component of the path prefix of .IR path . .TP .B ELOOP Too many symbolic links were encountered in translating .IR path . .TP .B EFAULT .I Buf or .I path points to an invalid address. .TP .B EIO An I/O error occurred while reading from or writing to the file system. .TP .B ENOMEM Insufficient kernel memory was available. .TP .B ENOSYS The filesystem .I path is on does not support .BR statfs . .PP For .BR fstatfs : .TP 0.8i .B EBADF .I fd is not a valid open file descriptor. .TP .B EFAULT .I buf points to an invalid address. .TP .B EIO An I/O error occurred while reading from or writing to the file system. .TP .B ENOSYS The filesystem .I fd is open on does not support .BR statfs . .SH "CONFORMING TO" 4.4BSD. .SH "SEE ALSO" .BR stat (2)