flockfile list corruption test
[libc-test] / src / api / fcntl.c
1 #include <fcntl.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 C(F_DUPFD)
9 C(F_DUPFD_CLOEXEC)
10 C(F_GETFD)
11 C(F_SETFD)
12 C(F_GETFL)
13 C(F_SETFL)
14 C(F_GETLK)
15 C(F_SETLK)
16 C(F_SETLKW)
17 C(F_GETOWN)
18 C(F_SETOWN)
19 C(FD_CLOEXEC)
20 C(F_RDLCK)
21 C(F_UNLCK)
22 C(F_WRLCK)
23 C(SEEK_SET)
24 C(SEEK_CUR)
25 C(SEEK_END)
26 C(O_CREAT)
27 C(O_EXCL)
28 C(O_NOCTTY)
29 C(O_TRUNC)
30 C(O_TTY_INIT)
31 C(O_APPEND)
32 C(O_NONBLOCK)
33 #ifdef POSIX_SYNCHRONIZED_IO
34 C(O_DSYNC)
35 C(O_RSYNC)
36 #endif
37 C(O_SYNC)
38 C(O_ACCMODE)
39 C(O_EXEC)
40 C(O_RDONLY)
41 C(O_RDWR)
42 C(O_SEARCH)
43 C(O_WRONLY)
44 C(S_IRWXU)
45 C(S_IRUSR)
46 C(S_IWUSR)
47 C(S_IXUSR)
48 C(S_IRWXG)
49 C(S_IRGRP)
50 C(S_IWGRP)
51 C(S_IXGRP)
52 C(S_IRWXO)
53 C(S_IROTH)
54 C(S_IWOTH)
55 C(S_IXOTH)
56 C(S_ISUID)
57 C(S_ISGID)
58 #ifdef _XOPEN_SOURCE
59 C(S_ISVTX)
60 #endif
61 C(AT_FDCWD)
62 C(AT_EACCESS)
63 C(AT_SYMLINK_NOFOLLOW)
64 C(AT_SYMLINK_FOLLOW)
65 C(O_CLOEXEC)
66 C(O_DIRECTORY)
67 C(O_NOFOLLOW)
68 C(AT_REMOVEDIR)
69 C(POSIX_FADV_DONTNEED)
70 C(POSIX_FADV_NOREUSE)
71 C(POSIX_FADV_NORMAL)
72 C(POSIX_FADV_RANDOM)
73 C(POSIX_FADV_SEQUENTIAL)
74 C(POSIX_FADV_WILLNEED)
75
76 {
77 struct flock x;
78 F(short, l_type)
79 F(short, l_whence)
80 F(off_t, l_start)
81 F(off_t, l_len)
82 F(pid_t, l_pid)
83 }
84
85 T(mode_t)
86 T(off_t)
87 T(pid_t)
88
89 {int(*p)(int,int,...) = fcntl;}
90 {int(*p)(int,off_t,off_t,int) = posix_fadvise;}
91 {int(*p)(int,off_t,off_t) = posix_fallocate;}
92 }
93 #ifndef _XOPEN_SOURCE
94 #include <sys/stat.h>
95 #endif
96 static void g()
97 {
98 {int(*p)(const char*,mode_t) = creat;}
99 {int(*p)(const char*,int,...) = open;}
100 {int(*p)(int,const char*,int,...) = openat;}
101 }