1#if !defined ISO && !defined ISO99 && !defined ISO11
2
3#if !defined POSIX && !defined POSIX2008 && !defined XPG4 && !defined XPG42
4type blkcnt_t
5type blksize_t
6#endif
7#ifndef POSIX
8type dev_t
9type ino_t
10type mode_t
11type nlink_t
12type uid_t
13type gid_t
14type off_t
15type time_t
16#else
17# define dev_t __dev_t
18# define ino_t __ino_t
19# define mode_t __mode_t
20# define nlink_t __nlink_t
21# define uid_t __uid_t
22# define gid_t __gid_t
23# define off_t __off_t
24# define time_t __time_t
25#endif
26
27type {struct stat}
28
29// Bug 17786: st_dev has wrong type.
30// Bug 23084: st_dev has type unsigned long long instead of dev_t (unsigned).
31xfail[mips-o32-linux|i386-gnu]-element {struct stat} dev_t st_dev
32element {struct stat} ino_t st_ino
33element {struct stat} mode_t st_mode
34element {struct stat} nlink_t st_nlink
35element {struct stat} uid_t st_uid
36element {struct stat} gid_t st_gid
37#if !defined POSIX && !defined POSIX2008
38// Bug 21278: st_rdev has wrong type.
39xfail[mips-o32-linux]-element {struct stat} dev_t st_rdev
40#endif
41element {struct stat} off_t st_size
42element {struct stat} time_t st_atime
43element {struct stat} time_t st_mtime
44element {struct stat} time_t st_ctime
45#if defined XOPEN2K8 || defined POSIX2008
46element {struct stat} {struct timespec} st_atim
47element {struct stat} {struct timespec} st_mtim
48element {struct stat} {struct timespec} st_ctim
49#endif
50#if !defined XPG4 && !defined POSIX && !defined POSIX2008
51# ifdef XPG42
52// The XPG42 use of "long" for these fields is not compatible with the
53// use of typedefs in future standards to support values outside the
54// range of "long".
55xfail-element {struct stat} long st_blksize
56xfail-element {struct stat} long st_blocks
57# else
58element {struct stat} blksize_t st_blksize
59element {struct stat} blkcnt_t st_blocks
60# endif
61#endif
62
63# if defined XOPEN2K8 || defined POSIX2008
64type {struct timespec}
65element {struct timespec} time_t tv_sec
66// Bug 16437: tv_nsec has wrong type.
67xfail[x86_64-x32-linux]-element {struct timespec} long tv_nsec
68# endif
69
70#if !defined POSIX && !defined POSIX2008
71constant S_IFMT
72constant S_IFBLK
73constant S_IFCHR
74constant S_IFIFO
75constant S_IFREG
76constant S_IFDIR
77# ifndef XPG4
78constant S_IFLNK
79constant S_IFSOCK
80# endif
81#endif
82
83constant S_IRWXU
84constant S_IRUSR
85constant S_IWUSR
86constant S_IXUSR
87constant S_IRWXG
88constant S_IRGRP
89constant S_IWGRP
90constant S_IXGRP
91constant S_IRWXO
92constant S_IROTH
93constant S_IWOTH
94constant S_IXOTH
95constant S_ISUID
96constant S_ISGID
97#if !defined XPG4 && !defined POSIX && !defined POSIX2008
98constant S_ISVTX
99#endif
100
101macro S_ISBLK
102macro S_ISCHR
103macro S_ISDIR
104macro S_ISFIFO
105macro S_ISREG
106#if !defined XPG4 && !defined POSIX
107macro S_ISLNK
108macro S_ISSOCK
109#endif
110
111// How to represent optional tests?
112optional-macro S_TYPEISMQ
113optional-macro S_TYPEISSEM
114optional-macro S_TYPEISSHM
115# if !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98
116optional-macro S_TYPEISTMO
117# endif
118
119# if defined XOPEN2K8 || defined POSIX2008
120constant UTIME_NOW
121constant UTIME_OMIT
122# endif
123
124function int chmod (const char*, mode_t)
125# ifndef XPG4
126function int fchmod (int, mode_t)
127# endif
128# if defined XOPEN2K8 || defined POSIX2008
129function int fchmodat (int, const char*, mode_t, int)
130# endif
131function int fstat (int, struct stat*)
132# if defined XOPEN2K8 || defined POSIX2008
133function int fstatat (int, const char*, struct stat*, int)
134function int futimens (int, const struct timespec[2])
135# endif
136#if !defined XPG4 && !defined POSIX
137function int lstat (const char*, struct stat*)
138#endif
139function int mkdir (const char*, mode_t)
140# if defined XOPEN2K8 || defined POSIX2008
141function int mkdirat (int, const char*, mode_t)
142# endif
143function int mkfifo (const char*, mode_t)
144# if defined XOPEN2K8 || defined POSIX2008
145function int mkfifoat (int, const char*, mode_t)
146# endif
147# if !defined XPG4 && !defined POSIX && !defined POSIX2008
148function int mknod (const char*, mode_t, dev_t)
149# endif
150# ifdef XOPEN2K8
151function int mknodat (int, const char*, mode_t, dev_t)
152# endif
153function int stat (const char*, struct stat*)
154function mode_t umask (mode_t)
155# if defined XOPEN2K8 || defined POSIX2008
156function int utimensat (int, const char*, const struct timespec[2], int)
157# endif
158
159allow st_*
160allow S_*
161allow *_t
162#endif
163