Syntax | #include <sys/stat.h> int stat (const char *path, struct stat *buf); CRTE111A30 int statx(const char *path, struct statx *buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
Description |
path points to a pathname naming a file. Read, write or execute permission of the named file is not required, but all directories listed in the pathname leading to the file must be searchable. buf is a pointer to a structure of type
The structure components There is no difference in functionality between The functions with the suffix x behave like the functions of the same name without a suffix, except that they return the file status in a corresponding The mode_t st_mode; /* File mode (see mknod()) */
ino_t st_ino; /* Inode number */
dev_t st_dev; /* Device ID which contains a directory entry for
this file */
dev_t st_rdev; /* Device ID, defined for character-special or
block-special files only */
nlink_t st_nlink; /* Number of links */
uid_t st_uid; /* User ID of the file owner */
gid_t st_gid; /* Group ID of the file owner */
off_t st_size; /* File size in bytes */
time_t st_atime; /* Time of the last access */
time_t st_mtime; /* Time of the last data modification */
time_t st_ctime; /* Time of the last change of file status
The time is measured in seconds as of
January 1, 1970, 00:00:00 */
Extension long st_blksize; /* Preferred I/O block size */ blkcnt_t st_blocks; /* Number of assigned st_blksize blocks */ (End) The elements of the structure ino64_t st_ino off64_t st_size and blkcnt64_t st_blocks The elements of the structures time64_t st_atime; time64_t st_mtime; time64_t st_ctime; The elements of the structure have the following meanings:
BS2000 With BS2000 files the following elements of the
(End) | |||||||||||||||||||||||||||||||||||||||||||||||||
Return val. | 0 | if successful. | ||||||||||||||||||||||||||||||||||||||||||||||||
-1 | if an error occurs. For POSIX files | |||||||||||||||||||||||||||||||||||||||||||||||||
Errors |
| |||||||||||||||||||||||||||||||||||||||||||||||||
|
| Search permission is denied for a component of the path. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Extension | |||||||||||||||||||||||||||||||||||||||||||||||||
|
| buf or path points to an invalid address. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
| A signal was caught during the | ||||||||||||||||||||||||||||||||||||||||||||||||
|
| The named file does not exist or the path argument points to an empty string. (End) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
| An I/O error occurred while reading the file system. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
| Too many symbolic links were encountered in resolving path. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Extension | |||||||||||||||||||||||||||||||||||||||||||||||||
|
| Components of path require hops to several remote computers, but the file system does not permit this. (End) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||
The length of path exceeds | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Extension | |||||||||||||||||||||||||||||||||||||||||||||||||
|
| path refers to a remote computer to which there is no active connection. (End) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
| The specified file does not exist or the path is the null path. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
| A component of the path is not a directory. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
| A component is too large to be stored in the structure pointed to by buf. | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||
|
| A timestamp is too large for a | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||
|
| POSIX-BC correction status < A47. | ||||||||||||||||||||||||||||||||||||||||||||||||
See also |
| |||||||||||||||||||||||||||||||||||||||||||||||||