Next: sys/statvfs.h, Previous: sys/socket.h, Up: Header File Substitutes [Contents][Index]
POSIX specification:
http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
Gnulib module: sys_stat
Portability problems fixed by Gnulib:
mode_t
is not defined on some platforms:
MSVC 9.
S_IFMT
or S_IFIFO
, are missing on some
platforms.
S_ISBLK
, S_ISCHR
, S_ISDIR
, S_ISFIFO
,
S_ISLNK
, S_ISREG
, S_ISSOCK
are broken on some platforms.
S_ISDOOR
, that are not defined
on other platforms.
lstat
and mkdir
are not declared on some platforms:
mingw, MSVC 9.
UTIME_NOW
and UTIME_OMIT
are missing on some
platforms.
struct stat
does not include st_atim
,
st_mtim
, or st_ctim
members. Use the gnulib module
‘stat-time’ for accessors to portably get at subsecond resolution.
Portability problems not fixed by Gnulib:
S_IFBLK
is missing on some platforms:
MSVC 9.
st_ino
is always 0.
st_ino
is an array of three ino_t
values,
not a single value.
st_ino
and use the Gnulib same-inode
module to
compare nonzero values. For example, (a.st_ino && SAME_INODE
(a, b))
is true if the struct stat
values a
and
b
are known to represent the same file, (a.st_ino &&
!SAME_INODE (a, b))
is true if they are known to represent different
files, and !a.st_ino
is true if it is not known whether they
represent different files.
st_dev
and st_ino
values, even when st_ino
is nonzero:
st_dev
exceeds 255, or if a local
st_ino
exceeds 16777215.
One partial workaround is to compare other file metadata such as
st_mode
and st_mtime
to detect this bug, but this
approach does not work on files whose metadata are being changed by
other programs.
st_size
contains bogus information for
symlinks; use the Gnulib module areadlink-with-size
for a
better way to get symlink contents.
Next: sys/statvfs.h, Previous: sys/socket.h, Up: Header File Substitutes [Contents][Index]