[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

General Programming Concepts: Writing and Debugging Programs


File Status

File status information resides in the i-node. The stat subroutines are used to return information on a file. The stat subroutines report file type, file owner, access mode, file size, number of links, i-node number, and file access times. These subroutines write information into a data structure designated by the Buffer variable. The process must have search permission for the directories in the path to the designated file.

stat Subroutine that returns the information about files named by the Path parameter. If the size of the file cannot be represented in the structure designated by the Buffer variable, stat will fail with the errno set to EOVERFLOW.
lstat Subroutine that provides information about a symbolic link, and the stat subroutine returns information about the file referenced by the link. The fstat subroutine returns information from an open file using the file descriptor.

The statfs, fstafs, and ustat subroutines return status information about a file system. The statfs subroutine returns information about the file system that contains the file specified by the Path parameter.

fstatfs Returns the information about the file system that contains the file associated with the given file descriptor. The structure of the returned information is described in the /usr/include/sys/statfs.h file for the statfs and fstatfs subroutines and in the ustat.h file for the ustat subroutine.
ustat Returns information about a mounted file system designated by the Device variable. This device identifier is for any given file and can be determined by examining the st_dev field of the stat structure defined in the /usr/include/sys/stat.h file. The ustat subroutine is superseded by the statfs and fstatfs subroutines.
utimes and utime Also affect file status information. They change the file access and modification time in the i-node.

Related Information

Chapter 5, File Systems and Directories

Working with JFS i-nodes

File Creation and Removal

statx, stat, fstatx, fstat, fullstat, or ffullstat subroutine, the statfs, fstatfs, or ustat subroutine, the utimes or utime subroutine

fullstat.h file, stat.h file, statfs.h file


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]