diff options
Diffstat (limited to 'lib/libc/sys/stat.2')
-rw-r--r-- | lib/libc/sys/stat.2 | 67 |
1 files changed, 46 insertions, 21 deletions
diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2 index 6c39663..7b92113 100644 --- a/lib/libc/sys/stat.2 +++ b/lib/libc/sys/stat.2 @@ -30,6 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)stat.2 8.4 (Berkeley) 5/1/95 +.\" $Id: stat.2,v 1.11 1997/02/22 15:04:29 peter Exp $ .\" .Dd May 1, 1995 .Dt STAT 2 @@ -93,21 +94,30 @@ as defined by and into which information is placed concerning the file. .Bd -literal struct stat { - dev_t st_dev; /* device inode resides on */ - ino_t st_ino; /* inode's number */ - mode_t st_mode; /* inode protection mode */ - nlink_t st_nlink; /* number or hard links to the file */ - uid_t st_uid; /* user-id of owner */ - gid_t st_gid; /* group-id of owner */ - dev_t st_rdev; /* device type, for special file inode */ + dev_t st_dev; /* inode's device */ + ino_t st_ino; /* inode's number */ + mode_t st_mode; /* inode protection mode */ + nlink_t st_nlink; /* number of hard links */ + uid_t st_uid; /* user ID of the file's owner */ + gid_t st_gid; /* group ID of the file's group */ + dev_t st_rdev; /* device type */ +#ifndef _POSIX_SOURCE struct timespec st_atimespec; /* time of last access */ struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_ctimespec; /* time of last file status change */ - off_t st_size; /* file size, in bytes */ - quad_t st_blocks; /* blocks allocated for file */ - u_long st_blksize;/* optimal file sys I/O ops blocksize */ - u_long st_flags; /* user defined flags for file */ - u_long st_gen; /* file generation number */ +#else + time_t st_atime; /* time of last access */ + long st_atimensec; /* nsec of last access */ + time_t st_mtime; /* time of last data modification */ + long st_mtimensec; /* nsec of last data modification */ + time_t st_ctime; /* time of last file status change */ + long st_ctimensec; /* nsec of last file status change */ +#endif + off_t st_size; /* file size, in bytes */ + quad_t st_blocks; /* blocks allocated for file */ + u_long st_blksize; /* optimal blocksize for I/O */ + u_long st_flags; /* user defined flags for file */ + u_long st_gen; /* file generation number */ }; .Ed .Pp @@ -146,6 +156,17 @@ and system calls. .El .Pp +If +.Dv _POSIX_SOURCE +is not defined, the time-related fields are defined as: +.Bd -literal +#ifndef _POSIX_SOURCE +#define st_atime st_atimespec.tv_sec +#define st_mtime st_mtimespec.tv_sec +#define st_ctime st_ctimespec.tv_sec +#endif +.Ed +.Pp The size-related fields of the .Fa struct stat are as follows: @@ -170,6 +191,7 @@ has the following bits: #define S_IFREG 0100000 /* regular */ #define S_IFLNK 0120000 /* symbolic link */ #define S_IFSOCK 0140000 /* socket */ +#define S_IFWHT 0160000 /* whiteout */ #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ #define S_ISVTX 0001000 /* save swapped text even after use */ @@ -207,8 +229,6 @@ will fail if: .Bl -tag -width ENAMETOOLONGAA .It Bq Er ENOTDIR A component of the path prefix is not a directory. -.It Bq Er EINVAL -The pathname contains a character with the high-order bit set. .It Bq Er ENAMETOOLONG A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters. @@ -242,13 +262,13 @@ An I/O error occurred while reading from or writing to the file system. .Sh SEE ALSO .Xr chmod 2 , .Xr chown 2 , -.Xr utimes 2 +.Xr utimes 2 , .Xr symlink 7 .Sh BUGS Applying -.Xr fstat +.Fn fstat to a socket (and thus to a pipe) -returns a zero'd buffer, +returns a zeroed buffer, except for the blocksize field, and a unique device and inode number. .Sh STANDARDS @@ -256,11 +276,16 @@ The .Fn stat and .Fn fstat -function calls are expected to -conform to IEEE Std 1003.1-1988 -.Pq Dq Tn POSIX . +function calls are expected to conform to +.St -p1003.1-90 . .Sh HISTORY A -.Nm lstat +.Fn stat +and a +.Fn fstat +function call appeared in +.At v7 . +A +.Fn lstat function call appeared in .Bx 4.2 . |