diff options
Diffstat (limited to 'man2/stat.2')
-rw-r--r-- | man2/stat.2 | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/man2/stat.2 b/man2/stat.2 index 096e00132..f41daab46 100644 --- a/man2/stat.2 +++ b/man2/stat.2 @@ -16,7 +16,7 @@ .\" 2007-06-08 mtk: Added example program .\" 2007-07-05 mtk: Added details on underlying system call interfaces .\" -.TH stat 2 2023-02-05 "Linux man-pages 6.03" +.TH stat 2 2023-05-03 "Linux man-pages 6.05.01" .SH NAME stat, fstat, lstat, fstatat \- get file status .SH LIBRARY @@ -306,15 +306,16 @@ calls on a file whose size exceeds .I (1<<31)\-1 bytes. -.SH VERSIONS -.BR fstatat () -was added in Linux 2.6.16; -library support was added in glibc 2.4. .SH STANDARDS -.BR stat (), -.BR fstat (), -.BR lstat (): -SVr4, 4.3BSD, POSIX.1-2001, POSIX.1.2008. +POSIX.1-2008. +.SH HISTORY +.TP +.BR stat () +.TQ +.BR fstat () +.TQ +.BR lstat () +SVr4, 4.3BSD, POSIX.1-2001. .\" SVr4 documents additional .\" .BR fstat () .\" error conditions EINTR, ENOLINK, and EOVERFLOW. SVr4 @@ -323,9 +324,11 @@ SVr4, 4.3BSD, POSIX.1-2001, POSIX.1.2008. .\" and .\" .BR lstat () .\" error conditions EINTR, EMULTIHOP, ENOLINK, and EOVERFLOW. -.PP -.BR fstatat (): +.TP +.BR fstatat () POSIX.1-2008. +Linux 2.6.16, +glibc 2.4. .PP According to POSIX.1-2001, .BR lstat () @@ -349,7 +352,6 @@ fields may be less portable. (They were introduced in BSD. The interpretation differs between systems, and possibly on a single system when NFS mounts are involved.) -.SH NOTES .SS C library/kernel differences Over time, increases in the size of the .I stat @@ -465,28 +467,28 @@ structure. #include <sys/stat.h> #include <sys/sysmacros.h> #include <time.h> - +\& int main(int argc, char *argv[]) { struct stat sb; - +\& if (argc != 2) { fprintf(stderr, "Usage: %s <pathname>\en", argv[0]); exit(EXIT_FAILURE); } - +\& if (lstat(argv[1], &sb) == \-1) { perror("lstat"); exit(EXIT_FAILURE); } - +\& printf("ID of containing device: [%x,%x]\en", major(sb.st_dev), minor(sb.st_dev)); - +\& printf("File type: "); - +\& switch (sb.st_mode & S_IFMT) { case S_IFBLK: printf("block device\en"); break; case S_IFCHR: printf("character device\en"); break; @@ -497,27 +499,27 @@ main(int argc, char *argv[]) case S_IFSOCK: printf("socket\en"); break; default: printf("unknown?\en"); break; } - +\& printf("I\-node number: %ju\en", (uintmax_t) sb.st_ino); - +\& printf("Mode: %jo (octal)\en", (uintmax_t) sb.st_mode); - +\& printf("Link count: %ju\en", (uintmax_t) sb.st_nlink); printf("Ownership: UID=%ju GID=%ju\en", (uintmax_t) sb.st_uid, (uintmax_t) sb.st_gid); - +\& printf("Preferred I/O block size: %jd bytes\en", (intmax_t) sb.st_blksize); printf("File size: %jd bytes\en", (intmax_t) sb.st_size); printf("Blocks allocated: %jd\en", (intmax_t) sb.st_blocks); - +\& printf("Last status change: %s", ctime(&sb.st_ctime)); printf("Last file access: %s", ctime(&sb.st_atime)); printf("Last file modification: %s", ctime(&sb.st_mtime)); - +\& exit(EXIT_SUCCESS); } .EE |