*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> standard/statvfs (2)              


statvfs(2)							    statvfs(2)

NAME    [Toc]    [Back]

     statvfs, fstatvfs,	statvfs64, fstatvfs64 -	get file system	information

SYNOPSIS    [Toc]    [Back]

     #include <sys/types.h>
     #include <sys/statvfs.h>

     int statvfs (const	char *path, struct statvfs *buf);

     int statvfs64 (const char *path, struct statvfs64 *buf);

     int fstatvfs (int fildes, struct statvfs *buf);

     int fstatvfs64 (int fildes, struct	statvfs64 *buf);

DESCRIPTION    [Toc]    [Back]

     statvfs returns a ``generic superblock'' describing a file	system;	it can
     be	used to	acquire	information about mounted file systems.	 buf is	a
     pointer to	a structure (described below) that is filled by	the system

     path should name a	file that resides on that file system.	The file
     system type is known to the operating system.  Read, write, or execute
     permission	for the	named file is not required, but	all directories	listed
     in	the path name leading to the file must be searchable.

     The statvfs structure pointed to by buf includes the following members:

	  ulong_t   f_bsize;	   /* preferred	file system block size */
	  ulong_t   f_frsize;	   /* fundamental filesystem block size
				   (if supported) */
	  ulong_t   f_blocks;	   /* total # of blocks	on file	system
				   in units of f_frsize	*/
	  ulong_t   f_bfree;	   /* total # of free blocks */
	  ulong_t   f_bavail;	   /* #	of free	blocks avail to
				   non-superuser */
	  ulong_t   f_files;	   /* total # of file nodes (inodes) */
	  ulong_t   f_ffree;	   /* total # of free file nodes */
	  ulong_t   f_favail;	   /* #	of inodes avail	to
				   non-superuser */
	  ulong_t   f_fsid;		/* file	system id (dev for now)	*/
	  char f_basetype[FSTYPSZ];	/* target file system type name,
				   null-terminated */
	  ulong_t   f_flag;		/* bit mask of flags */
	  ulong_t   f_namemax;		/* maximum file	name length */
	  char f_fstr[32];	   /* file system specific string */
	  ulong_t   f_filler[16];	/* reserved for	future expansion */

     f_basetype	contains a null-terminated FSType name of the mounted target
     (e.g. iso9660 mounted over	nfs will contain iso9660).

									Page 1

statvfs(2)							    statvfs(2)

     The following flags can be	returned in the	f_flag field:

	  ST_RDONLY 0x00000001	   /* read-only	file system */
	  ST_NOSUID 0x00000002	   /* does not support setuid/setgid
				   semantics */
	  ST_NOTRUNC	 0x00000004	/* does	not truncate file names
				   longer than {NAME_MAX} */
	  ST_NODEV  0x20000000	   /* disallow opening of device files */
	  ST_GRPID  0x40000000	   /* group-ID assigned	from directory */
	  ST_LOCAL  0x80000000	   /* local filesystem,	for find */

     fstatvfs is similar to statvfs, except that the file named	by path	in
     statvfs is	instead	identified by an open file descriptor fildes obtained
     from a successful open, creat, dup, fcntl,	or pipe	system call.

     statvfs64 and fstatvfs64 are similar to statvfs and fstatvfs
     respectively, except that the structure fields f_blocks, f_bfree,
     f_bavail, f_files,	f_ffree, and f_favail are 64-bit values	instead	of
     ulong_ts.	The block-count	fields are of type blkcnt_t and	the file-count
     fields are	of type	filcnt_t.  These fields	can normally overflow in a
     non-64-bit	call only in a 32-bit application on an	XFS filesystem whose
     size is larger than 1 terabyte.

     For XFS filesystems with real-time	subvolumes (see	xfs(4)), the
     statvfs(2)	system call returns information	concerning the data portion of
     the filesystem only.  The syssgi(2) system	call with the
     SGI_XFS_FSOPERATIONS request argument can be used to acquire information
     concerning	the size and usage of space within the real-time portion of
     the filesystem.

     The ST_LOCAL flag is off for regular files	which are also swap files,
     since they	cannot be read even if permissions allow it.  This allows
     programs to detect	this situation without trying to read data from	such

     statvfs fails if one or more of the following are true:

     EACCES	    Search permission is denied	on a component of the path

     EFAULT	    path or buf	points outside the process's allocated address

     EINTR	    A signal was caught	during statvfs execution.

     EIO	    An I/O error occurred while	reading	the file system.

     ELOOP	    Too	many symbolic links were encountered in	translating

									Page 2

statvfs(2)							    statvfs(2)

     EMULTIHOP	    Components of path require hopping to multiple remote
		    machines and file system type does not allow it.

     ENAMETOOLONG   The	length of a path component exceeds {NAME_MAX}
		    characters,	or the length of path exceeds {PATH_MAX}

     ENOENT	    Either a component of the path prefix or the file referred
		    to by path does not	exist.

     ENOLINK	    path points	to a remote machine and	the link to that
		    machine is no longer active.

     ENOTDIR	    A component	of the path prefix of path is not a directory.

     fstatvfs fails if one or more of the following are	true:

     EFAULT	    buf	points to an invalid address.

     EBADF	    fildes is not an open file descriptor.

     EINTR	    A signal was caught	during fstatvfs	execution.

     EIO	    An I/O error occurred while	reading	the file system.

     EFBIG	    One	of the fields overflowed (did not fit in a ulong_t).
		    See	the description	of statvfs64 and fstatvfs64 above.

DIAGNOSTICS    [Toc]    [Back]

     Upon successful completion	a value	of 0 is	returned.  Otherwise, a	value
     of	-1 is returned and errno is set	to indicate the	error.

SEE ALSO    [Toc]    [Back]

     chmod(2), chown(2), creat(2), link(2), mknod(2), pipe(2), read(2),
     time(2), unlink(2), utime(2), write(2).

									PPPPaaaaggggeeee 3333
[ Back ]
 Similar pages
Name OS Title
sizer Tru64 Displays information about the system or kernel, or creates a system configuration file
dxsysinfo Tru64 Monitors system information such as CPU activity, memory, swap space, and file system usage
getfsfile_r Tru64 Get information about a file system
endfsent_r Tru64 Get information about a file system
getfsspec_r Tru64 Get information about a file system
setfsent_r Tru64 Get information about a file system
getvfsbyname FreeBSD get information about a file system
getfsspec Tru64 Get information about a file system
getfsfile Tru64 Get information about a file system
getfsent_r Tru64 Get information about a file system
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service