pthread-once tests: Fix crash on mingw.
[gnulib.git] / tests / test-unistd-c++.cc
blobd4eef36d5ec30ff371fa1f9c1e5f1ac62a933f4e
1 /* Test of <unistd.h> substitute in C++ mode.
2 Copyright (C) 2010-2024 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 <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2010. */
19 #define GNULIB_NAMESPACE gnulib
20 #include <config.h>
22 #include <unistd.h>
24 #include "signature.h"
27 #if GNULIB_TEST_ACCESS
28 SIGNATURE_CHECK (GNULIB_NAMESPACE::access, int, (const char *, int));
29 #endif
31 #if GNULIB_TEST_CHDIR
32 SIGNATURE_CHECK (GNULIB_NAMESPACE::chdir, int, (const char *));
33 #endif
35 #if GNULIB_TEST_CHOWN
36 SIGNATURE_CHECK (GNULIB_NAMESPACE::chown, int, (const char *, uid_t, gid_t));
37 #endif
39 #if GNULIB_TEST_CLOSE
40 SIGNATURE_CHECK (GNULIB_NAMESPACE::close, int, (int));
41 #endif
43 #if GNULIB_TEST_DUP
44 SIGNATURE_CHECK (GNULIB_NAMESPACE::dup, int, (int));
45 #endif
47 #if GNULIB_TEST_DUP2
48 SIGNATURE_CHECK (GNULIB_NAMESPACE::dup2, int, (int, int));
49 #endif
51 #if GNULIB_TEST_DUP3
52 SIGNATURE_CHECK (GNULIB_NAMESPACE::dup3, int, (int, int, int));
53 #endif
55 #if GNULIB_TEST_EXECL
56 SIGNATURE_CHECK (GNULIB_NAMESPACE::execl, int,
57 (const char *, const char *, ...));
58 #endif
60 #if GNULIB_TEST_EXECLE
61 SIGNATURE_CHECK (GNULIB_NAMESPACE::execle, int,
62 (const char *, const char *, ...));
63 #endif
65 #if GNULIB_TEST_EXECLP
66 SIGNATURE_CHECK (GNULIB_NAMESPACE::execlp, int,
67 (const char *, const char *, ...));
68 #endif
70 #if GNULIB_TEST_EXECV
71 SIGNATURE_CHECK (GNULIB_NAMESPACE::execv, int,
72 (const char *, char * const *));
73 #endif
75 #if GNULIB_TEST_EXECVE
76 SIGNATURE_CHECK (GNULIB_NAMESPACE::execve, int,
77 (const char *, char * const *, char * const *));
78 #endif
80 #if GNULIB_TEST_EXECVP
81 SIGNATURE_CHECK (GNULIB_NAMESPACE::execvp, int,
82 (const char *, char * const *));
83 #endif
85 #if GNULIB_TEST_EXECVPE
86 SIGNATURE_CHECK (GNULIB_NAMESPACE::execvpe, int,
87 (const char *, char * const *, char * const *));
88 #endif
90 #if GNULIB_TEST_EUIDACCESS
91 SIGNATURE_CHECK (GNULIB_NAMESPACE::euidaccess, int, (const char *, int));
92 #endif
94 #if GNULIB_TEST_FACCESSAT
95 SIGNATURE_CHECK (GNULIB_NAMESPACE::faccessat, int,
96 (int, char const *, int, int));
97 #endif
99 #if GNULIB_TEST_FCHDIR
100 SIGNATURE_CHECK (GNULIB_NAMESPACE::fchdir, int, (int));
101 #endif
103 #if GNULIB_TEST_FCHOWNAT
104 SIGNATURE_CHECK (GNULIB_NAMESPACE::fchownat, int,
105 (int, char const *, uid_t, gid_t, int));
106 #endif
108 #if GNULIB_TEST_FDATASYNC
109 SIGNATURE_CHECK (GNULIB_NAMESPACE::fdatasync, int, (int));
110 #endif
112 #if GNULIB_TEST_FSYNC
113 SIGNATURE_CHECK (GNULIB_NAMESPACE::fsync, int, (int));
114 #endif
116 #if GNULIB_TEST_FTRUNCATE
117 SIGNATURE_CHECK (GNULIB_NAMESPACE::ftruncate, int, (int, off_t));
118 #endif
120 #if GNULIB_TEST_GETCWD
121 SIGNATURE_CHECK (GNULIB_NAMESPACE::getcwd, char *, (char *, size_t));
122 #endif
124 #if GNULIB_TEST_GETDOMAINNAME
125 SIGNATURE_CHECK (GNULIB_NAMESPACE::getdomainname, int, (char *, size_t));
126 #endif
128 #if GNULIB_TEST_GETDTABLESIZE
129 SIGNATURE_CHECK (GNULIB_NAMESPACE::getdtablesize, int, (void));
130 #endif
132 #if GNULIB_TEST_GETENTROPY
133 SIGNATURE_CHECK (GNULIB_NAMESPACE::getentropy, int, (void *, size_t));
134 #endif
136 #if GNULIB_TEST_GETGROUPS
137 SIGNATURE_CHECK (GNULIB_NAMESPACE::getgroups, int, (int, gid_t *));
138 #endif
140 #if GNULIB_TEST_GETHOSTNAME
141 SIGNATURE_CHECK (GNULIB_NAMESPACE::gethostname, int, (char *, size_t));
142 #endif
144 #if GNULIB_TEST_GETLOGIN
145 SIGNATURE_CHECK (GNULIB_NAMESPACE::getlogin, char *, (void));
146 #endif
148 #if GNULIB_TEST_GETLOGIN_R
149 SIGNATURE_CHECK (GNULIB_NAMESPACE::getlogin_r, int, (char *, size_t));
150 #endif
152 #if GNULIB_TEST_GETPAGESIZE
153 SIGNATURE_CHECK (GNULIB_NAMESPACE::getpagesize, int, (void));
154 #endif
156 #if GNULIB_TEST_GETPASS
157 SIGNATURE_CHECK (GNULIB_NAMESPACE::getpass, char *, (const char *));
158 #endif
160 #if GNULIB_TEST_GETUSERSHELL
161 SIGNATURE_CHECK (GNULIB_NAMESPACE::getusershell, char *, (void));
162 #endif
164 #if GNULIB_TEST_GETUSERSHELL
165 SIGNATURE_CHECK (GNULIB_NAMESPACE::setusershell, void, (void));
166 #endif
168 #if GNULIB_TEST_GETUSERSHELL
169 SIGNATURE_CHECK (GNULIB_NAMESPACE::endusershell, void, (void));
170 #endif
172 #if GNULIB_TEST_GROUP_MEMBER
173 SIGNATURE_CHECK (GNULIB_NAMESPACE::group_member, int, (gid_t));
174 #endif
176 #if GNULIB_TEST_ISATTY
177 SIGNATURE_CHECK (GNULIB_NAMESPACE::isatty, int, (int));
178 #endif
180 #if GNULIB_TEST_LCHOWN
181 SIGNATURE_CHECK (GNULIB_NAMESPACE::lchown, int, (char const *, uid_t, gid_t));
182 #endif
184 #if GNULIB_TEST_LINK
185 SIGNATURE_CHECK (GNULIB_NAMESPACE::link, int, (const char *, const char *));
186 #endif
188 #if GNULIB_TEST_LINKAT
189 SIGNATURE_CHECK (GNULIB_NAMESPACE::linkat, int,
190 (int, const char *, int, const char *, int));
191 #endif
193 #if GNULIB_TEST_LSEEK
194 SIGNATURE_CHECK (GNULIB_NAMESPACE::lseek, off_t, (int, off_t, int));
195 #endif
197 #if GNULIB_TEST_PIPE
198 SIGNATURE_CHECK (GNULIB_NAMESPACE::pipe, int, (int[2]));
199 #endif
201 #if GNULIB_TEST_PIPE2
202 SIGNATURE_CHECK (GNULIB_NAMESPACE::pipe2, int, (int[2], int));
203 #endif
205 #if GNULIB_TEST_PREAD
206 SIGNATURE_CHECK (GNULIB_NAMESPACE::pread, ssize_t,
207 (int, void *, size_t, off_t));
208 #endif
210 #if GNULIB_TEST_PWRITE
211 SIGNATURE_CHECK (GNULIB_NAMESPACE::pwrite, ssize_t,
212 (int, const void *, size_t, off_t));
213 #endif
215 #if GNULIB_TEST_READ
216 SIGNATURE_CHECK (GNULIB_NAMESPACE::read, ssize_t, (int, void *, size_t));
217 #endif
219 #if GNULIB_TEST_READLINK
220 SIGNATURE_CHECK (GNULIB_NAMESPACE::readlink, ssize_t,
221 (const char *, char *, size_t));
222 #endif
224 #if GNULIB_TEST_READLINKAT
225 SIGNATURE_CHECK (GNULIB_NAMESPACE::readlinkat, ssize_t,
226 (int, char const *, char *, size_t));
227 #endif
229 #if GNULIB_TEST_RMDIR
230 SIGNATURE_CHECK (GNULIB_NAMESPACE::rmdir, int, (char const *));
231 #endif
233 #if GNULIB_TEST_SETHOSTNAME
234 SIGNATURE_CHECK (GNULIB_NAMESPACE::sethostname, int, (const char *, size_t));
235 #endif
237 #if GNULIB_TEST_SLEEP
238 SIGNATURE_CHECK (GNULIB_NAMESPACE::sleep, unsigned int, (unsigned int));
239 #endif
241 #if GNULIB_TEST_SYMLINK
242 SIGNATURE_CHECK (GNULIB_NAMESPACE::symlink, int, (char const *, char const *));
243 #endif
245 #if GNULIB_TEST_SYMLINKAT
246 SIGNATURE_CHECK (GNULIB_NAMESPACE::symlinkat, int,
247 (char const *, int, char const *));
248 #endif
250 #if GNULIB_TEST_TRUNCATE
251 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncate, int, (const char *, off_t));
252 #endif
254 #if GNULIB_TEST_TTYNAME_R
255 SIGNATURE_CHECK (GNULIB_NAMESPACE::ttyname_r, int,
256 (int fd, char *buf, size_t buflen));
257 #endif
259 #if GNULIB_TEST_UNLINK
260 SIGNATURE_CHECK (GNULIB_NAMESPACE::unlink, int, (char const *));
261 #endif
263 #if GNULIB_TEST_UNLINKAT
264 SIGNATURE_CHECK (GNULIB_NAMESPACE::unlinkat, int, (int, char const *, int));
265 #endif
267 #if GNULIB_TEST_USLEEP
268 SIGNATURE_CHECK (GNULIB_NAMESPACE::usleep, int, (useconds_t));
269 #endif
271 #if GNULIB_TEST_WRITE
272 SIGNATURE_CHECK (GNULIB_NAMESPACE::write, ssize_t,
273 (int, const void *, size_t));
274 #endif
278 main ()