Bump to 1.14.1
[platform/upstream/augeas.git] / doc / posix-headers / sys_stat.texi
1 @node sys/stat.h
2 @section @file{sys/stat.h}
3
4 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html}
5
6 Gnulib module: sys_stat
7
8 Portability problems fixed by Gnulib:
9 @itemize
10 @item
11 The type @code{mode_t} is not defined on some platforms:
12 MSVC 9.
13 @item
14 Some macros, such as @code{S_IFMT} or @code{S_IFIFO}, are missing on some
15 platforms.
16 @item
17 The macros @code{S_ISBLK}, @code{S_ISCHR}, @code{S_ISDIR}, @code{S_ISFIFO},
18 @code{S_ISLNK}, @code{S_ISREG}, @code{S_ISSOCK} are broken on some platforms.
19 @item
20 Some platforms define macros, such as @code{S_ISDOOR}, that are not defined
21 on other platforms.
22 @item
23 The functions @code{lstat} and @code{mkdir} are not declared on some platforms:
24 mingw, MSVC 9.
25 @item
26 The macros @code{UTIME_NOW} and @code{UTIME_OMIT} are missing on some
27 platforms.
28 @item
29 On some platforms, @code{struct stat} does not include @code{st_atim},
30 @code{st_mtim}, or @code{st_ctim} members.  Use the gnulib module
31 @samp{stat-time} for accessors to portably get at subsecond resolution.
32 @end itemize
33
34 Portability problems not fixed by Gnulib:
35 @itemize
36 @item
37 The macro @code{S_IFBLK} is missing on some platforms:
38 MSVC 9.
39 @item
40 On Windows platforms (excluding Cygwin), @code{st_ino} is always 0.
41 @item
42 On OpenVMS, @code{st_ino} is an array of three @code{ino_t} values,
43 not a single value.
44 @item
45 To partially work around the previous two problems, you can test for
46 nonzero @code{st_ino} and use the Gnulib @code{same-inode} module to
47 compare nonzero values.  For example, @code{(a.st_ino && SAME_INODE
48 (a, b))} is true if the @code{struct stat} values @code{a} and
49 @code{b} are known to represent the same file, @code{(a.st_ino &&
50 !SAME_INODE (a, b))} is true if they are known to represent different
51 files, and @code{!a.st_ino} is true if it is not known whether they
52 represent different files.
53 @item
54 On some platforms, two different files may have the same @code{st_dev}
55 and @code{st_ino} values, even when @code{st_ino} is nonzero:
56 @itemize
57 @item
58 GNU/Linux NFS servers that export all local file systems as a single
59 NFS file system, if a local @code{st_dev} exceeds 255, or if a local
60 @code{st_ino} exceeds 16777215.
61 @item
62 Network Appliance NFS servers in snapshot directories; see Network
63 Appliance bug #195.
64 @item
65 ClearCase MVFS; see bug id ATRia04618.
66 @end itemize
67 One partial workaround is to compare other file metadata such as
68 @code{st_mode} and @code{st_mtime} to detect this bug, but this
69 approach does not work on files whose metadata are being changed by
70 other programs.
71 @item
72 On some file systems, @code{st_size} contains bogus information for
73 symlinks; use the Gnulib module @code{areadlink-with-size} for a
74 better way to get symlink contents.
75 @end itemize