aboutsummaryrefslogtreecommitdiffstats
diff options
authorAlejandro Colomar <alx@kernel.org>2025-05-28 20:59:11 +0200
committerAlejandro Colomar <alx@kernel.org>2025-06-30 05:58:41 +0200
commita0e35ba47b6174d1f02d196daed208701d3c5193 (patch)
treee55da1336fa3bfbffe98cd9311fbce8a8356c194
parentc99bfd43496f6ae3396fda67b5e0d8449cd04b06 (diff)
downloadman-pages-ino.tar.gz
man/man3/readdir.3, man/man3type/stat.3type: Improve documentation about .d_ino and .st_inoino
Suggested-by: Pali Rohár <pali@kernel.org> Co-authored-by: Pali Rohár <pali@kernel.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--man/man3/readdir.322
-rw-r--r--man/man3type/stat.3type16
2 files changed, 36 insertions, 2 deletions
diff --git a/man/man3/readdir.3 b/man/man3/readdir.3
index b9150160bc..ad9c765951 100644
--- a/man/man3/readdir.3
+++ b/man/man3/readdir.3
@@ -58,7 +58,27 @@ The fields of the
structure are as follows:
.TP
.I .d_ino
-This is the inode number of the file.
+This is the inode number of the file,
+which belongs to the filesystem
+.I .st_dev
+(see
+.BR stat (3type))
+of the directory on which
+.BR readdir ()
+was called.
+If the directory entry is the mount point,
+then
+.I .d_ino
+differs from
+.IR .st_ino :
+.I .d_ino
+is the inode number of the underlying mount point,
+while
+.I .st_ino
+is the inode number of the mounted file system.
+According to POSIX,
+this Linux behavior is considered to be a bug,
+but is nevertheless conforming.
.TP
.I .d_off
The value returned in
diff --git a/man/man3type/stat.3type b/man/man3type/stat.3type
index ee801bcece..835626775b 100644
--- a/man/man3type/stat.3type
+++ b/man/man3type/stat.3type
@@ -66,7 +66,21 @@ and
macros may be useful to decompose the device ID in this field.)
.TP
.I .st_ino
-This field contains the file's inode number.
+This field contains the file's inode number,
+which belongs to the
+.IR .st_dev .
+If
+.BR stat (2)
+was called on the mount point,
+then
+.I .d_ino
+differs from
+.IR .st_ino :
+.I .d_ino
+is the inode number of the underlying mount point,
+while
+.I .st_ino
+is the inode number of the mounted file system.
.TP
.I .st_mode
This field contains the file type and mode.