1 | /* Substitute for and wrapper around <unistd.h>.
|
---|
2 | Copyright (C) 2003-2022 Free Software Foundation, Inc.
|
---|
3 |
|
---|
4 | This file is free software: you can redistribute it and/or modify
|
---|
5 | it under the terms of the GNU Lesser General Public License as
|
---|
6 | published by the Free Software Foundation; either version 2.1 of the
|
---|
7 | License, or (at your option) any later version.
|
---|
8 |
|
---|
9 | This file 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 Lesser General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU Lesser General Public License
|
---|
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
---|
16 |
|
---|
17 | #ifndef _@GUARD_PREFIX@_UNISTD_H
|
---|
18 |
|
---|
19 | #if __GNUC__ >= 3
|
---|
20 | @PRAGMA_SYSTEM_HEADER@
|
---|
21 | #endif
|
---|
22 | @PRAGMA_COLUMNS@
|
---|
23 |
|
---|
24 | #if @HAVE_UNISTD_H@ && defined _GL_INCLUDING_UNISTD_H
|
---|
25 | /* Special invocation convention:
|
---|
26 | - On Mac OS X 10.3.9 we have a sequence of nested includes
|
---|
27 | <unistd.h> -> <signal.h> -> <pthread.h> -> <unistd.h>
|
---|
28 | In this situation, the functions are not yet declared, therefore we cannot
|
---|
29 | provide the C++ aliases. */
|
---|
30 |
|
---|
31 | #@INCLUDE_NEXT@ @NEXT_UNISTD_H@
|
---|
32 |
|
---|
33 | #else
|
---|
34 | /* Normal invocation convention. */
|
---|
35 |
|
---|
36 | /* The include_next requires a split double-inclusion guard. */
|
---|
37 | #if @HAVE_UNISTD_H@
|
---|
38 | # define _GL_INCLUDING_UNISTD_H
|
---|
39 | # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
|
---|
40 | # undef _GL_INCLUDING_UNISTD_H
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | /* Get all possible declarations of gethostname(). */
|
---|
44 | #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
|
---|
45 | && !defined _GL_INCLUDING_WINSOCK2_H
|
---|
46 | # define _GL_INCLUDING_WINSOCK2_H
|
---|
47 | # include <winsock2.h>
|
---|
48 | # undef _GL_INCLUDING_WINSOCK2_H
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
|
---|
52 | #define _@GUARD_PREFIX@_UNISTD_H
|
---|
53 |
|
---|
54 | /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
|
---|
55 | /* But avoid namespace pollution on glibc systems. */
|
---|
56 | #ifndef __GLIBC__
|
---|
57 | # include <stddef.h>
|
---|
58 | #endif
|
---|
59 |
|
---|
60 | /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
|
---|
61 | /* MSVC declares 'unlink' in <stdio.h>, not in <unistd.h>. We must include
|
---|
62 | it before we #define unlink rpl_unlink. */
|
---|
63 | /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
|
---|
64 | /* But avoid namespace pollution on glibc systems. */
|
---|
65 | #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
|
---|
66 | || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \
|
---|
67 | && (defined _WIN32 && ! defined __CYGWIN__)) \
|
---|
68 | || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
|
---|
69 | && defined __CYGWIN__)) \
|
---|
70 | && ! defined __GLIBC__
|
---|
71 | # include <stdio.h>
|
---|
72 | #endif
|
---|
73 |
|
---|
74 | /* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
|
---|
75 | <unistd.h>. */
|
---|
76 | /* But avoid namespace pollution on glibc systems. */
|
---|
77 | #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
|
---|
78 | && (defined __CYGWIN__ || defined __ANDROID__) \
|
---|
79 | && ! defined __GLIBC__
|
---|
80 | # include <fcntl.h>
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | /* mingw fails to declare _exit in <unistd.h>. */
|
---|
84 | /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
|
---|
85 | <unistd.h>. */
|
---|
86 | /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
|
---|
87 | /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
|
---|
88 | included here. */
|
---|
89 | /* But avoid namespace pollution on glibc systems. */
|
---|
90 | #if !defined __GLIBC__ && !defined __osf__
|
---|
91 | # define __need_system_stdlib_h
|
---|
92 | # include <stdlib.h>
|
---|
93 | # undef __need_system_stdlib_h
|
---|
94 | #endif
|
---|
95 |
|
---|
96 | /* Native Windows platforms declare _chdir, _getcwd, _rmdir in
|
---|
97 | <io.h> and/or <direct.h>, not in <unistd.h>.
|
---|
98 | They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
|
---|
99 | _lseek(), _read(), _unlink(), _write() in <io.h>. */
|
---|
100 | #if defined _WIN32 && !defined __CYGWIN__
|
---|
101 | # include <io.h>
|
---|
102 | # include <direct.h>
|
---|
103 | #endif
|
---|
104 |
|
---|
105 | /* Native Windows platforms declare _execl*, _execv* in <process.h>. */
|
---|
106 | #if defined _WIN32 && !defined __CYGWIN__
|
---|
107 | # include <process.h>
|
---|
108 | #endif
|
---|
109 |
|
---|
110 | /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
|
---|
111 | NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
|
---|
112 | /* But avoid namespace pollution on glibc systems. */
|
---|
113 | #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
|
---|
114 | || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
|
---|
115 | && !defined __GLIBC__
|
---|
116 | # include <netdb.h>
|
---|
117 | #endif
|
---|
118 |
|
---|
119 | /* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in
|
---|
120 | <sys/random.h>, not in <unistd.h>. */
|
---|
121 | /* But avoid namespace pollution on glibc systems. */
|
---|
122 | #if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \
|
---|
123 | && ((defined __APPLE__ && defined __MACH__) || defined __sun \
|
---|
124 | || defined __ANDROID__) \
|
---|
125 | && @UNISTD_H_HAVE_SYS_RANDOM_H@ \
|
---|
126 | && !defined __GLIBC__
|
---|
127 | # include <sys/random.h>
|
---|
128 | #endif
|
---|
129 |
|
---|
130 | /* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */
|
---|
131 | /* But avoid namespace pollution on glibc systems. */
|
---|
132 | #if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
|
---|
133 | && !defined __GLIBC__
|
---|
134 | # include <sys/stat.h>
|
---|
135 | #endif
|
---|
136 |
|
---|
137 | /* MSVC defines off_t in <sys/types.h>.
|
---|
138 | May also define off_t to a 64-bit type on native Windows. */
|
---|
139 | /* Get off_t, ssize_t, mode_t. */
|
---|
140 | #include <sys/types.h>
|
---|
141 |
|
---|
142 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
---|
143 |
|
---|
144 | /* The definition of _GL_ARG_NONNULL is copied here. */
|
---|
145 |
|
---|
146 | /* The definition of _GL_WARN_ON_USE is copied here. */
|
---|
147 |
|
---|
148 |
|
---|
149 | /* Get getopt(), optarg, optind, opterr, optopt. */
|
---|
150 | #if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
|
---|
151 | # include <getopt-cdefs.h>
|
---|
152 | # include <getopt-pfx-core.h>
|
---|
153 | #endif
|
---|
154 |
|
---|
155 | #ifndef _GL_INLINE_HEADER_BEGIN
|
---|
156 | #error "Please include config.h first."
|
---|
157 | #endif
|
---|
158 | _GL_INLINE_HEADER_BEGIN
|
---|
159 | #ifndef _GL_UNISTD_INLINE
|
---|
160 | # define _GL_UNISTD_INLINE _GL_INLINE
|
---|
161 | #endif
|
---|
162 |
|
---|
163 | /* Hide some function declarations from <winsock2.h>. */
|
---|
164 |
|
---|
165 | #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
|
---|
166 | # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
|
---|
167 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
168 | # undef socket
|
---|
169 | # define socket socket_used_without_including_sys_socket_h
|
---|
170 | # undef connect
|
---|
171 | # define connect connect_used_without_including_sys_socket_h
|
---|
172 | # undef accept
|
---|
173 | # define accept accept_used_without_including_sys_socket_h
|
---|
174 | # undef bind
|
---|
175 | # define bind bind_used_without_including_sys_socket_h
|
---|
176 | # undef getpeername
|
---|
177 | # define getpeername getpeername_used_without_including_sys_socket_h
|
---|
178 | # undef getsockname
|
---|
179 | # define getsockname getsockname_used_without_including_sys_socket_h
|
---|
180 | # undef getsockopt
|
---|
181 | # define getsockopt getsockopt_used_without_including_sys_socket_h
|
---|
182 | # undef listen
|
---|
183 | # define listen listen_used_without_including_sys_socket_h
|
---|
184 | # undef recv
|
---|
185 | # define recv recv_used_without_including_sys_socket_h
|
---|
186 | # undef send
|
---|
187 | # define send send_used_without_including_sys_socket_h
|
---|
188 | # undef recvfrom
|
---|
189 | # define recvfrom recvfrom_used_without_including_sys_socket_h
|
---|
190 | # undef sendto
|
---|
191 | # define sendto sendto_used_without_including_sys_socket_h
|
---|
192 | # undef setsockopt
|
---|
193 | # define setsockopt setsockopt_used_without_including_sys_socket_h
|
---|
194 | # undef shutdown
|
---|
195 | # define shutdown shutdown_used_without_including_sys_socket_h
|
---|
196 | # else
|
---|
197 | _GL_WARN_ON_USE (socket,
|
---|
198 | "socket() used without including <sys/socket.h>");
|
---|
199 | _GL_WARN_ON_USE (connect,
|
---|
200 | "connect() used without including <sys/socket.h>");
|
---|
201 | _GL_WARN_ON_USE (accept,
|
---|
202 | "accept() used without including <sys/socket.h>");
|
---|
203 | _GL_WARN_ON_USE (bind,
|
---|
204 | "bind() used without including <sys/socket.h>");
|
---|
205 | _GL_WARN_ON_USE (getpeername,
|
---|
206 | "getpeername() used without including <sys/socket.h>");
|
---|
207 | _GL_WARN_ON_USE (getsockname,
|
---|
208 | "getsockname() used without including <sys/socket.h>");
|
---|
209 | _GL_WARN_ON_USE (getsockopt,
|
---|
210 | "getsockopt() used without including <sys/socket.h>");
|
---|
211 | _GL_WARN_ON_USE (listen,
|
---|
212 | "listen() used without including <sys/socket.h>");
|
---|
213 | _GL_WARN_ON_USE (recv,
|
---|
214 | "recv() used without including <sys/socket.h>");
|
---|
215 | _GL_WARN_ON_USE (send,
|
---|
216 | "send() used without including <sys/socket.h>");
|
---|
217 | _GL_WARN_ON_USE (recvfrom,
|
---|
218 | "recvfrom() used without including <sys/socket.h>");
|
---|
219 | _GL_WARN_ON_USE (sendto,
|
---|
220 | "sendto() used without including <sys/socket.h>");
|
---|
221 | _GL_WARN_ON_USE (setsockopt,
|
---|
222 | "setsockopt() used without including <sys/socket.h>");
|
---|
223 | _GL_WARN_ON_USE (shutdown,
|
---|
224 | "shutdown() used without including <sys/socket.h>");
|
---|
225 | # endif
|
---|
226 | # endif
|
---|
227 | # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
|
---|
228 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
229 | # undef select
|
---|
230 | # define select select_used_without_including_sys_select_h
|
---|
231 | # else
|
---|
232 | _GL_WARN_ON_USE (select,
|
---|
233 | "select() used without including <sys/select.h>");
|
---|
234 | # endif
|
---|
235 | # endif
|
---|
236 | #endif
|
---|
237 |
|
---|
238 |
|
---|
239 | /* OS/2 EMX lacks these macros. */
|
---|
240 | #ifndef STDIN_FILENO
|
---|
241 | # define STDIN_FILENO 0
|
---|
242 | #endif
|
---|
243 | #ifndef STDOUT_FILENO
|
---|
244 | # define STDOUT_FILENO 1
|
---|
245 | #endif
|
---|
246 | #ifndef STDERR_FILENO
|
---|
247 | # define STDERR_FILENO 2
|
---|
248 | #endif
|
---|
249 |
|
---|
250 | /* Ensure *_OK macros exist. */
|
---|
251 | #ifndef F_OK
|
---|
252 | # define F_OK 0
|
---|
253 | # define X_OK 1
|
---|
254 | # define W_OK 2
|
---|
255 | # define R_OK 4
|
---|
256 | #endif
|
---|
257 |
|
---|
258 |
|
---|
259 | /* Declare overridden functions. */
|
---|
260 |
|
---|
261 |
|
---|
262 | #if @GNULIB_ACCESS@
|
---|
263 | # if @REPLACE_ACCESS@
|
---|
264 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
265 | # undef access
|
---|
266 | # define access rpl_access
|
---|
267 | # endif
|
---|
268 | _GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
|
---|
269 | _GL_ARG_NONNULL ((1)));
|
---|
270 | _GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
|
---|
271 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
272 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
273 | # undef access
|
---|
274 | # define access _access
|
---|
275 | # endif
|
---|
276 | _GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
|
---|
277 | # else
|
---|
278 | _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
|
---|
279 | # endif
|
---|
280 | _GL_CXXALIASWARN (access);
|
---|
281 | #elif defined GNULIB_POSIXCHECK
|
---|
282 | # undef access
|
---|
283 | # if HAVE_RAW_DECL_ACCESS
|
---|
284 | /* The access() function is a security risk. */
|
---|
285 | _GL_WARN_ON_USE (access, "access does not always support X_OK - "
|
---|
286 | "use gnulib module access for portability; "
|
---|
287 | "also, this function is a security risk - "
|
---|
288 | "use the gnulib module faccessat instead");
|
---|
289 | # endif
|
---|
290 | #elif @GNULIB_MDA_ACCESS@
|
---|
291 | /* On native Windows, map 'access' to '_access', so that -loldnames is not
|
---|
292 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
293 | platforms by defining GNULIB_NAMESPACE::access always. */
|
---|
294 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
295 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
296 | # undef access
|
---|
297 | # define access _access
|
---|
298 | # endif
|
---|
299 | _GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
|
---|
300 | # else
|
---|
301 | _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
|
---|
302 | # endif
|
---|
303 | _GL_CXXALIASWARN (access);
|
---|
304 | #endif
|
---|
305 |
|
---|
306 |
|
---|
307 | #if @GNULIB_CHDIR@
|
---|
308 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
309 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
310 | # undef chdir
|
---|
311 | # define chdir _chdir
|
---|
312 | # endif
|
---|
313 | _GL_CXXALIAS_MDA (chdir, int, (const char *file));
|
---|
314 | # else
|
---|
315 | _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
|
---|
316 | # endif
|
---|
317 | _GL_CXXALIASWARN (chdir);
|
---|
318 | #elif defined GNULIB_POSIXCHECK
|
---|
319 | # undef chdir
|
---|
320 | # if HAVE_RAW_DECL_CHDIR
|
---|
321 | _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
|
---|
322 | "use gnulib module chdir for portability");
|
---|
323 | # endif
|
---|
324 | #elif @GNULIB_MDA_CHDIR@
|
---|
325 | /* On native Windows, map 'chdir' to '_chdir', so that -loldnames is not
|
---|
326 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
327 | platforms by defining GNULIB_NAMESPACE::chdir always. */
|
---|
328 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
329 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
330 | # undef chdir
|
---|
331 | # define chdir _chdir
|
---|
332 | # endif
|
---|
333 | _GL_CXXALIAS_MDA (chdir, int, (const char *file));
|
---|
334 | # else
|
---|
335 | _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
|
---|
336 | # endif
|
---|
337 | _GL_CXXALIASWARN (chdir);
|
---|
338 | #endif
|
---|
339 |
|
---|
340 |
|
---|
341 | #if @GNULIB_CHOWN@
|
---|
342 | /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
|
---|
343 | to GID (if GID is not -1). Follow symbolic links.
|
---|
344 | Return 0 if successful, otherwise -1 and errno set.
|
---|
345 | See the POSIX:2008 specification
|
---|
346 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
|
---|
347 | # if @REPLACE_CHOWN@
|
---|
348 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
349 | # undef chown
|
---|
350 | # define chown rpl_chown
|
---|
351 | # endif
|
---|
352 | _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
|
---|
353 | _GL_ARG_NONNULL ((1)));
|
---|
354 | _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
|
---|
355 | # else
|
---|
356 | # if !@HAVE_CHOWN@
|
---|
357 | _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
|
---|
358 | _GL_ARG_NONNULL ((1)));
|
---|
359 | # endif
|
---|
360 | _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
|
---|
361 | # endif
|
---|
362 | _GL_CXXALIASWARN (chown);
|
---|
363 | #elif defined GNULIB_POSIXCHECK
|
---|
364 | # undef chown
|
---|
365 | # if HAVE_RAW_DECL_CHOWN
|
---|
366 | _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
|
---|
367 | "doesn't treat a uid or gid of -1 on some systems - "
|
---|
368 | "use gnulib module chown for portability");
|
---|
369 | # endif
|
---|
370 | #endif
|
---|
371 |
|
---|
372 |
|
---|
373 | #if @GNULIB_CLOSE@
|
---|
374 | # if @REPLACE_CLOSE@
|
---|
375 | /* Automatically included by modules that need a replacement for close. */
|
---|
376 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
377 | # undef close
|
---|
378 | # define close rpl_close
|
---|
379 | # endif
|
---|
380 | _GL_FUNCDECL_RPL (close, int, (int fd));
|
---|
381 | _GL_CXXALIAS_RPL (close, int, (int fd));
|
---|
382 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
383 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
384 | # undef close
|
---|
385 | # define close _close
|
---|
386 | # endif
|
---|
387 | _GL_CXXALIAS_MDA (close, int, (int fd));
|
---|
388 | # else
|
---|
389 | _GL_CXXALIAS_SYS (close, int, (int fd));
|
---|
390 | # endif
|
---|
391 | _GL_CXXALIASWARN (close);
|
---|
392 | #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
|
---|
393 | # undef close
|
---|
394 | # define close close_used_without_requesting_gnulib_module_close
|
---|
395 | #elif defined GNULIB_POSIXCHECK
|
---|
396 | # undef close
|
---|
397 | /* Assume close is always declared. */
|
---|
398 | _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
|
---|
399 | "use gnulib module close for portability");
|
---|
400 | #elif @GNULIB_MDA_CLOSE@
|
---|
401 | /* On native Windows, map 'close' to '_close', so that -loldnames is not
|
---|
402 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
403 | platforms by defining GNULIB_NAMESPACE::close always. */
|
---|
404 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
405 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
406 | # undef close
|
---|
407 | # define close _close
|
---|
408 | # endif
|
---|
409 | _GL_CXXALIAS_MDA (close, int, (int fd));
|
---|
410 | # else
|
---|
411 | _GL_CXXALIAS_SYS (close, int, (int fd));
|
---|
412 | # endif
|
---|
413 | _GL_CXXALIASWARN (close);
|
---|
414 | #endif
|
---|
415 |
|
---|
416 |
|
---|
417 | #if @GNULIB_COPY_FILE_RANGE@
|
---|
418 | # if @REPLACE_COPY_FILE_RANGE@
|
---|
419 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
420 | # undef copy_file_range
|
---|
421 | # define copy_file_range rpl_copy_file_range
|
---|
422 | # endif
|
---|
423 | _GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
|
---|
424 | int ofd, off_t *opos,
|
---|
425 | size_t len, unsigned flags));
|
---|
426 | _GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
|
---|
427 | int ofd, off_t *opos,
|
---|
428 | size_t len, unsigned flags));
|
---|
429 | # else
|
---|
430 | # if !@HAVE_COPY_FILE_RANGE@
|
---|
431 | _GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
|
---|
432 | int ofd, off_t *opos,
|
---|
433 | size_t len, unsigned flags));
|
---|
434 | # endif
|
---|
435 | _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
|
---|
436 | int ofd, off_t *opos,
|
---|
437 | size_t len, unsigned flags));
|
---|
438 | # endif
|
---|
439 | _GL_CXXALIASWARN (copy_file_range);
|
---|
440 | #elif defined GNULIB_POSIXCHECK
|
---|
441 | # undef copy_file_range
|
---|
442 | # if HAVE_RAW_DECL_COPY_FILE_RANGE
|
---|
443 | _GL_WARN_ON_USE (copy_file_range,
|
---|
444 | "copy_file_range is unportable - "
|
---|
445 | "use gnulib module copy_file_range for portability");
|
---|
446 | # endif
|
---|
447 | #endif
|
---|
448 |
|
---|
449 |
|
---|
450 | #if @GNULIB_DUP@
|
---|
451 | # if @REPLACE_DUP@
|
---|
452 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
453 | # define dup rpl_dup
|
---|
454 | # endif
|
---|
455 | _GL_FUNCDECL_RPL (dup, int, (int oldfd));
|
---|
456 | _GL_CXXALIAS_RPL (dup, int, (int oldfd));
|
---|
457 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
458 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
459 | # undef dup
|
---|
460 | # define dup _dup
|
---|
461 | # endif
|
---|
462 | _GL_CXXALIAS_MDA (dup, int, (int oldfd));
|
---|
463 | # else
|
---|
464 | _GL_CXXALIAS_SYS (dup, int, (int oldfd));
|
---|
465 | # endif
|
---|
466 | _GL_CXXALIASWARN (dup);
|
---|
467 | #elif defined GNULIB_POSIXCHECK
|
---|
468 | # undef dup
|
---|
469 | # if HAVE_RAW_DECL_DUP
|
---|
470 | _GL_WARN_ON_USE (dup, "dup is unportable - "
|
---|
471 | "use gnulib module dup for portability");
|
---|
472 | # endif
|
---|
473 | #elif @GNULIB_MDA_DUP@
|
---|
474 | /* On native Windows, map 'dup' to '_dup', so that -loldnames is not
|
---|
475 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
476 | platforms by defining GNULIB_NAMESPACE::dup always. */
|
---|
477 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
478 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
479 | # undef dup
|
---|
480 | # define dup _dup
|
---|
481 | # endif
|
---|
482 | _GL_CXXALIAS_MDA (dup, int, (int oldfd));
|
---|
483 | # else
|
---|
484 | _GL_CXXALIAS_SYS (dup, int, (int oldfd));
|
---|
485 | # endif
|
---|
486 | _GL_CXXALIASWARN (dup);
|
---|
487 | #endif
|
---|
488 |
|
---|
489 |
|
---|
490 | #if @GNULIB_DUP2@
|
---|
491 | /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
|
---|
492 | NEWFD = OLDFD, otherwise close NEWFD first if it is open.
|
---|
493 | Return newfd if successful, otherwise -1 and errno set.
|
---|
494 | See the POSIX:2008 specification
|
---|
495 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
|
---|
496 | # if @REPLACE_DUP2@
|
---|
497 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
498 | # define dup2 rpl_dup2
|
---|
499 | # endif
|
---|
500 | _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
|
---|
501 | _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
|
---|
502 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
503 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
504 | # undef dup2
|
---|
505 | # define dup2 _dup2
|
---|
506 | # endif
|
---|
507 | _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
|
---|
508 | # else
|
---|
509 | _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
|
---|
510 | # endif
|
---|
511 | _GL_CXXALIASWARN (dup2);
|
---|
512 | #elif defined GNULIB_POSIXCHECK
|
---|
513 | # undef dup2
|
---|
514 | # if HAVE_RAW_DECL_DUP2
|
---|
515 | _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
|
---|
516 | "use gnulib module dup2 for portability");
|
---|
517 | # endif
|
---|
518 | #elif @GNULIB_MDA_DUP2@
|
---|
519 | /* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not
|
---|
520 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
521 | platforms by defining GNULIB_NAMESPACE::dup2 always. */
|
---|
522 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
523 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
524 | # undef dup2
|
---|
525 | # define dup2 _dup2
|
---|
526 | # endif
|
---|
527 | _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
|
---|
528 | # else
|
---|
529 | _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
|
---|
530 | # endif
|
---|
531 | _GL_CXXALIASWARN (dup2);
|
---|
532 | #endif
|
---|
533 |
|
---|
534 |
|
---|
535 | #if @GNULIB_DUP3@
|
---|
536 | /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
|
---|
537 | specified flags.
|
---|
538 | The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
|
---|
539 | and O_TEXT, O_BINARY (defined in "binary-io.h").
|
---|
540 | Close NEWFD first if it is open.
|
---|
541 | Return newfd if successful, otherwise -1 and errno set.
|
---|
542 | See the Linux man page at
|
---|
543 | <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
|
---|
544 | # if @HAVE_DUP3@
|
---|
545 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
546 | # define dup3 rpl_dup3
|
---|
547 | # endif
|
---|
548 | _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
|
---|
549 | _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
|
---|
550 | # else
|
---|
551 | _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
|
---|
552 | _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
|
---|
553 | # endif
|
---|
554 | _GL_CXXALIASWARN (dup3);
|
---|
555 | #elif defined GNULIB_POSIXCHECK
|
---|
556 | # undef dup3
|
---|
557 | # if HAVE_RAW_DECL_DUP3
|
---|
558 | _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
|
---|
559 | "use gnulib module dup3 for portability");
|
---|
560 | # endif
|
---|
561 | #endif
|
---|
562 |
|
---|
563 |
|
---|
564 | #if @GNULIB_ENVIRON@
|
---|
565 | # if defined __CYGWIN__ && !defined __i386__
|
---|
566 | /* The 'environ' variable is defined in a DLL. Therefore its declaration needs
|
---|
567 | the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it.
|
---|
568 | This leads to a link error on 64-bit Cygwin when the option
|
---|
569 | -Wl,--disable-auto-import is in use. */
|
---|
570 | _GL_EXTERN_C __declspec(dllimport) char **environ;
|
---|
571 | # endif
|
---|
572 | # if !@HAVE_DECL_ENVIRON@
|
---|
573 | /* Set of environment variables and values. An array of strings of the form
|
---|
574 | "VARIABLE=VALUE", terminated with a NULL. */
|
---|
575 | # if defined __APPLE__ && defined __MACH__
|
---|
576 | # include <TargetConditionals.h>
|
---|
577 | # if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
|
---|
578 | # define _GL_USE_CRT_EXTERNS
|
---|
579 | # endif
|
---|
580 | # endif
|
---|
581 | # ifdef _GL_USE_CRT_EXTERNS
|
---|
582 | # include <crt_externs.h>
|
---|
583 | # define environ (*_NSGetEnviron ())
|
---|
584 | # else
|
---|
585 | # ifdef __cplusplus
|
---|
586 | extern "C" {
|
---|
587 | # endif
|
---|
588 | extern char **environ;
|
---|
589 | # ifdef __cplusplus
|
---|
590 | }
|
---|
591 | # endif
|
---|
592 | # endif
|
---|
593 | # endif
|
---|
594 | #elif defined GNULIB_POSIXCHECK
|
---|
595 | # if HAVE_RAW_DECL_ENVIRON
|
---|
596 | _GL_UNISTD_INLINE char ***
|
---|
597 | _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - "
|
---|
598 | "use gnulib module environ for portability")
|
---|
599 | rpl_environ (void)
|
---|
600 | {
|
---|
601 | return &environ;
|
---|
602 | }
|
---|
603 | # undef environ
|
---|
604 | # define environ (*rpl_environ ())
|
---|
605 | # endif
|
---|
606 | #endif
|
---|
607 |
|
---|
608 |
|
---|
609 | #if @GNULIB_EUIDACCESS@
|
---|
610 | /* Like access(), except that it uses the effective user id and group id of
|
---|
611 | the current process. */
|
---|
612 | # if !@HAVE_EUIDACCESS@
|
---|
613 | _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
|
---|
614 | _GL_ARG_NONNULL ((1)));
|
---|
615 | # endif
|
---|
616 | _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
|
---|
617 | _GL_CXXALIASWARN (euidaccess);
|
---|
618 | # if defined GNULIB_POSIXCHECK
|
---|
619 | /* Like access(), this function is a security risk. */
|
---|
620 | _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
|
---|
621 | "use the gnulib module faccessat instead");
|
---|
622 | # endif
|
---|
623 | #elif defined GNULIB_POSIXCHECK
|
---|
624 | # undef euidaccess
|
---|
625 | # if HAVE_RAW_DECL_EUIDACCESS
|
---|
626 | _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
|
---|
627 | "use gnulib module euidaccess for portability");
|
---|
628 | # endif
|
---|
629 | #endif
|
---|
630 |
|
---|
631 |
|
---|
632 | #if @GNULIB_EXECL@
|
---|
633 | # if @REPLACE_EXECL@
|
---|
634 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
635 | # undef execl
|
---|
636 | # define execl rpl_execl
|
---|
637 | # endif
|
---|
638 | _GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...)
|
---|
639 | _GL_ARG_NONNULL ((1)));
|
---|
640 | _GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
|
---|
641 | # else
|
---|
642 | _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
|
---|
643 | # endif
|
---|
644 | _GL_CXXALIASWARN (execl);
|
---|
645 | #elif defined GNULIB_POSIXCHECK
|
---|
646 | # undef execl
|
---|
647 | # if HAVE_RAW_DECL_EXECL
|
---|
648 | _GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - "
|
---|
649 | "use gnulib module execl for portability");
|
---|
650 | # endif
|
---|
651 | #elif @GNULIB_MDA_EXECL@
|
---|
652 | /* On native Windows, map 'execl' to '_execl', so that -loldnames is not
|
---|
653 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
654 | platforms by defining GNULIB_NAMESPACE::execl always. */
|
---|
655 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
656 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
657 | # undef execl
|
---|
658 | # define execl _execl
|
---|
659 | # endif
|
---|
660 | _GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, ...));
|
---|
661 | # else
|
---|
662 | _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
|
---|
663 | # endif
|
---|
664 | _GL_CXXALIASWARN (execl);
|
---|
665 | #endif
|
---|
666 |
|
---|
667 | #if @GNULIB_EXECLE@
|
---|
668 | # if @REPLACE_EXECLE@
|
---|
669 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
670 | # undef execle
|
---|
671 | # define execle rpl_execle
|
---|
672 | # endif
|
---|
673 | _GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...)
|
---|
674 | _GL_ARG_NONNULL ((1)));
|
---|
675 | _GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
|
---|
676 | # else
|
---|
677 | _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
|
---|
678 | # endif
|
---|
679 | _GL_CXXALIASWARN (execle);
|
---|
680 | #elif defined GNULIB_POSIXCHECK
|
---|
681 | # undef execle
|
---|
682 | # if HAVE_RAW_DECL_EXECLE
|
---|
683 | _GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - "
|
---|
684 | "use gnulib module execle for portability");
|
---|
685 | # endif
|
---|
686 | #elif @GNULIB_MDA_EXECLE@
|
---|
687 | /* On native Windows, map 'execle' to '_execle', so that -loldnames is not
|
---|
688 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
689 | platforms by defining GNULIB_NAMESPACE::execle always. */
|
---|
690 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
691 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
692 | # undef execle
|
---|
693 | # define execle _execle
|
---|
694 | # endif
|
---|
695 | _GL_CXXALIAS_MDA (execle, intptr_t,
|
---|
696 | (const char *program, const char *arg, ...));
|
---|
697 | # else
|
---|
698 | _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
|
---|
699 | # endif
|
---|
700 | _GL_CXXALIASWARN (execle);
|
---|
701 | #endif
|
---|
702 |
|
---|
703 | #if @GNULIB_EXECLP@
|
---|
704 | # if @REPLACE_EXECLP@
|
---|
705 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
706 | # undef execlp
|
---|
707 | # define execlp rpl_execlp
|
---|
708 | # endif
|
---|
709 | _GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...)
|
---|
710 | _GL_ARG_NONNULL ((1)));
|
---|
711 | _GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
|
---|
712 | # else
|
---|
713 | _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
|
---|
714 | # endif
|
---|
715 | _GL_CXXALIASWARN (execlp);
|
---|
716 | #elif defined GNULIB_POSIXCHECK
|
---|
717 | # undef execlp
|
---|
718 | # if HAVE_RAW_DECL_EXECLP
|
---|
719 | _GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - "
|
---|
720 | "use gnulib module execlp for portability");
|
---|
721 | # endif
|
---|
722 | #elif @GNULIB_MDA_EXECLP@
|
---|
723 | /* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not
|
---|
724 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
725 | platforms by defining GNULIB_NAMESPACE::execlp always. */
|
---|
726 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
727 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
728 | # undef execlp
|
---|
729 | # define execlp _execlp
|
---|
730 | # endif
|
---|
731 | _GL_CXXALIAS_MDA (execlp, intptr_t,
|
---|
732 | (const char *program, const char *arg, ...));
|
---|
733 | # else
|
---|
734 | _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
|
---|
735 | # endif
|
---|
736 | _GL_CXXALIASWARN (execlp);
|
---|
737 | #endif
|
---|
738 |
|
---|
739 |
|
---|
740 | #if @GNULIB_EXECV@
|
---|
741 | # if @REPLACE_EXECV@
|
---|
742 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
743 | # undef execv
|
---|
744 | # define execv rpl_execv
|
---|
745 | # endif
|
---|
746 | _GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv)
|
---|
747 | _GL_ARG_NONNULL ((1, 2)));
|
---|
748 | _GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
|
---|
749 | # else
|
---|
750 | _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
|
---|
751 | # endif
|
---|
752 | _GL_CXXALIASWARN (execv);
|
---|
753 | #elif defined GNULIB_POSIXCHECK
|
---|
754 | # undef execv
|
---|
755 | # if HAVE_RAW_DECL_EXECV
|
---|
756 | _GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - "
|
---|
757 | "use gnulib module execv for portability");
|
---|
758 | # endif
|
---|
759 | #elif @GNULIB_MDA_EXECV@
|
---|
760 | /* On native Windows, map 'execv' to '_execv', so that -loldnames is not
|
---|
761 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
762 | platforms by defining GNULIB_NAMESPACE::execv always. */
|
---|
763 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
764 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
765 | # undef execv
|
---|
766 | # define execv _execv
|
---|
767 | # endif
|
---|
768 | _GL_CXXALIAS_MDA_CAST (execv, intptr_t,
|
---|
769 | (const char *program, char * const *argv));
|
---|
770 | # else
|
---|
771 | _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
|
---|
772 | # endif
|
---|
773 | _GL_CXXALIASWARN (execv);
|
---|
774 | #endif
|
---|
775 |
|
---|
776 | #if @GNULIB_EXECVE@
|
---|
777 | # if @REPLACE_EXECVE@
|
---|
778 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
779 | # undef execve
|
---|
780 | # define execve rpl_execve
|
---|
781 | # endif
|
---|
782 | _GL_FUNCDECL_RPL (execve, int,
|
---|
783 | (const char *program, char * const *argv, char * const *env)
|
---|
784 | _GL_ARG_NONNULL ((1, 2)));
|
---|
785 | _GL_CXXALIAS_RPL (execve, int,
|
---|
786 | (const char *program, char * const *argv, char * const *env));
|
---|
787 | # else
|
---|
788 | _GL_CXXALIAS_SYS (execve, int,
|
---|
789 | (const char *program, char * const *argv, char * const *env));
|
---|
790 | # endif
|
---|
791 | _GL_CXXALIASWARN (execve);
|
---|
792 | #elif defined GNULIB_POSIXCHECK
|
---|
793 | # undef execve
|
---|
794 | # if HAVE_RAW_DECL_EXECVE
|
---|
795 | _GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - "
|
---|
796 | "use gnulib module execve for portability");
|
---|
797 | # endif
|
---|
798 | #elif @GNULIB_MDA_EXECVE@
|
---|
799 | /* On native Windows, map 'execve' to '_execve', so that -loldnames is not
|
---|
800 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
801 | platforms by defining GNULIB_NAMESPACE::execve always. */
|
---|
802 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
803 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
804 | # undef execve
|
---|
805 | # define execve _execve
|
---|
806 | # endif
|
---|
807 | _GL_CXXALIAS_MDA_CAST (execve, intptr_t,
|
---|
808 | (const char *program, char * const *argv,
|
---|
809 | char * const *env));
|
---|
810 | # else
|
---|
811 | _GL_CXXALIAS_SYS (execve, int,
|
---|
812 | (const char *program, char * const *argv, char * const *env));
|
---|
813 | # endif
|
---|
814 | _GL_CXXALIASWARN (execve);
|
---|
815 | #endif
|
---|
816 |
|
---|
817 | #if @GNULIB_EXECVP@
|
---|
818 | # if @REPLACE_EXECVP@
|
---|
819 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
820 | # undef execvp
|
---|
821 | # define execvp rpl_execvp
|
---|
822 | # endif
|
---|
823 | _GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv)
|
---|
824 | _GL_ARG_NONNULL ((1, 2)));
|
---|
825 | _GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
|
---|
826 | # else
|
---|
827 | _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
|
---|
828 | # endif
|
---|
829 | _GL_CXXALIASWARN (execvp);
|
---|
830 | #elif defined GNULIB_POSIXCHECK
|
---|
831 | # undef execvp
|
---|
832 | # if HAVE_RAW_DECL_EXECVP
|
---|
833 | _GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - "
|
---|
834 | "use gnulib module execvp for portability");
|
---|
835 | # endif
|
---|
836 | #elif @GNULIB_MDA_EXECVP@
|
---|
837 | /* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not
|
---|
838 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
839 | platforms by defining GNULIB_NAMESPACE::execvp always. */
|
---|
840 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
841 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
842 | # undef execvp
|
---|
843 | # define execvp _execvp
|
---|
844 | # endif
|
---|
845 | _GL_CXXALIAS_MDA_CAST (execvp, intptr_t,
|
---|
846 | (const char *program, char * const *argv));
|
---|
847 | # else
|
---|
848 | _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
|
---|
849 | # endif
|
---|
850 | _GL_CXXALIASWARN (execvp);
|
---|
851 | #endif
|
---|
852 |
|
---|
853 | #if @GNULIB_EXECVPE@
|
---|
854 | # if @REPLACE_EXECVPE@
|
---|
855 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
856 | # undef execvpe
|
---|
857 | # define execvpe rpl_execvpe
|
---|
858 | # endif
|
---|
859 | _GL_FUNCDECL_RPL (execvpe, int,
|
---|
860 | (const char *program, char * const *argv, char * const *env)
|
---|
861 | _GL_ARG_NONNULL ((1, 2)));
|
---|
862 | _GL_CXXALIAS_RPL (execvpe, int,
|
---|
863 | (const char *program, char * const *argv, char * const *env));
|
---|
864 | # else
|
---|
865 | # if !@HAVE_DECL_EXECVPE@
|
---|
866 | _GL_FUNCDECL_SYS (execvpe, int,
|
---|
867 | (const char *program, char * const *argv, char * const *env)
|
---|
868 | _GL_ARG_NONNULL ((1, 2)));
|
---|
869 | # endif
|
---|
870 | _GL_CXXALIAS_SYS (execvpe, int,
|
---|
871 | (const char *program, char * const *argv, char * const *env));
|
---|
872 | # endif
|
---|
873 | _GL_CXXALIASWARN (execvpe);
|
---|
874 | #elif defined GNULIB_POSIXCHECK
|
---|
875 | # undef execvpe
|
---|
876 | # if HAVE_RAW_DECL_EXECVPE
|
---|
877 | _GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - "
|
---|
878 | "use gnulib module execvpe for portability");
|
---|
879 | # endif
|
---|
880 | #elif @GNULIB_MDA_EXECVPE@
|
---|
881 | /* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not
|
---|
882 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
883 | platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have
|
---|
884 | it. */
|
---|
885 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
886 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
887 | # undef execvpe
|
---|
888 | # define execvpe _execvpe
|
---|
889 | # endif
|
---|
890 | _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
|
---|
891 | (const char *program, char * const *argv,
|
---|
892 | char * const *env));
|
---|
893 | # elif @HAVE_EXECVPE@
|
---|
894 | # if !@HAVE_DECL_EXECVPE@
|
---|
895 | _GL_FUNCDECL_SYS (execvpe, int,
|
---|
896 | (const char *program, char * const *argv, char * const *env)
|
---|
897 | _GL_ARG_NONNULL ((1, 2)));
|
---|
898 | # endif
|
---|
899 | _GL_CXXALIAS_SYS (execvpe, int,
|
---|
900 | (const char *program, char * const *argv, char * const *env));
|
---|
901 | # endif
|
---|
902 | # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_EXECVPE@
|
---|
903 | _GL_CXXALIASWARN (execvpe);
|
---|
904 | # endif
|
---|
905 | #endif
|
---|
906 |
|
---|
907 |
|
---|
908 | #if @GNULIB_FACCESSAT@
|
---|
909 | # if @REPLACE_FACCESSAT@
|
---|
910 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
911 | # undef faccessat
|
---|
912 | # define faccessat rpl_faccessat
|
---|
913 | # endif
|
---|
914 | _GL_FUNCDECL_RPL (faccessat, int,
|
---|
915 | (int fd, char const *name, int mode, int flag)
|
---|
916 | _GL_ARG_NONNULL ((2)));
|
---|
917 | _GL_CXXALIAS_RPL (faccessat, int,
|
---|
918 | (int fd, char const *name, int mode, int flag));
|
---|
919 | # else
|
---|
920 | # if !@HAVE_FACCESSAT@
|
---|
921 | _GL_FUNCDECL_SYS (faccessat, int,
|
---|
922 | (int fd, char const *file, int mode, int flag)
|
---|
923 | _GL_ARG_NONNULL ((2)));
|
---|
924 | # endif
|
---|
925 | _GL_CXXALIAS_SYS (faccessat, int,
|
---|
926 | (int fd, char const *file, int mode, int flag));
|
---|
927 | # endif
|
---|
928 | _GL_CXXALIASWARN (faccessat);
|
---|
929 | #elif defined GNULIB_POSIXCHECK
|
---|
930 | # undef faccessat
|
---|
931 | # if HAVE_RAW_DECL_FACCESSAT
|
---|
932 | _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
|
---|
933 | "use gnulib module faccessat for portability");
|
---|
934 | # endif
|
---|
935 | #endif
|
---|
936 |
|
---|
937 |
|
---|
938 | #if @GNULIB_FCHDIR@
|
---|
939 | /* Change the process' current working directory to the directory on which
|
---|
940 | the given file descriptor is open.
|
---|
941 | Return 0 if successful, otherwise -1 and errno set.
|
---|
942 | See the POSIX:2008 specification
|
---|
943 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
|
---|
944 | # if ! @HAVE_FCHDIR@
|
---|
945 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
|
---|
946 |
|
---|
947 | /* Gnulib internal hooks needed to maintain the fchdir metadata. */
|
---|
948 | _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
|
---|
949 | _GL_ARG_NONNULL ((2));
|
---|
950 | _GL_EXTERN_C void _gl_unregister_fd (int fd);
|
---|
951 | _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
|
---|
952 | _GL_EXTERN_C const char *_gl_directory_name (int fd);
|
---|
953 |
|
---|
954 | # else
|
---|
955 | # if !@HAVE_DECL_FCHDIR@
|
---|
956 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
|
---|
957 | # endif
|
---|
958 | # endif
|
---|
959 | _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
|
---|
960 | _GL_CXXALIASWARN (fchdir);
|
---|
961 | #elif defined GNULIB_POSIXCHECK
|
---|
962 | # undef fchdir
|
---|
963 | # if HAVE_RAW_DECL_FCHDIR
|
---|
964 | _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
|
---|
965 | "use gnulib module fchdir for portability");
|
---|
966 | # endif
|
---|
967 | #endif
|
---|
968 |
|
---|
969 |
|
---|
970 | #if @GNULIB_FCHOWNAT@
|
---|
971 | # if @REPLACE_FCHOWNAT@
|
---|
972 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
973 | # undef fchownat
|
---|
974 | # define fchownat rpl_fchownat
|
---|
975 | # endif
|
---|
976 | _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
|
---|
977 | uid_t owner, gid_t group, int flag)
|
---|
978 | _GL_ARG_NONNULL ((2)));
|
---|
979 | _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
|
---|
980 | uid_t owner, gid_t group, int flag));
|
---|
981 | # else
|
---|
982 | # if !@HAVE_FCHOWNAT@
|
---|
983 | _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
|
---|
984 | uid_t owner, gid_t group, int flag)
|
---|
985 | _GL_ARG_NONNULL ((2)));
|
---|
986 | # endif
|
---|
987 | _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
|
---|
988 | uid_t owner, gid_t group, int flag));
|
---|
989 | # endif
|
---|
990 | _GL_CXXALIASWARN (fchownat);
|
---|
991 | #elif defined GNULIB_POSIXCHECK
|
---|
992 | # undef fchownat
|
---|
993 | # if HAVE_RAW_DECL_FCHOWNAT
|
---|
994 | _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
|
---|
995 | "use gnulib module fchownat for portability");
|
---|
996 | # endif
|
---|
997 | #endif
|
---|
998 |
|
---|
999 |
|
---|
1000 | #if @GNULIB_FDATASYNC@
|
---|
1001 | /* Synchronize changes to a file.
|
---|
1002 | Return 0 if successful, otherwise -1 and errno set.
|
---|
1003 | See POSIX:2008 specification
|
---|
1004 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
|
---|
1005 | # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
|
---|
1006 | _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
|
---|
1007 | # endif
|
---|
1008 | _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
|
---|
1009 | _GL_CXXALIASWARN (fdatasync);
|
---|
1010 | #elif defined GNULIB_POSIXCHECK
|
---|
1011 | # undef fdatasync
|
---|
1012 | # if HAVE_RAW_DECL_FDATASYNC
|
---|
1013 | _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
|
---|
1014 | "use gnulib module fdatasync for portability");
|
---|
1015 | # endif
|
---|
1016 | #endif
|
---|
1017 |
|
---|
1018 |
|
---|
1019 | #if @GNULIB_FSYNC@
|
---|
1020 | /* Synchronize changes, including metadata, to a file.
|
---|
1021 | Return 0 if successful, otherwise -1 and errno set.
|
---|
1022 | See POSIX:2008 specification
|
---|
1023 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
|
---|
1024 | # if !@HAVE_FSYNC@
|
---|
1025 | _GL_FUNCDECL_SYS (fsync, int, (int fd));
|
---|
1026 | # endif
|
---|
1027 | _GL_CXXALIAS_SYS (fsync, int, (int fd));
|
---|
1028 | _GL_CXXALIASWARN (fsync);
|
---|
1029 | #elif defined GNULIB_POSIXCHECK
|
---|
1030 | # undef fsync
|
---|
1031 | # if HAVE_RAW_DECL_FSYNC
|
---|
1032 | _GL_WARN_ON_USE (fsync, "fsync is unportable - "
|
---|
1033 | "use gnulib module fsync for portability");
|
---|
1034 | # endif
|
---|
1035 | #endif
|
---|
1036 |
|
---|
1037 |
|
---|
1038 | #if @GNULIB_FTRUNCATE@
|
---|
1039 | /* Change the size of the file to which FD is opened to become equal to LENGTH.
|
---|
1040 | Return 0 if successful, otherwise -1 and errno set.
|
---|
1041 | See the POSIX:2008 specification
|
---|
1042 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
|
---|
1043 | # if @REPLACE_FTRUNCATE@
|
---|
1044 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1045 | # undef ftruncate
|
---|
1046 | # define ftruncate rpl_ftruncate
|
---|
1047 | # endif
|
---|
1048 | _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
|
---|
1049 | _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
|
---|
1050 | # else
|
---|
1051 | # if !@HAVE_FTRUNCATE@
|
---|
1052 | _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
|
---|
1053 | # endif
|
---|
1054 | _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
|
---|
1055 | # endif
|
---|
1056 | _GL_CXXALIASWARN (ftruncate);
|
---|
1057 | #elif defined GNULIB_POSIXCHECK
|
---|
1058 | # undef ftruncate
|
---|
1059 | # if HAVE_RAW_DECL_FTRUNCATE
|
---|
1060 | _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
|
---|
1061 | "use gnulib module ftruncate for portability");
|
---|
1062 | # endif
|
---|
1063 | #endif
|
---|
1064 |
|
---|
1065 |
|
---|
1066 | #if @GNULIB_GETCWD@
|
---|
1067 | /* Get the name of the current working directory, and put it in SIZE bytes
|
---|
1068 | of BUF.
|
---|
1069 | Return BUF if successful, or NULL if the directory couldn't be determined
|
---|
1070 | or SIZE was too small.
|
---|
1071 | See the POSIX:2008 specification
|
---|
1072 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
|
---|
1073 | Additionally, the gnulib module 'getcwd' guarantees the following GNU
|
---|
1074 | extension: If BUF is NULL, an array is allocated with 'malloc'; the array
|
---|
1075 | is SIZE bytes long, unless SIZE == 0, in which case it is as big as
|
---|
1076 | necessary. */
|
---|
1077 | # if @REPLACE_GETCWD@
|
---|
1078 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1079 | # define getcwd rpl_getcwd
|
---|
1080 | # endif
|
---|
1081 | _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
|
---|
1082 | _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
|
---|
1083 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
1084 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1085 | # undef getcwd
|
---|
1086 | # define getcwd _getcwd
|
---|
1087 | # endif
|
---|
1088 | _GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
|
---|
1089 | # else
|
---|
1090 | /* Need to cast, because on mingw, the second parameter is
|
---|
1091 | int size. */
|
---|
1092 | _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
|
---|
1093 | # endif
|
---|
1094 | _GL_CXXALIASWARN (getcwd);
|
---|
1095 | #elif defined GNULIB_POSIXCHECK
|
---|
1096 | # undef getcwd
|
---|
1097 | # if HAVE_RAW_DECL_GETCWD
|
---|
1098 | _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
|
---|
1099 | "use gnulib module getcwd for portability");
|
---|
1100 | # endif
|
---|
1101 | #elif @GNULIB_MDA_GETCWD@
|
---|
1102 | /* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not
|
---|
1103 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
1104 | platforms by defining GNULIB_NAMESPACE::getcwd always. */
|
---|
1105 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
1106 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1107 | # undef getcwd
|
---|
1108 | # define getcwd _getcwd
|
---|
1109 | # endif
|
---|
1110 | /* Need to cast, because on mingw, the second parameter is either
|
---|
1111 | 'int size' or 'size_t size'. */
|
---|
1112 | _GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size));
|
---|
1113 | # else
|
---|
1114 | _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
|
---|
1115 | # endif
|
---|
1116 | _GL_CXXALIASWARN (getcwd);
|
---|
1117 | #endif
|
---|
1118 |
|
---|
1119 |
|
---|
1120 | #if @GNULIB_GETDOMAINNAME@
|
---|
1121 | /* Return the NIS domain name of the machine.
|
---|
1122 | WARNING! The NIS domain name is unrelated to the fully qualified host name
|
---|
1123 | of the machine. It is also unrelated to email addresses.
|
---|
1124 | WARNING! The NIS domain name is usually the empty string or "(none)" when
|
---|
1125 | not using NIS.
|
---|
1126 |
|
---|
1127 | Put up to LEN bytes of the NIS domain name into NAME.
|
---|
1128 | Null terminate it if the name is shorter than LEN.
|
---|
1129 | If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
|
---|
1130 | Return 0 if successful, otherwise set errno and return -1. */
|
---|
1131 | # if @REPLACE_GETDOMAINNAME@
|
---|
1132 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1133 | # undef getdomainname
|
---|
1134 | # define getdomainname rpl_getdomainname
|
---|
1135 | # endif
|
---|
1136 | _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
|
---|
1137 | _GL_ARG_NONNULL ((1)));
|
---|
1138 | _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
|
---|
1139 | # else
|
---|
1140 | # if !@HAVE_DECL_GETDOMAINNAME@
|
---|
1141 | _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
|
---|
1142 | _GL_ARG_NONNULL ((1)));
|
---|
1143 | # endif
|
---|
1144 | _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
|
---|
1145 | # endif
|
---|
1146 | # if __GLIBC__ >= 2
|
---|
1147 | _GL_CXXALIASWARN (getdomainname);
|
---|
1148 | # endif
|
---|
1149 | #elif defined GNULIB_POSIXCHECK
|
---|
1150 | # undef getdomainname
|
---|
1151 | # if HAVE_RAW_DECL_GETDOMAINNAME
|
---|
1152 | _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
|
---|
1153 | "use gnulib module getdomainname for portability");
|
---|
1154 | # endif
|
---|
1155 | #endif
|
---|
1156 |
|
---|
1157 |
|
---|
1158 | #if @GNULIB_GETDTABLESIZE@
|
---|
1159 | /* Return the maximum number of file descriptors in the current process.
|
---|
1160 | In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
|
---|
1161 | # if @REPLACE_GETDTABLESIZE@
|
---|
1162 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1163 | # undef getdtablesize
|
---|
1164 | # define getdtablesize rpl_getdtablesize
|
---|
1165 | # endif
|
---|
1166 | _GL_FUNCDECL_RPL (getdtablesize, int, (void));
|
---|
1167 | _GL_CXXALIAS_RPL (getdtablesize, int, (void));
|
---|
1168 | # else
|
---|
1169 | # if !@HAVE_GETDTABLESIZE@
|
---|
1170 | _GL_FUNCDECL_SYS (getdtablesize, int, (void));
|
---|
1171 | # endif
|
---|
1172 | /* Need to cast, because on AIX, the parameter list is
|
---|
1173 | (...). */
|
---|
1174 | _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
|
---|
1175 | # endif
|
---|
1176 | _GL_CXXALIASWARN (getdtablesize);
|
---|
1177 | #elif defined GNULIB_POSIXCHECK
|
---|
1178 | # undef getdtablesize
|
---|
1179 | # if HAVE_RAW_DECL_GETDTABLESIZE
|
---|
1180 | _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
|
---|
1181 | "use gnulib module getdtablesize for portability");
|
---|
1182 | # endif
|
---|
1183 | #endif
|
---|
1184 |
|
---|
1185 |
|
---|
1186 | #if @GNULIB_GETENTROPY@
|
---|
1187 | /* Fill a buffer with random bytes. */
|
---|
1188 | # if !@HAVE_GETENTROPY@
|
---|
1189 | _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
|
---|
1190 | # endif
|
---|
1191 | _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
|
---|
1192 | _GL_CXXALIASWARN (getentropy);
|
---|
1193 | #elif defined GNULIB_POSIXCHECK
|
---|
1194 | # undef getentropy
|
---|
1195 | # if HAVE_RAW_DECL_GETENTROPY
|
---|
1196 | _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
|
---|
1197 | "use gnulib module getentropy for portability");
|
---|
1198 | # endif
|
---|
1199 | #endif
|
---|
1200 |
|
---|
1201 |
|
---|
1202 | #if @GNULIB_GETGROUPS@
|
---|
1203 | /* Return the supplemental groups that the current process belongs to.
|
---|
1204 | It is unspecified whether the effective group id is in the list.
|
---|
1205 | If N is 0, return the group count; otherwise, N describes how many
|
---|
1206 | entries are available in GROUPS. Return -1 and set errno if N is
|
---|
1207 | not 0 and not large enough. Fails with ENOSYS on some systems. */
|
---|
1208 | # if @REPLACE_GETGROUPS@
|
---|
1209 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1210 | # undef getgroups
|
---|
1211 | # define getgroups rpl_getgroups
|
---|
1212 | # endif
|
---|
1213 | _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
|
---|
1214 | _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
|
---|
1215 | # else
|
---|
1216 | # if !@HAVE_GETGROUPS@
|
---|
1217 | _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
|
---|
1218 | # endif
|
---|
1219 | _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
|
---|
1220 | # endif
|
---|
1221 | _GL_CXXALIASWARN (getgroups);
|
---|
1222 | #elif defined GNULIB_POSIXCHECK
|
---|
1223 | # undef getgroups
|
---|
1224 | # if HAVE_RAW_DECL_GETGROUPS
|
---|
1225 | _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
|
---|
1226 | "use gnulib module getgroups for portability");
|
---|
1227 | # endif
|
---|
1228 | #endif
|
---|
1229 |
|
---|
1230 |
|
---|
1231 | #if @GNULIB_GETHOSTNAME@
|
---|
1232 | /* Return the standard host name of the machine.
|
---|
1233 | WARNING! The host name may or may not be fully qualified.
|
---|
1234 |
|
---|
1235 | Put up to LEN bytes of the host name into NAME.
|
---|
1236 | Null terminate it if the name is shorter than LEN.
|
---|
1237 | If the host name is longer than LEN, set errno = EINVAL and return -1.
|
---|
1238 | Return 0 if successful, otherwise set errno and return -1. */
|
---|
1239 | # if @UNISTD_H_HAVE_WINSOCK2_H@
|
---|
1240 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1241 | # undef gethostname
|
---|
1242 | # define gethostname rpl_gethostname
|
---|
1243 | # endif
|
---|
1244 | _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
|
---|
1245 | _GL_ARG_NONNULL ((1)));
|
---|
1246 | _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
|
---|
1247 | # else
|
---|
1248 | # if !@HAVE_GETHOSTNAME@
|
---|
1249 | _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
|
---|
1250 | _GL_ARG_NONNULL ((1)));
|
---|
1251 | # endif
|
---|
1252 | /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
|
---|
1253 | parameter is
|
---|
1254 | int len. */
|
---|
1255 | _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
|
---|
1256 | # endif
|
---|
1257 | _GL_CXXALIASWARN (gethostname);
|
---|
1258 | #elif @UNISTD_H_HAVE_WINSOCK2_H@
|
---|
1259 | # undef gethostname
|
---|
1260 | # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
|
---|
1261 | #elif defined GNULIB_POSIXCHECK
|
---|
1262 | # undef gethostname
|
---|
1263 | # if HAVE_RAW_DECL_GETHOSTNAME
|
---|
1264 | _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
|
---|
1265 | "use gnulib module gethostname for portability");
|
---|
1266 | # endif
|
---|
1267 | #endif
|
---|
1268 |
|
---|
1269 |
|
---|
1270 | #if @GNULIB_GETLOGIN@
|
---|
1271 | /* Returns the user's login name, or NULL if it cannot be found. Upon error,
|
---|
1272 | returns NULL with errno set.
|
---|
1273 |
|
---|
1274 | See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
|
---|
1275 |
|
---|
1276 | Most programs don't need to use this function, because the information is
|
---|
1277 | available through environment variables:
|
---|
1278 | ${LOGNAME-$USER} on Unix platforms,
|
---|
1279 | $USERNAME on native Windows platforms.
|
---|
1280 | */
|
---|
1281 | # if !@HAVE_DECL_GETLOGIN@
|
---|
1282 | _GL_FUNCDECL_SYS (getlogin, char *, (void));
|
---|
1283 | # endif
|
---|
1284 | _GL_CXXALIAS_SYS (getlogin, char *, (void));
|
---|
1285 | _GL_CXXALIASWARN (getlogin);
|
---|
1286 | #elif defined GNULIB_POSIXCHECK
|
---|
1287 | # undef getlogin
|
---|
1288 | # if HAVE_RAW_DECL_GETLOGIN
|
---|
1289 | _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
|
---|
1290 | "use gnulib module getlogin for portability");
|
---|
1291 | # endif
|
---|
1292 | #endif
|
---|
1293 |
|
---|
1294 |
|
---|
1295 | #if @GNULIB_GETLOGIN_R@
|
---|
1296 | /* Copies the user's login name to NAME.
|
---|
1297 | The array pointed to by NAME has room for SIZE bytes.
|
---|
1298 |
|
---|
1299 | Returns 0 if successful. Upon error, an error number is returned, or -1 in
|
---|
1300 | the case that the login name cannot be found but no specific error is
|
---|
1301 | provided (this case is hopefully rare but is left open by the POSIX spec).
|
---|
1302 |
|
---|
1303 | See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
|
---|
1304 |
|
---|
1305 | Most programs don't need to use this function, because the information is
|
---|
1306 | available through environment variables:
|
---|
1307 | ${LOGNAME-$USER} on Unix platforms,
|
---|
1308 | $USERNAME on native Windows platforms.
|
---|
1309 | */
|
---|
1310 | # if @REPLACE_GETLOGIN_R@
|
---|
1311 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1312 | # define getlogin_r rpl_getlogin_r
|
---|
1313 | # endif
|
---|
1314 | _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
|
---|
1315 | _GL_ARG_NONNULL ((1)));
|
---|
1316 | _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
|
---|
1317 | # else
|
---|
1318 | # if !@HAVE_DECL_GETLOGIN_R@
|
---|
1319 | _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
|
---|
1320 | _GL_ARG_NONNULL ((1)));
|
---|
1321 | # endif
|
---|
1322 | /* Need to cast, because on Solaris 10 systems, the second argument is
|
---|
1323 | int size. */
|
---|
1324 | _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
|
---|
1325 | # endif
|
---|
1326 | _GL_CXXALIASWARN (getlogin_r);
|
---|
1327 | #elif defined GNULIB_POSIXCHECK
|
---|
1328 | # undef getlogin_r
|
---|
1329 | # if HAVE_RAW_DECL_GETLOGIN_R
|
---|
1330 | _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
|
---|
1331 | "use gnulib module getlogin_r for portability");
|
---|
1332 | # endif
|
---|
1333 | #endif
|
---|
1334 |
|
---|
1335 |
|
---|
1336 | #if @GNULIB_GETPAGESIZE@
|
---|
1337 | # if @REPLACE_GETPAGESIZE@
|
---|
1338 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1339 | # define getpagesize rpl_getpagesize
|
---|
1340 | # endif
|
---|
1341 | _GL_FUNCDECL_RPL (getpagesize, int, (void));
|
---|
1342 | _GL_CXXALIAS_RPL (getpagesize, int, (void));
|
---|
1343 | # else
|
---|
1344 | /* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
|
---|
1345 | the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
|
---|
1346 | # if defined __hpux
|
---|
1347 | _GL_FUNCDECL_SYS (getpagesize, int, (void));
|
---|
1348 | # endif
|
---|
1349 | # if !@HAVE_GETPAGESIZE@
|
---|
1350 | # if !defined getpagesize
|
---|
1351 | /* This is for POSIX systems. */
|
---|
1352 | # if !defined _gl_getpagesize && defined _SC_PAGESIZE
|
---|
1353 | # if ! (defined __VMS && __VMS_VER < 70000000)
|
---|
1354 | # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
|
---|
1355 | # endif
|
---|
1356 | # endif
|
---|
1357 | /* This is for older VMS. */
|
---|
1358 | # if !defined _gl_getpagesize && defined __VMS
|
---|
1359 | # ifdef __ALPHA
|
---|
1360 | # define _gl_getpagesize() 8192
|
---|
1361 | # else
|
---|
1362 | # define _gl_getpagesize() 512
|
---|
1363 | # endif
|
---|
1364 | # endif
|
---|
1365 | /* This is for BeOS. */
|
---|
1366 | # if !defined _gl_getpagesize && @HAVE_OS_H@
|
---|
1367 | # include <OS.h>
|
---|
1368 | # if defined B_PAGE_SIZE
|
---|
1369 | # define _gl_getpagesize() B_PAGE_SIZE
|
---|
1370 | # endif
|
---|
1371 | # endif
|
---|
1372 | /* This is for AmigaOS4.0. */
|
---|
1373 | # if !defined _gl_getpagesize && defined __amigaos4__
|
---|
1374 | # define _gl_getpagesize() 2048
|
---|
1375 | # endif
|
---|
1376 | /* This is for older Unix systems. */
|
---|
1377 | # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
|
---|
1378 | # include <sys/param.h>
|
---|
1379 | # ifdef EXEC_PAGESIZE
|
---|
1380 | # define _gl_getpagesize() EXEC_PAGESIZE
|
---|
1381 | # else
|
---|
1382 | # ifdef NBPG
|
---|
1383 | # ifndef CLSIZE
|
---|
1384 | # define CLSIZE 1
|
---|
1385 | # endif
|
---|
1386 | # define _gl_getpagesize() (NBPG * CLSIZE)
|
---|
1387 | # else
|
---|
1388 | # ifdef NBPC
|
---|
1389 | # define _gl_getpagesize() NBPC
|
---|
1390 | # endif
|
---|
1391 | # endif
|
---|
1392 | # endif
|
---|
1393 | # endif
|
---|
1394 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1395 | # define getpagesize() _gl_getpagesize ()
|
---|
1396 | # else
|
---|
1397 | # if !GNULIB_defined_getpagesize_function
|
---|
1398 | _GL_UNISTD_INLINE int
|
---|
1399 | getpagesize ()
|
---|
1400 | {
|
---|
1401 | return _gl_getpagesize ();
|
---|
1402 | }
|
---|
1403 | # define GNULIB_defined_getpagesize_function 1
|
---|
1404 | # endif
|
---|
1405 | # endif
|
---|
1406 | # endif
|
---|
1407 | # endif
|
---|
1408 | /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
|
---|
1409 | _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
|
---|
1410 | # endif
|
---|
1411 | # if @HAVE_DECL_GETPAGESIZE@
|
---|
1412 | _GL_CXXALIASWARN (getpagesize);
|
---|
1413 | # endif
|
---|
1414 | #elif defined GNULIB_POSIXCHECK
|
---|
1415 | # undef getpagesize
|
---|
1416 | # if HAVE_RAW_DECL_GETPAGESIZE
|
---|
1417 | _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
|
---|
1418 | "use gnulib module getpagesize for portability");
|
---|
1419 | # endif
|
---|
1420 | #endif
|
---|
1421 |
|
---|
1422 |
|
---|
1423 | #if @GNULIB_GETPASS@
|
---|
1424 | /* Function getpass() from module 'getpass':
|
---|
1425 | Read a password from /dev/tty or stdin.
|
---|
1426 | Function getpass() from module 'getpass-gnu':
|
---|
1427 | Read a password of arbitrary length from /dev/tty or stdin. */
|
---|
1428 | # if (@GNULIB_GETPASS@ && @REPLACE_GETPASS@) \
|
---|
1429 | || (@GNULIB_GETPASS_GNU@ && @REPLACE_GETPASS_FOR_GETPASS_GNU@)
|
---|
1430 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1431 | # undef getpass
|
---|
1432 | # define getpass rpl_getpass
|
---|
1433 | # endif
|
---|
1434 | _GL_FUNCDECL_RPL (getpass, char *, (const char *prompt)
|
---|
1435 | _GL_ARG_NONNULL ((1)));
|
---|
1436 | _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
|
---|
1437 | # else
|
---|
1438 | # if !@HAVE_GETPASS@
|
---|
1439 | _GL_FUNCDECL_SYS (getpass, char *, (const char *prompt)
|
---|
1440 | _GL_ARG_NONNULL ((1)));
|
---|
1441 | # endif
|
---|
1442 | _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
|
---|
1443 | # endif
|
---|
1444 | _GL_CXXALIASWARN (getpass);
|
---|
1445 | #elif defined GNULIB_POSIXCHECK
|
---|
1446 | # undef getpass
|
---|
1447 | # if HAVE_RAW_DECL_GETPASS
|
---|
1448 | _GL_WARN_ON_USE (getpass, "getpass is unportable - "
|
---|
1449 | "use gnulib module getpass or getpass-gnu for portability");
|
---|
1450 | # endif
|
---|
1451 | #endif
|
---|
1452 |
|
---|
1453 |
|
---|
1454 | #if @GNULIB_MDA_GETPID@
|
---|
1455 | /* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not
|
---|
1456 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
1457 | platforms by defining GNULIB_NAMESPACE::getpid always. */
|
---|
1458 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
1459 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1460 | # undef getpid
|
---|
1461 | # define getpid _getpid
|
---|
1462 | # endif
|
---|
1463 | _GL_CXXALIAS_MDA (getpid, int, (void));
|
---|
1464 | # else
|
---|
1465 | _GL_CXXALIAS_SYS (getpid, pid_t, (void));
|
---|
1466 | # endif
|
---|
1467 | _GL_CXXALIASWARN (getpid);
|
---|
1468 | #endif
|
---|
1469 |
|
---|
1470 |
|
---|
1471 | #if @GNULIB_GETUSERSHELL@
|
---|
1472 | /* Return the next valid login shell on the system, or NULL when the end of
|
---|
1473 | the list has been reached. */
|
---|
1474 | # if !@HAVE_DECL_GETUSERSHELL@
|
---|
1475 | _GL_FUNCDECL_SYS (getusershell, char *, (void));
|
---|
1476 | # endif
|
---|
1477 | _GL_CXXALIAS_SYS (getusershell, char *, (void));
|
---|
1478 | _GL_CXXALIASWARN (getusershell);
|
---|
1479 | #elif defined GNULIB_POSIXCHECK
|
---|
1480 | # undef getusershell
|
---|
1481 | # if HAVE_RAW_DECL_GETUSERSHELL
|
---|
1482 | _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
|
---|
1483 | "use gnulib module getusershell for portability");
|
---|
1484 | # endif
|
---|
1485 | #endif
|
---|
1486 |
|
---|
1487 | #if @GNULIB_GETUSERSHELL@
|
---|
1488 | /* Rewind to pointer that is advanced at each getusershell() call. */
|
---|
1489 | # if !@HAVE_DECL_GETUSERSHELL@
|
---|
1490 | _GL_FUNCDECL_SYS (setusershell, void, (void));
|
---|
1491 | # endif
|
---|
1492 | _GL_CXXALIAS_SYS (setusershell, void, (void));
|
---|
1493 | _GL_CXXALIASWARN (setusershell);
|
---|
1494 | #elif defined GNULIB_POSIXCHECK
|
---|
1495 | # undef setusershell
|
---|
1496 | # if HAVE_RAW_DECL_SETUSERSHELL
|
---|
1497 | _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
|
---|
1498 | "use gnulib module getusershell for portability");
|
---|
1499 | # endif
|
---|
1500 | #endif
|
---|
1501 |
|
---|
1502 | #if @GNULIB_GETUSERSHELL@
|
---|
1503 | /* Free the pointer that is advanced at each getusershell() call and
|
---|
1504 | associated resources. */
|
---|
1505 | # if !@HAVE_DECL_GETUSERSHELL@
|
---|
1506 | _GL_FUNCDECL_SYS (endusershell, void, (void));
|
---|
1507 | # endif
|
---|
1508 | _GL_CXXALIAS_SYS (endusershell, void, (void));
|
---|
1509 | _GL_CXXALIASWARN (endusershell);
|
---|
1510 | #elif defined GNULIB_POSIXCHECK
|
---|
1511 | # undef endusershell
|
---|
1512 | # if HAVE_RAW_DECL_ENDUSERSHELL
|
---|
1513 | _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
|
---|
1514 | "use gnulib module getusershell for portability");
|
---|
1515 | # endif
|
---|
1516 | #endif
|
---|
1517 |
|
---|
1518 |
|
---|
1519 | #if @GNULIB_GROUP_MEMBER@
|
---|
1520 | /* Determine whether group id is in calling user's group list. */
|
---|
1521 | # if !@HAVE_GROUP_MEMBER@
|
---|
1522 | _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
|
---|
1523 | # endif
|
---|
1524 | _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
|
---|
1525 | _GL_CXXALIASWARN (group_member);
|
---|
1526 | #elif defined GNULIB_POSIXCHECK
|
---|
1527 | # undef group_member
|
---|
1528 | # if HAVE_RAW_DECL_GROUP_MEMBER
|
---|
1529 | _GL_WARN_ON_USE (group_member, "group_member is unportable - "
|
---|
1530 | "use gnulib module group-member for portability");
|
---|
1531 | # endif
|
---|
1532 | #endif
|
---|
1533 |
|
---|
1534 |
|
---|
1535 | #if @GNULIB_ISATTY@
|
---|
1536 | # if @REPLACE_ISATTY@
|
---|
1537 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1538 | # undef isatty
|
---|
1539 | # define isatty rpl_isatty
|
---|
1540 | # endif
|
---|
1541 | # define GNULIB_defined_isatty 1
|
---|
1542 | _GL_FUNCDECL_RPL (isatty, int, (int fd));
|
---|
1543 | _GL_CXXALIAS_RPL (isatty, int, (int fd));
|
---|
1544 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
1545 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1546 | # undef isatty
|
---|
1547 | # define isatty _isatty
|
---|
1548 | # endif
|
---|
1549 | _GL_CXXALIAS_MDA (isatty, int, (int fd));
|
---|
1550 | # else
|
---|
1551 | _GL_CXXALIAS_SYS (isatty, int, (int fd));
|
---|
1552 | # endif
|
---|
1553 | _GL_CXXALIASWARN (isatty);
|
---|
1554 | #elif defined GNULIB_POSIXCHECK
|
---|
1555 | # undef isatty
|
---|
1556 | # if HAVE_RAW_DECL_ISATTY
|
---|
1557 | _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
|
---|
1558 | "use gnulib module isatty for portability");
|
---|
1559 | # endif
|
---|
1560 | #elif @GNULIB_MDA_ISATTY@
|
---|
1561 | /* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not
|
---|
1562 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
1563 | platforms by defining GNULIB_NAMESPACE::isatty always. */
|
---|
1564 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
1565 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1566 | # undef isatty
|
---|
1567 | # define isatty _isatty
|
---|
1568 | # endif
|
---|
1569 | _GL_CXXALIAS_MDA (isatty, int, (int fd));
|
---|
1570 | # else
|
---|
1571 | _GL_CXXALIAS_SYS (isatty, int, (int fd));
|
---|
1572 | # endif
|
---|
1573 | _GL_CXXALIASWARN (isatty);
|
---|
1574 | #endif
|
---|
1575 |
|
---|
1576 |
|
---|
1577 | #if @GNULIB_LCHOWN@
|
---|
1578 | /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
|
---|
1579 | to GID (if GID is not -1). Do not follow symbolic links.
|
---|
1580 | Return 0 if successful, otherwise -1 and errno set.
|
---|
1581 | See the POSIX:2008 specification
|
---|
1582 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
|
---|
1583 | # if @REPLACE_LCHOWN@
|
---|
1584 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1585 | # undef lchown
|
---|
1586 | # define lchown rpl_lchown
|
---|
1587 | # endif
|
---|
1588 | _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
|
---|
1589 | _GL_ARG_NONNULL ((1)));
|
---|
1590 | _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
|
---|
1591 | # else
|
---|
1592 | # if !@HAVE_LCHOWN@
|
---|
1593 | _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
|
---|
1594 | _GL_ARG_NONNULL ((1)));
|
---|
1595 | # endif
|
---|
1596 | _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
|
---|
1597 | # endif
|
---|
1598 | _GL_CXXALIASWARN (lchown);
|
---|
1599 | #elif defined GNULIB_POSIXCHECK
|
---|
1600 | # undef lchown
|
---|
1601 | # if HAVE_RAW_DECL_LCHOWN
|
---|
1602 | _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
|
---|
1603 | "use gnulib module lchown for portability");
|
---|
1604 | # endif
|
---|
1605 | #endif
|
---|
1606 |
|
---|
1607 |
|
---|
1608 | #if @GNULIB_LINK@
|
---|
1609 | /* Create a new hard link for an existing file.
|
---|
1610 | Return 0 if successful, otherwise -1 and errno set.
|
---|
1611 | See POSIX:2008 specification
|
---|
1612 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
|
---|
1613 | # if @REPLACE_LINK@
|
---|
1614 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1615 | # define link rpl_link
|
---|
1616 | # endif
|
---|
1617 | _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
|
---|
1618 | _GL_ARG_NONNULL ((1, 2)));
|
---|
1619 | _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
|
---|
1620 | # else
|
---|
1621 | # if !@HAVE_LINK@
|
---|
1622 | _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
|
---|
1623 | _GL_ARG_NONNULL ((1, 2)));
|
---|
1624 | # endif
|
---|
1625 | _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
|
---|
1626 | # endif
|
---|
1627 | _GL_CXXALIASWARN (link);
|
---|
1628 | #elif defined GNULIB_POSIXCHECK
|
---|
1629 | # undef link
|
---|
1630 | # if HAVE_RAW_DECL_LINK
|
---|
1631 | _GL_WARN_ON_USE (link, "link is unportable - "
|
---|
1632 | "use gnulib module link for portability");
|
---|
1633 | # endif
|
---|
1634 | #endif
|
---|
1635 |
|
---|
1636 |
|
---|
1637 | #if @GNULIB_LINKAT@
|
---|
1638 | /* Create a new hard link for an existing file, relative to two
|
---|
1639 | directories. FLAG controls whether symlinks are followed.
|
---|
1640 | Return 0 if successful, otherwise -1 and errno set. */
|
---|
1641 | # if @REPLACE_LINKAT@
|
---|
1642 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1643 | # undef linkat
|
---|
1644 | # define linkat rpl_linkat
|
---|
1645 | # endif
|
---|
1646 | _GL_FUNCDECL_RPL (linkat, int,
|
---|
1647 | (int fd1, const char *path1, int fd2, const char *path2,
|
---|
1648 | int flag)
|
---|
1649 | _GL_ARG_NONNULL ((2, 4)));
|
---|
1650 | _GL_CXXALIAS_RPL (linkat, int,
|
---|
1651 | (int fd1, const char *path1, int fd2, const char *path2,
|
---|
1652 | int flag));
|
---|
1653 | # else
|
---|
1654 | # if !@HAVE_LINKAT@
|
---|
1655 | _GL_FUNCDECL_SYS (linkat, int,
|
---|
1656 | (int fd1, const char *path1, int fd2, const char *path2,
|
---|
1657 | int flag)
|
---|
1658 | _GL_ARG_NONNULL ((2, 4)));
|
---|
1659 | # endif
|
---|
1660 | _GL_CXXALIAS_SYS (linkat, int,
|
---|
1661 | (int fd1, const char *path1, int fd2, const char *path2,
|
---|
1662 | int flag));
|
---|
1663 | # endif
|
---|
1664 | _GL_CXXALIASWARN (linkat);
|
---|
1665 | #elif defined GNULIB_POSIXCHECK
|
---|
1666 | # undef linkat
|
---|
1667 | # if HAVE_RAW_DECL_LINKAT
|
---|
1668 | _GL_WARN_ON_USE (linkat, "linkat is unportable - "
|
---|
1669 | "use gnulib module linkat for portability");
|
---|
1670 | # endif
|
---|
1671 | #endif
|
---|
1672 |
|
---|
1673 |
|
---|
1674 | #if @GNULIB_LSEEK@
|
---|
1675 | /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
|
---|
1676 | Return the new offset if successful, otherwise -1 and errno set.
|
---|
1677 | See the POSIX:2008 specification
|
---|
1678 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
|
---|
1679 | # if @REPLACE_LSEEK@
|
---|
1680 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1681 | # define lseek rpl_lseek
|
---|
1682 | # endif
|
---|
1683 | _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
|
---|
1684 | _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
|
---|
1685 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
1686 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1687 | # undef lseek
|
---|
1688 | # define lseek _lseek
|
---|
1689 | # endif
|
---|
1690 | _GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
|
---|
1691 | # else
|
---|
1692 | _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
|
---|
1693 | # endif
|
---|
1694 | _GL_CXXALIASWARN (lseek);
|
---|
1695 | #elif defined GNULIB_POSIXCHECK
|
---|
1696 | # undef lseek
|
---|
1697 | # if HAVE_RAW_DECL_LSEEK
|
---|
1698 | _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
|
---|
1699 | "systems - use gnulib module lseek for portability");
|
---|
1700 | # endif
|
---|
1701 | #elif @GNULIB_MDA_LSEEK@
|
---|
1702 | /* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not
|
---|
1703 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
1704 | platforms by defining GNULIB_NAMESPACE::lseek always. */
|
---|
1705 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
1706 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1707 | # undef lseek
|
---|
1708 | # define lseek _lseek
|
---|
1709 | # endif
|
---|
1710 | _GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence));
|
---|
1711 | # else
|
---|
1712 | _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
|
---|
1713 | # endif
|
---|
1714 | _GL_CXXALIASWARN (lseek);
|
---|
1715 | #endif
|
---|
1716 |
|
---|
1717 |
|
---|
1718 | #if @GNULIB_PIPE@
|
---|
1719 | /* Create a pipe, defaulting to O_BINARY mode.
|
---|
1720 | Store the read-end as fd[0] and the write-end as fd[1].
|
---|
1721 | Return 0 upon success, or -1 with errno set upon failure. */
|
---|
1722 | # if !@HAVE_PIPE@
|
---|
1723 | _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
|
---|
1724 | # endif
|
---|
1725 | _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
|
---|
1726 | _GL_CXXALIASWARN (pipe);
|
---|
1727 | #elif defined GNULIB_POSIXCHECK
|
---|
1728 | # undef pipe
|
---|
1729 | # if HAVE_RAW_DECL_PIPE
|
---|
1730 | _GL_WARN_ON_USE (pipe, "pipe is unportable - "
|
---|
1731 | "use gnulib module pipe-posix for portability");
|
---|
1732 | # endif
|
---|
1733 | #endif
|
---|
1734 |
|
---|
1735 |
|
---|
1736 | #if @GNULIB_PIPE2@
|
---|
1737 | /* Create a pipe, applying the given flags when opening the read-end of the
|
---|
1738 | pipe and the write-end of the pipe.
|
---|
1739 | The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
|
---|
1740 | and O_TEXT, O_BINARY (defined in "binary-io.h").
|
---|
1741 | Store the read-end as fd[0] and the write-end as fd[1].
|
---|
1742 | Return 0 upon success, or -1 with errno set upon failure.
|
---|
1743 | See also the Linux man page at
|
---|
1744 | <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
|
---|
1745 | # if @HAVE_PIPE2@
|
---|
1746 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1747 | # define pipe2 rpl_pipe2
|
---|
1748 | # endif
|
---|
1749 | _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
|
---|
1750 | _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
|
---|
1751 | # else
|
---|
1752 | _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
|
---|
1753 | _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
|
---|
1754 | # endif
|
---|
1755 | _GL_CXXALIASWARN (pipe2);
|
---|
1756 | #elif defined GNULIB_POSIXCHECK
|
---|
1757 | # undef pipe2
|
---|
1758 | # if HAVE_RAW_DECL_PIPE2
|
---|
1759 | _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
|
---|
1760 | "use gnulib module pipe2 for portability");
|
---|
1761 | # endif
|
---|
1762 | #endif
|
---|
1763 |
|
---|
1764 |
|
---|
1765 | #if @GNULIB_PREAD@
|
---|
1766 | /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
|
---|
1767 | Return the number of bytes placed into BUF if successful, otherwise
|
---|
1768 | set errno and return -1. 0 indicates EOF.
|
---|
1769 | See the POSIX:2008 specification
|
---|
1770 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
|
---|
1771 | # if @REPLACE_PREAD@
|
---|
1772 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1773 | # undef pread
|
---|
1774 | # define pread rpl_pread
|
---|
1775 | # endif
|
---|
1776 | _GL_FUNCDECL_RPL (pread, ssize_t,
|
---|
1777 | (int fd, void *buf, size_t bufsize, off_t offset)
|
---|
1778 | _GL_ARG_NONNULL ((2)));
|
---|
1779 | _GL_CXXALIAS_RPL (pread, ssize_t,
|
---|
1780 | (int fd, void *buf, size_t bufsize, off_t offset));
|
---|
1781 | # else
|
---|
1782 | # if !@HAVE_PREAD@
|
---|
1783 | _GL_FUNCDECL_SYS (pread, ssize_t,
|
---|
1784 | (int fd, void *buf, size_t bufsize, off_t offset)
|
---|
1785 | _GL_ARG_NONNULL ((2)));
|
---|
1786 | # endif
|
---|
1787 | _GL_CXXALIAS_SYS (pread, ssize_t,
|
---|
1788 | (int fd, void *buf, size_t bufsize, off_t offset));
|
---|
1789 | # endif
|
---|
1790 | _GL_CXXALIASWARN (pread);
|
---|
1791 | #elif defined GNULIB_POSIXCHECK
|
---|
1792 | # undef pread
|
---|
1793 | # if HAVE_RAW_DECL_PREAD
|
---|
1794 | _GL_WARN_ON_USE (pread, "pread is unportable - "
|
---|
1795 | "use gnulib module pread for portability");
|
---|
1796 | # endif
|
---|
1797 | #endif
|
---|
1798 |
|
---|
1799 |
|
---|
1800 | #if @GNULIB_PWRITE@
|
---|
1801 | /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
|
---|
1802 | Return the number of bytes written if successful, otherwise
|
---|
1803 | set errno and return -1. 0 indicates nothing written. See the
|
---|
1804 | POSIX:2008 specification
|
---|
1805 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
|
---|
1806 | # if @REPLACE_PWRITE@
|
---|
1807 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1808 | # undef pwrite
|
---|
1809 | # define pwrite rpl_pwrite
|
---|
1810 | # endif
|
---|
1811 | _GL_FUNCDECL_RPL (pwrite, ssize_t,
|
---|
1812 | (int fd, const void *buf, size_t bufsize, off_t offset)
|
---|
1813 | _GL_ARG_NONNULL ((2)));
|
---|
1814 | _GL_CXXALIAS_RPL (pwrite, ssize_t,
|
---|
1815 | (int fd, const void *buf, size_t bufsize, off_t offset));
|
---|
1816 | # else
|
---|
1817 | # if !@HAVE_PWRITE@
|
---|
1818 | _GL_FUNCDECL_SYS (pwrite, ssize_t,
|
---|
1819 | (int fd, const void *buf, size_t bufsize, off_t offset)
|
---|
1820 | _GL_ARG_NONNULL ((2)));
|
---|
1821 | # endif
|
---|
1822 | _GL_CXXALIAS_SYS (pwrite, ssize_t,
|
---|
1823 | (int fd, const void *buf, size_t bufsize, off_t offset));
|
---|
1824 | # endif
|
---|
1825 | _GL_CXXALIASWARN (pwrite);
|
---|
1826 | #elif defined GNULIB_POSIXCHECK
|
---|
1827 | # undef pwrite
|
---|
1828 | # if HAVE_RAW_DECL_PWRITE
|
---|
1829 | _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
|
---|
1830 | "use gnulib module pwrite for portability");
|
---|
1831 | # endif
|
---|
1832 | #endif
|
---|
1833 |
|
---|
1834 |
|
---|
1835 | #if @GNULIB_READ@
|
---|
1836 | /* Read up to COUNT bytes from file descriptor FD into the buffer starting
|
---|
1837 | at BUF. See the POSIX:2008 specification
|
---|
1838 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
|
---|
1839 | # if @REPLACE_READ@
|
---|
1840 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1841 | # undef read
|
---|
1842 | # define read rpl_read
|
---|
1843 | # endif
|
---|
1844 | _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
|
---|
1845 | _GL_ARG_NONNULL ((2)));
|
---|
1846 | _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
|
---|
1847 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
1848 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1849 | # undef read
|
---|
1850 | # define read _read
|
---|
1851 | # endif
|
---|
1852 | _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
|
---|
1853 | # else
|
---|
1854 | _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
|
---|
1855 | # endif
|
---|
1856 | _GL_CXXALIASWARN (read);
|
---|
1857 | #elif @GNULIB_MDA_READ@
|
---|
1858 | /* On native Windows, map 'read' to '_read', so that -loldnames is not
|
---|
1859 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
1860 | platforms by defining GNULIB_NAMESPACE::read always. */
|
---|
1861 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
1862 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1863 | # undef read
|
---|
1864 | # define read _read
|
---|
1865 | # endif
|
---|
1866 | # ifdef __MINGW32__
|
---|
1867 | _GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
|
---|
1868 | # else
|
---|
1869 | _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
|
---|
1870 | # endif
|
---|
1871 | # else
|
---|
1872 | _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
|
---|
1873 | # endif
|
---|
1874 | _GL_CXXALIASWARN (read);
|
---|
1875 | #endif
|
---|
1876 |
|
---|
1877 |
|
---|
1878 | #if @GNULIB_READLINK@
|
---|
1879 | /* Read the contents of the symbolic link FILE and place the first BUFSIZE
|
---|
1880 | bytes of it into BUF. Return the number of bytes placed into BUF if
|
---|
1881 | successful, otherwise -1 and errno set.
|
---|
1882 | See the POSIX:2008 specification
|
---|
1883 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
|
---|
1884 | # if @REPLACE_READLINK@
|
---|
1885 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1886 | # define readlink rpl_readlink
|
---|
1887 | # endif
|
---|
1888 | _GL_FUNCDECL_RPL (readlink, ssize_t,
|
---|
1889 | (const char *restrict file,
|
---|
1890 | char *restrict buf, size_t bufsize)
|
---|
1891 | _GL_ARG_NONNULL ((1, 2)));
|
---|
1892 | _GL_CXXALIAS_RPL (readlink, ssize_t,
|
---|
1893 | (const char *restrict file,
|
---|
1894 | char *restrict buf, size_t bufsize));
|
---|
1895 | # else
|
---|
1896 | # if !@HAVE_READLINK@
|
---|
1897 | _GL_FUNCDECL_SYS (readlink, ssize_t,
|
---|
1898 | (const char *restrict file,
|
---|
1899 | char *restrict buf, size_t bufsize)
|
---|
1900 | _GL_ARG_NONNULL ((1, 2)));
|
---|
1901 | # endif
|
---|
1902 | _GL_CXXALIAS_SYS (readlink, ssize_t,
|
---|
1903 | (const char *restrict file,
|
---|
1904 | char *restrict buf, size_t bufsize));
|
---|
1905 | # endif
|
---|
1906 | _GL_CXXALIASWARN (readlink);
|
---|
1907 | #elif defined GNULIB_POSIXCHECK
|
---|
1908 | # undef readlink
|
---|
1909 | # if HAVE_RAW_DECL_READLINK
|
---|
1910 | _GL_WARN_ON_USE (readlink, "readlink is unportable - "
|
---|
1911 | "use gnulib module readlink for portability");
|
---|
1912 | # endif
|
---|
1913 | #endif
|
---|
1914 |
|
---|
1915 |
|
---|
1916 | #if @GNULIB_READLINKAT@
|
---|
1917 | # if @REPLACE_READLINKAT@
|
---|
1918 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1919 | # define readlinkat rpl_readlinkat
|
---|
1920 | # endif
|
---|
1921 | _GL_FUNCDECL_RPL (readlinkat, ssize_t,
|
---|
1922 | (int fd, char const *restrict file,
|
---|
1923 | char *restrict buf, size_t len)
|
---|
1924 | _GL_ARG_NONNULL ((2, 3)));
|
---|
1925 | _GL_CXXALIAS_RPL (readlinkat, ssize_t,
|
---|
1926 | (int fd, char const *restrict file,
|
---|
1927 | char *restrict buf, size_t len));
|
---|
1928 | # else
|
---|
1929 | # if !@HAVE_READLINKAT@
|
---|
1930 | _GL_FUNCDECL_SYS (readlinkat, ssize_t,
|
---|
1931 | (int fd, char const *restrict file,
|
---|
1932 | char *restrict buf, size_t len)
|
---|
1933 | _GL_ARG_NONNULL ((2, 3)));
|
---|
1934 | # endif
|
---|
1935 | _GL_CXXALIAS_SYS (readlinkat, ssize_t,
|
---|
1936 | (int fd, char const *restrict file,
|
---|
1937 | char *restrict buf, size_t len));
|
---|
1938 | # endif
|
---|
1939 | _GL_CXXALIASWARN (readlinkat);
|
---|
1940 | #elif defined GNULIB_POSIXCHECK
|
---|
1941 | # undef readlinkat
|
---|
1942 | # if HAVE_RAW_DECL_READLINKAT
|
---|
1943 | _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
|
---|
1944 | "use gnulib module readlinkat for portability");
|
---|
1945 | # endif
|
---|
1946 | #endif
|
---|
1947 |
|
---|
1948 |
|
---|
1949 | #if @GNULIB_RMDIR@
|
---|
1950 | /* Remove the directory DIR. */
|
---|
1951 | # if @REPLACE_RMDIR@
|
---|
1952 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1953 | # define rmdir rpl_rmdir
|
---|
1954 | # endif
|
---|
1955 | _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
|
---|
1956 | _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
|
---|
1957 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
1958 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1959 | # undef rmdir
|
---|
1960 | # define rmdir _rmdir
|
---|
1961 | # endif
|
---|
1962 | _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
|
---|
1963 | # else
|
---|
1964 | _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
|
---|
1965 | # endif
|
---|
1966 | _GL_CXXALIASWARN (rmdir);
|
---|
1967 | #elif defined GNULIB_POSIXCHECK
|
---|
1968 | # undef rmdir
|
---|
1969 | # if HAVE_RAW_DECL_RMDIR
|
---|
1970 | _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
|
---|
1971 | "use gnulib module rmdir for portability");
|
---|
1972 | # endif
|
---|
1973 | #elif @GNULIB_MDA_RMDIR@
|
---|
1974 | /* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not
|
---|
1975 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
1976 | platforms by defining GNULIB_NAMESPACE::rmdir always. */
|
---|
1977 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
1978 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1979 | # undef rmdir
|
---|
1980 | # define rmdir _rmdir
|
---|
1981 | # endif
|
---|
1982 | _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
|
---|
1983 | # else
|
---|
1984 | _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
|
---|
1985 | # endif
|
---|
1986 | _GL_CXXALIASWARN (rmdir);
|
---|
1987 | #endif
|
---|
1988 |
|
---|
1989 |
|
---|
1990 | #if @GNULIB_SETHOSTNAME@
|
---|
1991 | /* Set the host name of the machine.
|
---|
1992 | The host name may or may not be fully qualified.
|
---|
1993 |
|
---|
1994 | Put LEN bytes of NAME into the host name.
|
---|
1995 | Return 0 if successful, otherwise, set errno and return -1.
|
---|
1996 |
|
---|
1997 | Platforms with no ability to set the hostname return -1 and set
|
---|
1998 | errno = ENOSYS. */
|
---|
1999 | # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
|
---|
2000 | _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
|
---|
2001 | _GL_ARG_NONNULL ((1)));
|
---|
2002 | # endif
|
---|
2003 | /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
|
---|
2004 | and FreeBSD 6.4 the second parameter is int. On Solaris 11
|
---|
2005 | 2011-10, the first parameter is not const. */
|
---|
2006 | _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
|
---|
2007 | _GL_CXXALIASWARN (sethostname);
|
---|
2008 | #elif defined GNULIB_POSIXCHECK
|
---|
2009 | # undef sethostname
|
---|
2010 | # if HAVE_RAW_DECL_SETHOSTNAME
|
---|
2011 | _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
|
---|
2012 | "use gnulib module sethostname for portability");
|
---|
2013 | # endif
|
---|
2014 | #endif
|
---|
2015 |
|
---|
2016 |
|
---|
2017 | #if @GNULIB_SLEEP@
|
---|
2018 | /* Pause the execution of the current thread for N seconds.
|
---|
2019 | Returns the number of seconds left to sleep.
|
---|
2020 | See the POSIX:2008 specification
|
---|
2021 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
|
---|
2022 | # if @REPLACE_SLEEP@
|
---|
2023 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2024 | # undef sleep
|
---|
2025 | # define sleep rpl_sleep
|
---|
2026 | # endif
|
---|
2027 | _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
|
---|
2028 | _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
|
---|
2029 | # else
|
---|
2030 | # if !@HAVE_SLEEP@
|
---|
2031 | _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
|
---|
2032 | # endif
|
---|
2033 | _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
|
---|
2034 | # endif
|
---|
2035 | _GL_CXXALIASWARN (sleep);
|
---|
2036 | #elif defined GNULIB_POSIXCHECK
|
---|
2037 | # undef sleep
|
---|
2038 | # if HAVE_RAW_DECL_SLEEP
|
---|
2039 | _GL_WARN_ON_USE (sleep, "sleep is unportable - "
|
---|
2040 | "use gnulib module sleep for portability");
|
---|
2041 | # endif
|
---|
2042 | #endif
|
---|
2043 |
|
---|
2044 |
|
---|
2045 | #if @GNULIB_MDA_SWAB@
|
---|
2046 | /* On native Windows, map 'swab' to '_swab', so that -loldnames is not
|
---|
2047 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
2048 | platforms by defining GNULIB_NAMESPACE::swab always. */
|
---|
2049 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
2050 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2051 | # undef swab
|
---|
2052 | # define swab _swab
|
---|
2053 | # endif
|
---|
2054 | /* Need to cast, because in old mingw the arguments are
|
---|
2055 | (const char *from, char *to, size_t n). */
|
---|
2056 | _GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
|
---|
2057 | # else
|
---|
2058 | # if defined __hpux /* HP-UX */
|
---|
2059 | _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
|
---|
2060 | # elif defined __sun && (defined __SunOS_5_10 || defined __XOPEN_OR_POSIX) && !defined _XPG4 /* Solaris */
|
---|
2061 | _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
|
---|
2062 | # else
|
---|
2063 | _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
|
---|
2064 | # endif
|
---|
2065 | # endif
|
---|
2066 | _GL_CXXALIASWARN (swab);
|
---|
2067 | #endif
|
---|
2068 |
|
---|
2069 |
|
---|
2070 | #if @GNULIB_SYMLINK@
|
---|
2071 | # if @REPLACE_SYMLINK@
|
---|
2072 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2073 | # undef symlink
|
---|
2074 | # define symlink rpl_symlink
|
---|
2075 | # endif
|
---|
2076 | _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
|
---|
2077 | _GL_ARG_NONNULL ((1, 2)));
|
---|
2078 | _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
|
---|
2079 | # else
|
---|
2080 | # if !@HAVE_SYMLINK@
|
---|
2081 | _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
|
---|
2082 | _GL_ARG_NONNULL ((1, 2)));
|
---|
2083 | # endif
|
---|
2084 | _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
|
---|
2085 | # endif
|
---|
2086 | _GL_CXXALIASWARN (symlink);
|
---|
2087 | #elif defined GNULIB_POSIXCHECK
|
---|
2088 | # undef symlink
|
---|
2089 | # if HAVE_RAW_DECL_SYMLINK
|
---|
2090 | _GL_WARN_ON_USE (symlink, "symlink is not portable - "
|
---|
2091 | "use gnulib module symlink for portability");
|
---|
2092 | # endif
|
---|
2093 | #endif
|
---|
2094 |
|
---|
2095 |
|
---|
2096 | #if @GNULIB_SYMLINKAT@
|
---|
2097 | # if @REPLACE_SYMLINKAT@
|
---|
2098 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2099 | # undef symlinkat
|
---|
2100 | # define symlinkat rpl_symlinkat
|
---|
2101 | # endif
|
---|
2102 | _GL_FUNCDECL_RPL (symlinkat, int,
|
---|
2103 | (char const *contents, int fd, char const *file)
|
---|
2104 | _GL_ARG_NONNULL ((1, 3)));
|
---|
2105 | _GL_CXXALIAS_RPL (symlinkat, int,
|
---|
2106 | (char const *contents, int fd, char const *file));
|
---|
2107 | # else
|
---|
2108 | # if !@HAVE_SYMLINKAT@
|
---|
2109 | _GL_FUNCDECL_SYS (symlinkat, int,
|
---|
2110 | (char const *contents, int fd, char const *file)
|
---|
2111 | _GL_ARG_NONNULL ((1, 3)));
|
---|
2112 | # endif
|
---|
2113 | _GL_CXXALIAS_SYS (symlinkat, int,
|
---|
2114 | (char const *contents, int fd, char const *file));
|
---|
2115 | # endif
|
---|
2116 | _GL_CXXALIASWARN (symlinkat);
|
---|
2117 | #elif defined GNULIB_POSIXCHECK
|
---|
2118 | # undef symlinkat
|
---|
2119 | # if HAVE_RAW_DECL_SYMLINKAT
|
---|
2120 | _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
|
---|
2121 | "use gnulib module symlinkat for portability");
|
---|
2122 | # endif
|
---|
2123 | #endif
|
---|
2124 |
|
---|
2125 |
|
---|
2126 | #if @GNULIB_TRUNCATE@
|
---|
2127 | /* Change the size of the file designated by FILENAME to become equal to LENGTH.
|
---|
2128 | Return 0 if successful, otherwise -1 and errno set.
|
---|
2129 | See the POSIX:2008 specification
|
---|
2130 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */
|
---|
2131 | # if @REPLACE_TRUNCATE@
|
---|
2132 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2133 | # undef truncate
|
---|
2134 | # define truncate rpl_truncate
|
---|
2135 | # endif
|
---|
2136 | _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
|
---|
2137 | _GL_ARG_NONNULL ((1)));
|
---|
2138 | _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
|
---|
2139 | # else
|
---|
2140 | # if !@HAVE_DECL_TRUNCATE@
|
---|
2141 | _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
|
---|
2142 | _GL_ARG_NONNULL ((1)));
|
---|
2143 | # endif
|
---|
2144 | _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
|
---|
2145 | # endif
|
---|
2146 | _GL_CXXALIASWARN (truncate);
|
---|
2147 | #elif defined GNULIB_POSIXCHECK
|
---|
2148 | # undef truncate
|
---|
2149 | # if HAVE_RAW_DECL_TRUNCATE
|
---|
2150 | _GL_WARN_ON_USE (truncate, "truncate is unportable - "
|
---|
2151 | "use gnulib module truncate for portability");
|
---|
2152 | # endif
|
---|
2153 | #endif
|
---|
2154 |
|
---|
2155 |
|
---|
2156 | #if @GNULIB_TTYNAME_R@
|
---|
2157 | /* Store at most BUFLEN characters of the pathname of the terminal FD is
|
---|
2158 | open on in BUF. Return 0 on success, otherwise an error number. */
|
---|
2159 | # if @REPLACE_TTYNAME_R@
|
---|
2160 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2161 | # undef ttyname_r
|
---|
2162 | # define ttyname_r rpl_ttyname_r
|
---|
2163 | # endif
|
---|
2164 | _GL_FUNCDECL_RPL (ttyname_r, int,
|
---|
2165 | (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
|
---|
2166 | _GL_CXXALIAS_RPL (ttyname_r, int,
|
---|
2167 | (int fd, char *buf, size_t buflen));
|
---|
2168 | # else
|
---|
2169 | # if !@HAVE_DECL_TTYNAME_R@
|
---|
2170 | _GL_FUNCDECL_SYS (ttyname_r, int,
|
---|
2171 | (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
|
---|
2172 | # endif
|
---|
2173 | _GL_CXXALIAS_SYS (ttyname_r, int,
|
---|
2174 | (int fd, char *buf, size_t buflen));
|
---|
2175 | # endif
|
---|
2176 | _GL_CXXALIASWARN (ttyname_r);
|
---|
2177 | #elif defined GNULIB_POSIXCHECK
|
---|
2178 | # undef ttyname_r
|
---|
2179 | # if HAVE_RAW_DECL_TTYNAME_R
|
---|
2180 | _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
|
---|
2181 | "use gnulib module ttyname_r for portability");
|
---|
2182 | # endif
|
---|
2183 | #endif
|
---|
2184 |
|
---|
2185 |
|
---|
2186 | #if @GNULIB_UNLINK@
|
---|
2187 | # if @REPLACE_UNLINK@
|
---|
2188 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2189 | # undef unlink
|
---|
2190 | # define unlink rpl_unlink
|
---|
2191 | # endif
|
---|
2192 | _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
|
---|
2193 | _GL_CXXALIAS_RPL (unlink, int, (char const *file));
|
---|
2194 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
2195 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2196 | # undef unlink
|
---|
2197 | # define unlink _unlink
|
---|
2198 | # endif
|
---|
2199 | _GL_CXXALIAS_MDA (unlink, int, (char const *file));
|
---|
2200 | # else
|
---|
2201 | _GL_CXXALIAS_SYS (unlink, int, (char const *file));
|
---|
2202 | # endif
|
---|
2203 | _GL_CXXALIASWARN (unlink);
|
---|
2204 | #elif defined GNULIB_POSIXCHECK
|
---|
2205 | # undef unlink
|
---|
2206 | # if HAVE_RAW_DECL_UNLINK
|
---|
2207 | _GL_WARN_ON_USE (unlink, "unlink is not portable - "
|
---|
2208 | "use gnulib module unlink for portability");
|
---|
2209 | # endif
|
---|
2210 | #elif @GNULIB_MDA_UNLINK@
|
---|
2211 | /* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not
|
---|
2212 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
2213 | platforms by defining GNULIB_NAMESPACE::unlink always. */
|
---|
2214 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
2215 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2216 | # undef unlink
|
---|
2217 | # define unlink _unlink
|
---|
2218 | # endif
|
---|
2219 | _GL_CXXALIAS_MDA (unlink, int, (char const *file));
|
---|
2220 | # else
|
---|
2221 | _GL_CXXALIAS_SYS (unlink, int, (char const *file));
|
---|
2222 | # endif
|
---|
2223 | _GL_CXXALIASWARN (unlink);
|
---|
2224 | #endif
|
---|
2225 |
|
---|
2226 |
|
---|
2227 | #if @GNULIB_UNLINKAT@
|
---|
2228 | # if @REPLACE_UNLINKAT@
|
---|
2229 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2230 | # undef unlinkat
|
---|
2231 | # define unlinkat rpl_unlinkat
|
---|
2232 | # endif
|
---|
2233 | _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
|
---|
2234 | _GL_ARG_NONNULL ((2)));
|
---|
2235 | _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
|
---|
2236 | # else
|
---|
2237 | # if !@HAVE_UNLINKAT@
|
---|
2238 | _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
|
---|
2239 | _GL_ARG_NONNULL ((2)));
|
---|
2240 | # endif
|
---|
2241 | _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
|
---|
2242 | # endif
|
---|
2243 | _GL_CXXALIASWARN (unlinkat);
|
---|
2244 | #elif defined GNULIB_POSIXCHECK
|
---|
2245 | # undef unlinkat
|
---|
2246 | # if HAVE_RAW_DECL_UNLINKAT
|
---|
2247 | _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
|
---|
2248 | "use gnulib module unlinkat for portability");
|
---|
2249 | # endif
|
---|
2250 | #endif
|
---|
2251 |
|
---|
2252 |
|
---|
2253 | #if @GNULIB_USLEEP@
|
---|
2254 | /* Pause the execution of the current thread for N microseconds.
|
---|
2255 | Returns 0 on completion, or -1 on range error.
|
---|
2256 | See the POSIX:2001 specification
|
---|
2257 | <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
|
---|
2258 | # if @REPLACE_USLEEP@
|
---|
2259 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2260 | # undef usleep
|
---|
2261 | # define usleep rpl_usleep
|
---|
2262 | # endif
|
---|
2263 | _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
|
---|
2264 | _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
|
---|
2265 | # else
|
---|
2266 | # if !@HAVE_USLEEP@
|
---|
2267 | _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
|
---|
2268 | # endif
|
---|
2269 | /* Need to cast, because on Haiku, the first parameter is
|
---|
2270 | unsigned int n. */
|
---|
2271 | _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
|
---|
2272 | # endif
|
---|
2273 | _GL_CXXALIASWARN (usleep);
|
---|
2274 | #elif defined GNULIB_POSIXCHECK
|
---|
2275 | # undef usleep
|
---|
2276 | # if HAVE_RAW_DECL_USLEEP
|
---|
2277 | _GL_WARN_ON_USE (usleep, "usleep is unportable - "
|
---|
2278 | "use gnulib module usleep for portability");
|
---|
2279 | # endif
|
---|
2280 | #endif
|
---|
2281 |
|
---|
2282 |
|
---|
2283 | #if @GNULIB_WRITE@
|
---|
2284 | /* Write up to COUNT bytes starting at BUF to file descriptor FD.
|
---|
2285 | See the POSIX:2008 specification
|
---|
2286 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
|
---|
2287 | # if @REPLACE_WRITE@
|
---|
2288 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2289 | # undef write
|
---|
2290 | # define write rpl_write
|
---|
2291 | # endif
|
---|
2292 | _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
|
---|
2293 | _GL_ARG_NONNULL ((2)));
|
---|
2294 | _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
|
---|
2295 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
2296 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2297 | # undef write
|
---|
2298 | # define write _write
|
---|
2299 | # endif
|
---|
2300 | _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
|
---|
2301 | # else
|
---|
2302 | _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
|
---|
2303 | # endif
|
---|
2304 | _GL_CXXALIASWARN (write);
|
---|
2305 | #elif @GNULIB_MDA_WRITE@
|
---|
2306 | /* On native Windows, map 'write' to '_write', so that -loldnames is not
|
---|
2307 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
2308 | platforms by defining GNULIB_NAMESPACE::write always. */
|
---|
2309 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
2310 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
2311 | # undef write
|
---|
2312 | # define write _write
|
---|
2313 | # endif
|
---|
2314 | # ifdef __MINGW32__
|
---|
2315 | _GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count));
|
---|
2316 | # else
|
---|
2317 | _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count));
|
---|
2318 | # endif
|
---|
2319 | # else
|
---|
2320 | _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
|
---|
2321 | # endif
|
---|
2322 | _GL_CXXALIASWARN (write);
|
---|
2323 | #endif
|
---|
2324 |
|
---|
2325 | _GL_INLINE_HEADER_END
|
---|
2326 |
|
---|
2327 | #endif /* _@GUARD_PREFIX@_UNISTD_H */
|
---|
2328 | #endif /* _GL_INCLUDING_UNISTD_H */
|
---|
2329 | #endif /* _@GUARD_PREFIX@_UNISTD_H */
|
---|