OSDN Git Service

(split) LDP_man-pages: update original to v3.35.
[linuxjm/LDP_man-pages.git] / original / man2 / stat.2
index 82016b8..9384a61 100644 (file)
@@ -37,7 +37,7 @@
 .\" 2007-06-08 mtk: Added example program
 .\" 2007-07-05 mtk: Added details on underlying system call interfaces
 .\"
-.TH STAT 2 2010-12-03 "Linux" "Linux Programmer's Manual"
+.TH STAT 2 2011-10-04 "Linux" "Linux Programmer's Manual"
 .SH NAME
 stat, fstat, lstat \- get file status
 .SH SYNOPSIS
@@ -72,7 +72,7 @@ _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
 .SH DESCRIPTION
 .PP
 These functions return information about a file.
-No permissions are required on the file itself, but \(em in the case of
+No permissions are required on the file itself, but\(emin the case of
 .BR stat ()
 and
 .BR lstat ()
@@ -142,8 +142,8 @@ The
 .I st_size
 field gives the size of the file (if it is a regular
 file or a symbolic link) in bytes.
-The size of a symlink is the length of the pathname
-it contains, without a trailing null byte.
+The size of a symbolic link is the length of the pathname
+it contains, without a terminating null byte.
 
 The
 .I st_blocks
@@ -363,6 +363,20 @@ These system calls conform to SVr4, 4.3BSD, POSIX.1-2001.
 .\" .BR lstat ()
 .\" error conditions EINTR, EMULTIHOP, ENOLINK, and EOVERFLOW.
 
+According to POSIX.1-2001,
+.BR lstat ()
+on a symbolic link need return valid information only in the
+.I st_size
+field and the file-type component of the
+.IR st_mode
+field of the
+.IR stat
+structure.
+POSIX.-2008 tightens the specification, requiring
+.BR lstat ()
+to return valid information in all fields except the permission bits in
+.IR st_mode .
+
 Use of the
 .I st_blocks
 and
@@ -383,7 +397,7 @@ with the value 500 or greater (before including
 .I any
 header files).
 .LP
-POSIX does not describe the
+POSIX.1-1990 did not describe the
 .BR S_IFMT ,
 .BR S_IFSOCK ,
 .BR S_IFLNK ,
@@ -393,11 +407,15 @@ POSIX does not describe the
 .BR S_IFCHR ,
 .BR S_IFIFO ,
 .B S_ISVTX
-bits, but instead demands the use of
+constants, but instead demanded the use of
 the macros
 .BR S_ISDIR (),
 etc.
 The
+.BR S_IF*
+constants are present in POSIX.1-2011 and later.
+
+The
 .BR S_ISLNK ()
 and
 .BR S_ISSOCK ()
@@ -490,7 +508,8 @@ On Linux,
 .BR lstat ()
 will generally not trigger automounter action, whereas
 .BR stat ()
-will.
+will (but see
+.BR fstatat (2)).
 
 For most files under the
 .I /proc