Branch
Hash :
06b4b215
Author :
Date :
2025-09-10T23:22:50
doc: Remove support for IRIX. * doc/gnulib.texi (Header files): Update. * doc/posix-functions/sig2str.texi: Don't mention IRIX problem. * doc/posix-functions/str2sig.texi: Likewise. * doc/posix-functions/strerror.texi: Likewise. * doc/posix-headers/sys_stat.texi: Don't mention IRIX. * doc/posix-headers/sys_types.texi: Likewise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
@node sys/stat.h
@section @file{sys/stat.h}
POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_stat.h.html}
Gnulib module: sys_stat-h
@mindex sys_stat-h
Portability problems fixed by Gnulib module @code{sys_stat-h}:
@itemize
@item
The type @code{mode_t} is not defined on some platforms:
MSVC 14.
@item
The type @code{blksize_t} is not defined on some platforms:
FreeBSD 5.5, OpenBSD 5.6, HP-UX 11.23, mingw, MSVC 14.
@item
The type @code{blkcnt_t} is not defined on some platforms:
FreeBSD 5.5, OpenBSD 5.6, mingw, MSVC 14.
@item
Some macros, such as @code{S_IFMT} or @code{S_IFIFO}, are missing on some
platforms.
@item
The macros @code{S_ISBLK}, @code{S_ISCHR}, @code{S_ISDIR}, @code{S_ISFIFO},
@code{S_ISLNK}, @code{S_ISREG}, @code{S_ISSOCK} are broken on some platforms.
@item
Some platforms define macros, such as @code{S_ISDOOR}, that are not defined
on other platforms.
@item
The functions @code{lstat} and @code{mkdir} are not declared on some platforms:
mingw, MSVC 14.
@item
The macros @code{UTIME_NOW} and @code{UTIME_OMIT} are missing on some
platforms.
@item
On some platforms, @code{struct stat} does not include @code{st_atim},
@code{st_mtim}, or @code{st_ctim} members.
@mindex stat-time
Use the gnulib module
@samp{stat-time} for accessors to portably get at subsecond resolution.
@end itemize
@mindex windows-stat-inodes
Portability problems fixed by Gnulib module @code{sys_stat-h}, together with module @code{windows-stat-inodes}:
@itemize
@item
On Windows platforms (excluding Cygwin), @code{st_ino} is always 0.
@end itemize
On platforms where @code{off_t} is a 32-bit type, @code{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 @code{ino_t} is a 32-bit type,
@code{struct stat} cannot represent larger inode numbers.
@xref{Large File Support}, for how to address these problems.
@xref{Avoiding the year 2038 problem}, for portability issues with the
@code{time_t} components of @code{struct stat}.
Portability problems not fixed by Gnulib:
@itemize
@item
On some platforms the types @code{blksize_t} and @code{blkcnt_t} are unsigned:
@c https://sourceware.org/PR33355
Android, glibc/alpha.
@item
The macro @code{S_IFBLK} is missing on some platforms:
MSVC 14.
@item
On OpenVMS, @code{st_ino} is an array of three @code{ino_t} values,
not a single value.
@code{b} are known to represent the same file.
@item
On some platforms, two different files may have the same @code{st_dev}
and @code{st_ino} values, even when @code{st_ino} is nonzero:
@itemize
@item
GNU/Linux NFS servers that export all local file systems as a single
NFS file system, if a local @code{st_dev} exceeds 255, or if a local
@code{st_ino} exceeds 16777215.
@item
Network Appliance NFS servers in snapshot directories; see Network
Appliance bug #195.
@item
ClearCase MVFS; see bug id ATRia04618.
@end itemize
@item
On some file systems, @code{st_size} contains bogus information for
symlinks;
@mindex areadlink-with-size
use the Gnulib module @code{areadlink-with-size} for a
better way to get symlink contents.
@end itemize
@mindex same-inode
To partially work around porting problems with Microsoft Windows and OpenVMS,
you can use the Gnulib @code{same-inode} module to test whether two
@code{struct stat} objects are known to represent the same file.
For example, @code{psame_inode (&a, &b)} is true if the @code{struct stat}
objects @code{a} and @code{b} are known to represent the same file.
Another partial workaround is to compare other file metadata such as
@code{st_mode} and @code{st_mtime} on platforms where @code{st_dev}
and @code{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.