Added test to verify that callbacks are being actually called.
[gnutls.git] / gl / tests / test-fcntl-h.c
blob00c5468dff815313a4dfbdd94fc47cb75a027bf4
1 /* Test of <fcntl.h> substitute.
2 Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */
19 #include <config.h>
21 #include <fcntl.h>
23 /* Check that the various O_* macros are defined. */
24 int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK
25 | O_NOCTTY | O_NOFOLLOW | O_NOLINKS | O_RSYNC | O_SYNC | O_TTY_INIT
26 | O_BINARY | O_TEXT;
28 /* Check that the various SEEK_* macros are defined. */
29 int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
31 /* Check that the FD_* macros are defined. */
32 int i = FD_CLOEXEC;
34 /* Check that the types are all defined. */
35 pid_t t1;
36 off_t t2;
37 mode_t t3;
39 int
40 main (void)
42 /* Ensure no overlap in SEEK_*. */
43 switch (0)
45 case SEEK_CUR:
46 case SEEK_END:
47 case SEEK_SET:
51 /* Ensure no dangerous overlap in non-zero gnulib-defined replacements. */
52 switch (O_RDONLY)
54 /* Access modes */
55 case O_RDONLY:
56 case O_WRONLY:
57 case O_RDWR:
58 #if O_EXEC && O_EXEC != O_RDONLY
59 case O_EXEC:
60 #endif
61 #if O_SEARCH && O_EXEC != O_SEARCH && O_SEARCH != O_RDONLY
62 case O_SEARCH:
63 #endif
64 i = O_ACCMODE == (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH);
65 break;
67 /* Everyone should have these */
68 case O_CREAT:
69 case O_EXCL:
70 case O_TRUNC:
71 case O_APPEND:
72 break;
74 /* These might be 0 or O_RDONLY, only test non-zero versions. */
75 #if O_CLOEXEC
76 case O_CLOEXEC:
77 #endif
78 #if O_DIRECT
79 case O_DIRECT:
80 #endif
81 #if O_DIRECTORY
82 case O_DIRECTORY:
83 #endif
84 #if O_DSYNC
85 case O_DSYNC:
86 #endif
87 #if O_NOATIME
88 case O_NOATIME:
89 #endif
90 #if O_NONBLOCK
91 case O_NONBLOCK:
92 #endif
93 #if O_NOCTTY
94 case O_NOCTTY:
95 #endif
96 #if O_NOFOLLOW
97 case O_NOFOLLOW:
98 #endif
99 #if O_NOLINKS
100 case O_NOLINKS:
101 #endif
102 #if O_RSYNC && O_RSYNC != O_DSYNC
103 case O_RSYNC:
104 #endif
105 #if O_SYNC && O_SYNC != O_RSYNC
106 case O_SYNC:
107 #endif
108 #if O_TTY_INIT
109 case O_TTY_INIT:
110 #endif
111 #if O_BINARY
112 case O_BINARY:
113 #endif
114 #if O_TEXT
115 case O_TEXT:
116 #endif
120 return !i;