Next: , Previous: , Up: ISO C and POSIX Header File Substitutes   [Contents][Index]


9.66 sys/stat.h

POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html

Gnulib module: sys_stat

Portability problems fixed by Gnulib module sys_stat:

Portability problems fixed by Gnulib module sys_stat, together with module windows-stat-inodes:

On platforms where off_t is a 32-bit type, struct stat cannot represent the size of files or block devices 2 GiB or lager and may not work correctly on directories 2 GiB or larger. Also, on platforms where ino_t is a 32-bit type, struct stat cannot represent larger inode numbers. See Large File Support, for how to address these problems.

See Avoiding the year 2038 problem, for portability issues with the time_t components of struct stat.

Portability problems not fixed by Gnulib:

To partially work around porting problems with Microsoft Windows and OpenVMS, you can use the Gnulib same-inode module to test whether two struct stat objects are known to represent the same file. For example, psame_inode (&a, &b) is true if the struct stat objects a and b are known to represent the same file.

Another partial workaround is to compare other file metadata such as st_mode and st_mtime on platforms where st_dev and st_ino not uniquely identify a file. However, this does not work reliably on files whose metadata are being changed by other programs, or where the metadata happen to be equal.


Next: sys/statvfs.h, Previous: sys/socket.h, Up: ISO C and POSIX Header File Substitutes   [Contents][Index]