[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 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.

The stat subroutine 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. The lstat subroutine 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. The fstatfs subroutine 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.

The ustat subroutine 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.

The utimes and utime subroutines also affect file status information. They change the file access and modification time in the i-node.

Related Information

Files, Directories, and File Systems for Programmers provides an overview and orientation to the topics.

Working with JFS i-nodes describes the internal representation of files and lists the contents of disk i-nodes and in-core (main memory) i-nodes.

File Creation and Removal explains the programming concerns when creating and removing files and introduces the subroutines that control these procedures.

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

The fullstat.h file, the stat.h file, the statfs.h file.


[ Previous | Next | Contents | Glossary | Home | Search ]