update api tests with options
[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 T(struct timespec)
19
20 {
21 struct stat x;
22 F(dev_t, st_dev)
23 F(ino_t, st_ino)
24 F(mode_t, st_mode)
25 F(nlink_t, st_nlink)
26 F(uid_t, st_uid)
27 F(gid_t, st_gid)
28 F(dev_t, st_rdev)
29 F(off_t, st_size)
30 F(struct timespec, st_atim)
31 F(struct timespec, st_mtim)
32 F(struct timespec, st_ctim)
33 F(blksize_t, st_blksize)
34 F(blkcnt_t, st_blocks)
35
36 F(time_t, st_atime)
37 F(time_t, st_mtime)
38 F(time_t, st_ctime)
39 }
40 C(S_IRWXU)
41 C(S_IRUSR)
42 C(S_IWUSR)
43 C(S_IXUSR)
44 C(S_IRWXG)
45 C(S_IRGRP)
46 C(S_IWGRP)
47 C(S_IXGRP)
48 C(S_IRWXO)
49 C(S_IROTH)
50 C(S_IWOTH)
51 C(S_IXOTH)
52 C(S_ISUID)
53 C(S_ISGID)
54 #ifdef _XOPEN_SOURCE
55 C(S_ISVTX)
56 C(S_IFMT)
57 C(S_IFBLK)
58 C(S_IFCHR)
59 C(S_IFIFO)
60 C(S_IFREG)
61 C(S_IFDIR)
62 C(S_IFLNK)
63 C(S_IFSOCK)
64 #endif
65 C(S_ISBLK(0))
66 C(S_ISCHR(0))
67 C(S_ISDIR(0))
68 C(S_ISFIFO(0))
69 C(S_ISREG(0))
70 C(S_ISLNK(0))
71 C(S_ISSOCK(0))
72 {
73 struct stat x = {0};
74 {int i = S_TYPEISMQ(&x);}
75 {int i = S_TYPEISSEM(&x);}
76 {int i = S_TYPEISSHM(&x);}
77 #ifdef POSIX_TYPED_MEMORY_OBJECTS
78 {int i = S_TYPEISTMO(&x);}
79 #endif
80 }
81 C(UTIME_NOW)
82 C(UTIME_OMIT)
83 {int(*p)(const char*,mode_t) = chmod;}
84 {int(*p)(int,mode_t) = fchmod;}
85 {int(*p)(int,const char*,mode_t,int) = fchmodat;}
86 {int(*p)(int,struct stat*) = fstat;}
87 {int(*p)(int,const char*restrict,struct stat*restrict,int) = fstatat;}
88 {int(*p)(int,const struct timespec[]) = futimens;}
89 {int(*p)(const char*restrict,struct stat*restrict) = lstat;}
90 {int(*p)(const char*,mode_t) = mkdir;}
91 {int(*p)(int,const char*,mode_t) = mkdirat;}
92 {int(*p)(const char*,mode_t) = mkfifo;}
93 {int(*p)(int,const char*,mode_t) = mkfifoat;}
94 #ifdef _XOPEN_SOURCE
95 {int(*p)(const char*,mode_t,dev_t) = mknod;}
96 {int(*p)(int,const char*,mode_t,dev_t) = mknodat;}
97 #endif
98 {int(*p)(const char*restrict,struct stat*restrict) = stat;}
99 {mode_t(*p)(mode_t) = umask;}
100 {int(*p)(int,const char*,const struct timespec[],int) = utimensat;}
101 }