POSIX specification:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/dirent.h.html
Portability problems fixed by Gnulib:
DT_DIR
,
some do not:
Minix 3.1.8, AIX 7.2, HP-UX 11, Solaris 11.4, mingw.
DT_WHT
is missing on many systems:
All systems where DT_DIR
is missing, plus OpenBSD 7.5.
DTTOIF
and IFTODT
are missing on
many systems (however, the Gnulib replacement macros
may evaluate their arguments multiple times):
All systems where DT_DIR
is missing, plus OpenBSD 7.5.
ino_t
is missing on some platforms:
glibc 2.23 and others.
Portability problems not fixed by Gnulib:
struct dirent
member named
d_type
, some do not:
Minix 3.1.8, AIX 7.2, HP-UX 11, Solaris 11.4, mingw.
d_type
, not every filesystem supports
d_type
, and those lacking support will set it to DT_UNKNOWN
.
DT_MQ
,
DT_SEM
, DT_SHM
and DT_TMO
are missing on many
platforms.
struct dirent
member named d_namlen
containing the string length of d_name
, but others do not:
glibc 2.23 on Linux, Minix 3.1.8, Solaris 11.4, Cygwin.
All of these, except Cygwin, have a member d_reclen
instead,
that has a different semantics.
struct dirent
member named d_off
containing a magic cookie suitable as an argument to seekdir
,
but others do not:
glibc 2.23 on Hurd, macOS 11.1, FreeBSD 11.0, NetBSD 10.0, OpenBSD 7.5, AIX 5.1, HP-UX 11, Cygwin, mingw.
struct dirent
member named
d_reclen
containing the number of bytes in the directory entry
record, but others do not. This member has limited utility, as it is
an implementation detail.