OSDN Git Service

(split) LDP: Update original to LDP v3.51.
[linuxjm/LDP_man-pages.git] / original / man3 / readdir.3
index f7870fc..140b5e4 100644 (file)
@@ -33,7 +33,7 @@
 .\"     Rework discussion of nonstandard structure fields.
 .\" 2008-09-11, mtk, Document readdir_r().
 .\"
-.TH READDIR 3  2012-07-07 "" "Linux Programmer's Manual"
+.TH READDIR 3  2013-03-24 "" "Linux Programmer's Manual"
 .SH NAME
 readdir, readdir_r \- read a directory
 .SH SYNOPSIS
@@ -75,7 +75,7 @@ structure is defined as follows:
 .nf
 struct dirent {
     ino_t          d_ino;       /* inode number */
-    off_t          d_off;       /* offset to the next dirent */
+    off_t          d_off;       /* not an offset; see NOTES */
     unsigned short d_reclen;    /* length of this record */
     unsigned char  d_type;      /* type of file; not supported
                                    by all file system types */
@@ -163,6 +163,19 @@ or
 .B _DIRENT_HAVE_D_TYPE
 are defined.
 
+The value returned in
+.I d_off
+is the same as would be returned by calling
+.BR telldir (3)
+at the current position in the directory stream.
+Be aware that despite its type and name, the
+.I d_off
+field is seldom any kind of directory offset on modern file systems.
+.\" https://lwn.net/Articles/544298/
+Applications should treat this field as an opaque value,
+making no assumptions about its contents; see also
+.BR telldir (3).
+
 Other than Linux, the
 .I d_type
 field is available mainly only on BSD systems.