flockfile list corruption test
[libc-test] / src / api / sys_stat.c
1 #include <sys/stat.h>
2 #include "options.h"
3 #define T(t) (t*)0;
4 #define F(t,n) {t *y = &x.n;}
5 #define C(n) switch(n){case n:;}
6 static void f()
7 {
8 T(blkcnt_t)
9 T(blksize_t)
10 T(dev_t)
11 T(ino_t)
12 T(mode_t)
13 T(nlink_t)
14 T(uid_t)
15 T(gid_t)
16 T(off_t)
17 T(time_t)
18 {
19 struct timespec x;
20 F(time_t,tv_sec)
21 F(long,tv_nsec)
22 }
23 {
24 struct stat x;
25 F(dev_t, st_dev)
26 F(ino_t, st_ino)
27 F(mode_t, st_mode)
28 F(nlink_t, st_nlink)
29 F(uid_t, st_uid)
30 F(gid_t, st_gid)
31 F(dev_t, st_rdev)
32 F(off_t, st_size)
33 F(struct timespec, st_atim)
34 F(struct timespec, st_mtim)
35 F(struct timespec, st_ctim)
36 F(blksize_t, st_blksize)
37 F(blkcnt_t, st_blocks)
38
39 F(time_t, st_atime)
40 F(time_t, st_mtime)
41 F(time_t, st_ctime)
42 }
43 C(S_IRWXU)
44 C(S_IRUSR)
45 C(S_IWUSR)
46 C(S_IXUSR)
47 C(S_IRWXG)
48 C(S_IRGRP)
49 C(S_IWGRP)
50 C(S_IXGRP)
51 C(S_IRWXO)
52 C(S_IROTH)
53 C(S_IWOTH)
54 C(S_IXOTH)
55 C(S_ISUID)
56 C(S_ISGID)
57 #ifdef _XOPEN_SOURCE
58 C(S_ISVTX)
59 C(S_IFMT)
60 C(S_IFBLK)
61 C(S_IFCHR)
62 C(S_IFIFO)
63 C(S_IFREG)
64 C(S_IFDIR)
65 C(S_IFLNK)
66 C(S_IFSOCK)
67 #endif
68 C(S_ISBLK(0))
69 C(S_ISCHR(0))
70 C(S_ISDIR(0))
71 C(S_ISFIFO(0))
72 C(S_ISREG(0))
73 C(S_ISLNK(0))
74 C(S_ISSOCK(0))
75 {
76 struct stat x = {0};
77 {int i = S_TYPEISMQ(&x);}
78 {int i = S_TYPEISSEM(&x);}
79 {int i = S_TYPEISSHM(&x);}
80 #ifdef POSIX_TYPED_MEMORY_OBJECTS
81 {int i = S_TYPEISTMO(&x);}
82 #endif
83 }
84 C(UTIME_NOW)
85 C(UTIME_OMIT)
86 {int(*p)(const char*,mode_t) = chmod;}
87 {int(*p)(int,mode_t) = fchmod;}
88 {int(*p)(int,const char*,mode_t,int) = fchmodat;}
89 {int(*p)(int,struct stat*) = fstat;}
90 {int(*p)(int,const char*restrict,struct stat*restrict,int) = fstatat;}
91 {int(*p)(int,const struct timespec[]) = futimens;}
92 {int(*p)(const char*restrict,struct stat*restrict) = lstat;}
93 {int(*p)(const char*,mode_t) = mkdir;}
94 {int(*p)(int,const char*,mode_t) = mkdirat;}
95 {int(*p)(const char*,mode_t) = mkfifo;}
96 {int(*p)(int,const char*,mode_t) = mkfifoat;}
97 #ifdef _XOPEN_SOURCE
98 {int(*p)(const char*,mode_t,dev_t) = mknod;}
99 {int(*p)(int,const char*,mode_t,dev_t) = mknodat;}
100 #endif
101 {int(*p)(const char*restrict,struct stat*restrict) = stat;}
102 {mode_t(*p)(mode_t) = umask;}
103 {int(*p)(int,const char*,const struct timespec[],int) = utimensat;}
104 }