This section describes what you find in a single directory entry, as you might obtain it from a directory stream. All the symbols are declared in the header file `dirent.h'.
char d_name[]
ino_t d_fileno
d_ino
. In the GNU system and most POSIX systems, for most files this the same as the st_ino
member that stat
will return for the file. See File Attributes.
unsigned char d_namlen
unsigned char
because that is the integer type of the appropriate size
unsigned char d_type
DT_UNKNOWN
DT_REG
DT_DIR
DT_FIFO
DT_SOCK
DT_CHR
DT_BLK
This member is a BSD extension. Each value except DT_UNKNOWN corresponds to the file type bits in the st_mode
member of struct statbuf
. These two macros convert between d_type
values and st_mode
values:
d_type
value corresponding to mode.
st_mode
value corresponding to dirtype. This structure may contain additional members in the future.
When a file has multiple names, each name has its own directory entry. The only way you can tell that the directory entries belong to a single file is that they have the same value for the d_fileno
field.
File attributes such as size, modification times, and the like are part of the file itself, not any particular directory entry. See File Attributes.