Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ statfs(2) — Motorola System V 88k Release 4 Version 4.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(2)

chown(2)

creat(2)

link(2)

mknod(2)

pipe(2)

read(2)

statvfs(2)

time(2)

unlink(2)

utime(2)

write(2)

statfs(2)  —  SYSTEM CALLS

NAME

statfs, fstatfs − get file system information

SYNOPSIS

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

int statfs (const char ∗path, struct statfs ∗buf, int len, int fstyp);

int fstatfs (int fildes, struct statfs ∗buf, int len, int fstyp);

DESCRIPTION

NOTE: For new code, use statvfs.  statfs will become obsolete in future releases. 

statfs returns a “generic superblock” describing a file system.  it can be used to acquire information about mounted as well as unmounted file systems, although usage is slightly different in the two cases.  In all cases, buf is a pointer to a structure (described below) that is filled by the system call.  len is the number of bytes that the system should return in the structure.  len must be no greater that sizeof(struct statfs), and ordinarily it will contain exactly that value.  If it holds a smaller value the system will fill the structure with that number of bytes. 

If the file system is currently mounted, path should name a file that resides on that file system.  The file system type is known to the operating system and the fstyp argument must be zero.  If the file system is currently unmounted, path must name the block special file containing the file system, and fstyp must contain the non-zero file system type.  In both cases, 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 statfs structure pointed to by buf includes the following members:

shortf_fstyp;/∗ File system type ∗/
longf_bsize;/∗ Block size ∗/
longf_frsize;/∗ Fragment size (if supported) ∗/
longf_blocks;/∗ Total number of blocks on file system ∗/
longf_bfree;/∗ Total number of free blocks ∗/
ino_tf_files;/∗ Total number of file nodes (inodes) ∗/
ino_tf_ffree;/∗ Total number of free file nodes ∗/
charf_fname[6];/∗ Volume name ∗/
charf_fpack[6];/∗ Pack name ∗/

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

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

EACCES Search permission is denied on a component of the path prefix. 

EFAULT path or buf points to an invalid address. 

EINTR A signal was caught during statfs execution. 

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

ELOOP Too many symbolic links were encountered in translating path.

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} characters. 

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. 

fstatfs 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 fstatfs execution. 

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

DIAGNOSTICS

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

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

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026