diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2016-08-29 08:47:39 +1200 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2016-08-29 08:47:39 +1200 |
| commit | 9dbc4adbce3ac35c0d1ed165b128030f9454782f (patch) | |
| tree | b47399dddfdac594fab5a4c202672c988c092fbe | |
| parent | 370f8e34c44f5be6bdcb9ce04b04e04cf1f6fa7a (diff) | |
| download | man-pages-9dbc4adbce3ac35c0d1ed165b128030f9454782f.tar.gz | |
stat.2: Improve discussion of 'st_size' for /proc and /sys files
Reported-by: Ursache Vladimir <f35f22fan@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| -rw-r--r-- | man2/stat.2 | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/man2/stat.2 b/man2/stat.2 index 99f6c17e2b..d357aa556c 100644 --- a/man2/stat.2 +++ b/man2/stat.2 @@ -784,13 +784,21 @@ will generally not trigger automounter action, whereas will (but see .BR fstatat (2)). -For most files under the +For many pseudofiles that are autogenerated by the kernel, +.BR stat () +does not return an accurate value in the +.IR st_size +field. +For example, the value 0 is returned for many files under the .I /proc directory, -.BR stat () -does not return the file size in the -.I st_size -field; instead the field is returned with the value 0. +while various files under +.IR /sys +report a size of 4096 bytes, even though the file content is smaller. +For such files, one should simply try to read as many bytes as possible +(and append \(aq\e0\(aq to the returned buffer +if it is to be interpreted as a string). +.\" .SS Timestamp fields Older kernels and older standards did not support nanosecond timestamp fields. |
