diff options
Diffstat (limited to 'gl/unistd.in.h')
-rw-r--r-- | gl/unistd.in.h | 980 |
1 files changed, 881 insertions, 99 deletions
diff --git a/gl/unistd.in.h b/gl/unistd.in.h index 2ea9af43..73c882f9 100644 --- a/gl/unistd.in.h +++ b/gl/unistd.in.h | |||
@@ -1,18 +1,18 @@ | |||
1 | /* Substitute for and wrapper around <unistd.h>. | 1 | /* Substitute for and wrapper around <unistd.h>. |
2 | Copyright (C) 2003-2013 Free Software Foundation, Inc. | 2 | Copyright (C) 2003-2021 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU Lesser General Public License as |
6 | the Free Software Foundation; either version 3, or (at your option) | 6 | published by the Free Software Foundation; either version 2.1 of the |
7 | any later version. | 7 | License, or (at your option) any later version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, | 9 | This file is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU Lesser General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU Lesser General Public License |
15 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | 15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
16 | 16 | ||
17 | #ifndef _@GUARD_PREFIX@_UNISTD_H | 17 | #ifndef _@GUARD_PREFIX@_UNISTD_H |
18 | 18 | ||
@@ -21,9 +21,23 @@ | |||
21 | #endif | 21 | #endif |
22 | @PRAGMA_COLUMNS@ | 22 | @PRAGMA_COLUMNS@ |
23 | 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 | |||
24 | /* The include_next requires a split double-inclusion guard. */ | 36 | /* The include_next requires a split double-inclusion guard. */ |
25 | #if @HAVE_UNISTD_H@ | 37 | #if @HAVE_UNISTD_H@ |
38 | # define _GL_INCLUDING_UNISTD_H | ||
26 | # @INCLUDE_NEXT@ @NEXT_UNISTD_H@ | 39 | # @INCLUDE_NEXT@ @NEXT_UNISTD_H@ |
40 | # undef _GL_INCLUDING_UNISTD_H | ||
27 | #endif | 41 | #endif |
28 | 42 | ||
29 | /* Get all possible declarations of gethostname(). */ | 43 | /* Get all possible declarations of gethostname(). */ |
@@ -38,21 +52,30 @@ | |||
38 | #define _@GUARD_PREFIX@_UNISTD_H | 52 | #define _@GUARD_PREFIX@_UNISTD_H |
39 | 53 | ||
40 | /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ | 54 | /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ |
41 | #include <stddef.h> | 55 | /* But avoid namespace pollution on glibc systems. */ |
56 | #ifndef __GLIBC__ | ||
57 | # include <stddef.h> | ||
58 | #endif | ||
42 | 59 | ||
43 | /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ | 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. */ | ||
44 | /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ | 63 | /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ |
45 | /* But avoid namespace pollution on glibc systems. */ | 64 | /* But avoid namespace pollution on glibc systems. */ |
46 | #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ | 65 | #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ |
66 | || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \ | ||
67 | && (defined _WIN32 && ! defined __CYGWIN__)) \ | ||
47 | || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ | 68 | || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ |
48 | && defined __CYGWIN__)) \ | 69 | && defined __CYGWIN__)) \ |
49 | && ! defined __GLIBC__ | 70 | && ! defined __GLIBC__ |
50 | # include <stdio.h> | 71 | # include <stdio.h> |
51 | #endif | 72 | #endif |
52 | 73 | ||
53 | /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */ | 74 | /* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in |
75 | <unistd.h>. */ | ||
54 | /* But avoid namespace pollution on glibc systems. */ | 76 | /* But avoid namespace pollution on glibc systems. */ |
55 | #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \ | 77 | #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ |
78 | && (defined __CYGWIN__ || defined __ANDROID__) \ | ||
56 | && ! defined __GLIBC__ | 79 | && ! defined __GLIBC__ |
57 | # include <fcntl.h> | 80 | # include <fcntl.h> |
58 | #endif | 81 | #endif |
@@ -70,20 +93,18 @@ | |||
70 | # undef __need_system_stdlib_h | 93 | # undef __need_system_stdlib_h |
71 | #endif | 94 | #endif |
72 | 95 | ||
73 | /* Native Windows platforms declare chdir, getcwd, rmdir in | 96 | /* Native Windows platforms declare _chdir, _getcwd, _rmdir in |
74 | <io.h> and/or <direct.h>, not in <unistd.h>. | 97 | <io.h> and/or <direct.h>, not in <unistd.h>. |
75 | They also declare access(), chmod(), close(), dup(), dup2(), isatty(), | 98 | They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(), |
76 | lseek(), read(), unlink(), write() in <io.h>. */ | 99 | _lseek(), _read(), _unlink(), _write() in <io.h>. */ |
77 | #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \ | 100 | #if defined _WIN32 && !defined __CYGWIN__ |
78 | || defined GNULIB_POSIXCHECK) \ | ||
79 | && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) | ||
80 | # include <io.h> /* mingw32, mingw64 */ | ||
81 | # include <direct.h> /* mingw64, MSVC 9 */ | ||
82 | #elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \ | ||
83 | || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \ | ||
84 | || defined GNULIB_POSIXCHECK) \ | ||
85 | && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) | ||
86 | # include <io.h> | 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> | ||
87 | #endif | 108 | #endif |
88 | 109 | ||
89 | /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. | 110 | /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. |
@@ -95,31 +116,28 @@ | |||
95 | # include <netdb.h> | 116 | # include <netdb.h> |
96 | #endif | 117 | #endif |
97 | 118 | ||
98 | /* MSVC defines off_t in <sys/types.h>. | 119 | /* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in |
99 | May also define off_t to a 64-bit type on native Windows. */ | 120 | <sys/random.h>, not in <unistd.h>. */ |
100 | #if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@ | 121 | /* But avoid namespace pollution on glibc systems. */ |
101 | /* Get off_t. */ | 122 | #if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \ |
102 | # include <sys/types.h> | 123 | && ((defined __APPLE__ && defined __MACH__) || defined __sun \ |
103 | #endif | 124 | || defined __ANDROID__) \ |
104 | 125 | && @UNISTD_H_HAVE_SYS_RANDOM_H@ \ | |
105 | #if (@GNULIB_READ@ || @GNULIB_WRITE@ \ | 126 | && !defined __GLIBC__ |
106 | || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ | 127 | # include <sys/random.h> |
107 | || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) | ||
108 | /* Get ssize_t. */ | ||
109 | # include <sys/types.h> | ||
110 | #endif | 128 | #endif |
111 | 129 | ||
112 | /* Get getopt(), optarg, optind, opterr, optopt. | 130 | /* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */ |
113 | But avoid namespace pollution on glibc systems. */ | 131 | /* But avoid namespace pollution on glibc systems. */ |
114 | #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT | 132 | #if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ |
115 | # define __need_getopt | 133 | && !defined __GLIBC__ |
116 | # include <getopt.h> | 134 | # include <sys/stat.h> |
117 | #endif | 135 | #endif |
118 | 136 | ||
119 | _GL_INLINE_HEADER_BEGIN | 137 | /* MSVC defines off_t in <sys/types.h>. |
120 | #ifndef _GL_UNISTD_INLINE | 138 | May also define off_t to a 64-bit type on native Windows. */ |
121 | # define _GL_UNISTD_INLINE _GL_INLINE | 139 | /* Get off_t, ssize_t, mode_t. */ |
122 | #endif | 140 | #include <sys/types.h> |
123 | 141 | ||
124 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | 142 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
125 | 143 | ||
@@ -128,6 +146,20 @@ _GL_INLINE_HEADER_BEGIN | |||
128 | /* The definition of _GL_WARN_ON_USE is copied here. */ | 146 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
129 | 147 | ||
130 | 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 | |||
131 | /* Hide some function declarations from <winsock2.h>. */ | 163 | /* Hide some function declarations from <winsock2.h>. */ |
132 | 164 | ||
133 | #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ | 165 | #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ |
@@ -227,15 +259,61 @@ _GL_INLINE_HEADER_BEGIN | |||
227 | /* Declare overridden functions. */ | 259 | /* Declare overridden functions. */ |
228 | 260 | ||
229 | 261 | ||
230 | #if defined GNULIB_POSIXCHECK | 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 | ||
231 | /* The access() function is a security risk. */ | 284 | /* The access() function is a security risk. */ |
232 | _GL_WARN_ON_USE (access, "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 - " | ||
233 | "use the gnulib module faccessat instead"); | 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); | ||
234 | #endif | 304 | #endif |
235 | 305 | ||
236 | 306 | ||
237 | #if @GNULIB_CHDIR@ | 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 | ||
238 | _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); | 315 | _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); |
316 | # endif | ||
239 | _GL_CXXALIASWARN (chdir); | 317 | _GL_CXXALIASWARN (chdir); |
240 | #elif defined GNULIB_POSIXCHECK | 318 | #elif defined GNULIB_POSIXCHECK |
241 | # undef chdir | 319 | # undef chdir |
@@ -243,6 +321,20 @@ _GL_CXXALIASWARN (chdir); | |||
243 | _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " | 321 | _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " |
244 | "use gnulib module chdir for portability"); | 322 | "use gnulib module chdir for portability"); |
245 | # endif | 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); | ||
246 | #endif | 338 | #endif |
247 | 339 | ||
248 | 340 | ||
@@ -251,7 +343,7 @@ _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " | |||
251 | to GID (if GID is not -1). Follow symbolic links. | 343 | to GID (if GID is not -1). Follow symbolic links. |
252 | Return 0 if successful, otherwise -1 and errno set. | 344 | Return 0 if successful, otherwise -1 and errno set. |
253 | See the POSIX:2008 specification | 345 | See the POSIX:2008 specification |
254 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */ | 346 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */ |
255 | # if @REPLACE_CHOWN@ | 347 | # if @REPLACE_CHOWN@ |
256 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 348 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
257 | # undef chown | 349 | # undef chown |
@@ -287,6 +379,12 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " | |||
287 | # endif | 379 | # endif |
288 | _GL_FUNCDECL_RPL (close, int, (int fd)); | 380 | _GL_FUNCDECL_RPL (close, int, (int fd)); |
289 | _GL_CXXALIAS_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)); | ||
290 | # else | 388 | # else |
291 | _GL_CXXALIAS_SYS (close, int, (int fd)); | 389 | _GL_CXXALIAS_SYS (close, int, (int fd)); |
292 | # endif | 390 | # endif |
@@ -299,6 +397,39 @@ _GL_CXXALIASWARN (close); | |||
299 | /* Assume close is always declared. */ | 397 | /* Assume close is always declared. */ |
300 | _GL_WARN_ON_USE (close, "close does not portably work on sockets - " | 398 | _GL_WARN_ON_USE (close, "close does not portably work on sockets - " |
301 | "use gnulib module close for portability"); | 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 !@HAVE_COPY_FILE_RANGE@ | ||
419 | _GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, | ||
420 | int ofd, off_t *opos, | ||
421 | size_t len, unsigned flags)); | ||
422 | _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, | ||
423 | int ofd, off_t *opos, | ||
424 | size_t len, unsigned flags)); | ||
425 | # endif | ||
426 | _GL_CXXALIASWARN (copy_file_range); | ||
427 | #elif defined GNULIB_POSIXCHECK | ||
428 | # if HAVE_RAW_DECL_COPY_FILE_RANGE | ||
429 | _GL_WARN_ON_USE (copy_file_range, | ||
430 | "copy_file_range is unportable - " | ||
431 | "use gnulib module copy_file_range for portability"); | ||
432 | # endif | ||
302 | #endif | 433 | #endif |
303 | 434 | ||
304 | 435 | ||
@@ -309,6 +440,12 @@ _GL_WARN_ON_USE (close, "close does not portably work on sockets - " | |||
309 | # endif | 440 | # endif |
310 | _GL_FUNCDECL_RPL (dup, int, (int oldfd)); | 441 | _GL_FUNCDECL_RPL (dup, int, (int oldfd)); |
311 | _GL_CXXALIAS_RPL (dup, int, (int oldfd)); | 442 | _GL_CXXALIAS_RPL (dup, int, (int oldfd)); |
443 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
444 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
445 | # undef dup | ||
446 | # define dup _dup | ||
447 | # endif | ||
448 | _GL_CXXALIAS_MDA (dup, int, (int oldfd)); | ||
312 | # else | 449 | # else |
313 | _GL_CXXALIAS_SYS (dup, int, (int oldfd)); | 450 | _GL_CXXALIAS_SYS (dup, int, (int oldfd)); |
314 | # endif | 451 | # endif |
@@ -319,6 +456,20 @@ _GL_CXXALIASWARN (dup); | |||
319 | _GL_WARN_ON_USE (dup, "dup is unportable - " | 456 | _GL_WARN_ON_USE (dup, "dup is unportable - " |
320 | "use gnulib module dup for portability"); | 457 | "use gnulib module dup for portability"); |
321 | # endif | 458 | # endif |
459 | #elif @GNULIB_MDA_DUP@ | ||
460 | /* On native Windows, map 'dup' to '_dup', so that -loldnames is not | ||
461 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
462 | platforms by defining GNULIB_NAMESPACE::dup always. */ | ||
463 | # if defined _WIN32 && !defined __CYGWIN__ | ||
464 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
465 | # undef dup | ||
466 | # define dup _dup | ||
467 | # endif | ||
468 | _GL_CXXALIAS_MDA (dup, int, (int oldfd)); | ||
469 | # else | ||
470 | _GL_CXXALIAS_SYS (dup, int, (int oldfd)); | ||
471 | # endif | ||
472 | _GL_CXXALIASWARN (dup); | ||
322 | #endif | 473 | #endif |
323 | 474 | ||
324 | 475 | ||
@@ -327,17 +478,20 @@ _GL_WARN_ON_USE (dup, "dup is unportable - " | |||
327 | NEWFD = OLDFD, otherwise close NEWFD first if it is open. | 478 | NEWFD = OLDFD, otherwise close NEWFD first if it is open. |
328 | Return newfd if successful, otherwise -1 and errno set. | 479 | Return newfd if successful, otherwise -1 and errno set. |
329 | See the POSIX:2008 specification | 480 | See the POSIX:2008 specification |
330 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */ | 481 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */ |
331 | # if @REPLACE_DUP2@ | 482 | # if @REPLACE_DUP2@ |
332 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 483 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
333 | # define dup2 rpl_dup2 | 484 | # define dup2 rpl_dup2 |
334 | # endif | 485 | # endif |
335 | _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); | 486 | _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); |
336 | _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); | 487 | _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); |
337 | # else | 488 | # elif defined _WIN32 && !defined __CYGWIN__ |
338 | # if !@HAVE_DUP2@ | 489 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
339 | _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd)); | 490 | # undef dup2 |
491 | # define dup2 _dup2 | ||
340 | # endif | 492 | # endif |
493 | _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd)); | ||
494 | # else | ||
341 | _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); | 495 | _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); |
342 | # endif | 496 | # endif |
343 | _GL_CXXALIASWARN (dup2); | 497 | _GL_CXXALIASWARN (dup2); |
@@ -347,6 +501,20 @@ _GL_CXXALIASWARN (dup2); | |||
347 | _GL_WARN_ON_USE (dup2, "dup2 is unportable - " | 501 | _GL_WARN_ON_USE (dup2, "dup2 is unportable - " |
348 | "use gnulib module dup2 for portability"); | 502 | "use gnulib module dup2 for portability"); |
349 | # endif | 503 | # endif |
504 | #elif @GNULIB_MDA_DUP2@ | ||
505 | /* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not | ||
506 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
507 | platforms by defining GNULIB_NAMESPACE::dup2 always. */ | ||
508 | # if defined _WIN32 && !defined __CYGWIN__ | ||
509 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
510 | # undef dup2 | ||
511 | # define dup2 _dup2 | ||
512 | # endif | ||
513 | _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd)); | ||
514 | # else | ||
515 | _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); | ||
516 | # endif | ||
517 | _GL_CXXALIASWARN (dup2); | ||
350 | #endif | 518 | #endif |
351 | 519 | ||
352 | 520 | ||
@@ -358,7 +526,7 @@ _GL_WARN_ON_USE (dup2, "dup2 is unportable - " | |||
358 | Close NEWFD first if it is open. | 526 | Close NEWFD first if it is open. |
359 | Return newfd if successful, otherwise -1 and errno set. | 527 | Return newfd if successful, otherwise -1 and errno set. |
360 | See the Linux man page at | 528 | See the Linux man page at |
361 | <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ | 529 | <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ |
362 | # if @HAVE_DUP3@ | 530 | # if @HAVE_DUP3@ |
363 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 531 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
364 | # define dup3 rpl_dup3 | 532 | # define dup3 rpl_dup3 |
@@ -380,10 +548,23 @@ _GL_WARN_ON_USE (dup3, "dup3 is unportable - " | |||
380 | 548 | ||
381 | 549 | ||
382 | #if @GNULIB_ENVIRON@ | 550 | #if @GNULIB_ENVIRON@ |
551 | # if defined __CYGWIN__ && !defined __i386__ | ||
552 | /* The 'environ' variable is defined in a DLL. Therefore its declaration needs | ||
553 | the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it. | ||
554 | This leads to a link error on 64-bit Cygwin when the option | ||
555 | -Wl,--disable-auto-import is in use. */ | ||
556 | _GL_EXTERN_C __declspec(dllimport) char **environ; | ||
557 | # endif | ||
383 | # if !@HAVE_DECL_ENVIRON@ | 558 | # if !@HAVE_DECL_ENVIRON@ |
384 | /* Set of environment variables and values. An array of strings of the form | 559 | /* Set of environment variables and values. An array of strings of the form |
385 | "VARIABLE=VALUE", terminated with a NULL. */ | 560 | "VARIABLE=VALUE", terminated with a NULL. */ |
386 | # if defined __APPLE__ && defined __MACH__ | 561 | # if defined __APPLE__ && defined __MACH__ |
562 | # include <TargetConditionals.h> | ||
563 | # if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR | ||
564 | # define _GL_USE_CRT_EXTERNS | ||
565 | # endif | ||
566 | # endif | ||
567 | # ifdef _GL_USE_CRT_EXTERNS | ||
387 | # include <crt_externs.h> | 568 | # include <crt_externs.h> |
388 | # define environ (*_NSGetEnviron ()) | 569 | # define environ (*_NSGetEnviron ()) |
389 | # else | 570 | # else |
@@ -399,12 +580,12 @@ extern char **environ; | |||
399 | #elif defined GNULIB_POSIXCHECK | 580 | #elif defined GNULIB_POSIXCHECK |
400 | # if HAVE_RAW_DECL_ENVIRON | 581 | # if HAVE_RAW_DECL_ENVIRON |
401 | _GL_UNISTD_INLINE char *** | 582 | _GL_UNISTD_INLINE char *** |
583 | _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - " | ||
584 | "use gnulib module environ for portability") | ||
402 | rpl_environ (void) | 585 | rpl_environ (void) |
403 | { | 586 | { |
404 | return &environ; | 587 | return &environ; |
405 | } | 588 | } |
406 | _GL_WARN_ON_USE (rpl_environ, "environ is unportable - " | ||
407 | "use gnulib module environ for portability"); | ||
408 | # undef environ | 589 | # undef environ |
409 | # define environ (*rpl_environ ()) | 590 | # define environ (*rpl_environ ()) |
410 | # endif | 591 | # endif |
@@ -434,14 +615,302 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " | |||
434 | #endif | 615 | #endif |
435 | 616 | ||
436 | 617 | ||
618 | #if @GNULIB_EXECL@ | ||
619 | # if @REPLACE_EXECL@ | ||
620 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
621 | # undef execl | ||
622 | # define execl rpl_execl | ||
623 | # endif | ||
624 | _GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) | ||
625 | _GL_ARG_NONNULL ((1))); | ||
626 | _GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); | ||
627 | # else | ||
628 | _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...)); | ||
629 | # endif | ||
630 | _GL_CXXALIASWARN (execl); | ||
631 | #elif defined GNULIB_POSIXCHECK | ||
632 | # undef execl | ||
633 | # if HAVE_RAW_DECL_EXECL | ||
634 | _GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - " | ||
635 | "use gnulib module execl for portability"); | ||
636 | # endif | ||
637 | #elif @GNULIB_MDA_EXECL@ | ||
638 | /* On native Windows, map 'execl' to '_execl', so that -loldnames is not | ||
639 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
640 | platforms by defining GNULIB_NAMESPACE::execl always. */ | ||
641 | # if defined _WIN32 && !defined __CYGWIN__ | ||
642 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
643 | # undef execl | ||
644 | # define execl _execl | ||
645 | # endif | ||
646 | _GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, ...)); | ||
647 | # else | ||
648 | _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...)); | ||
649 | # endif | ||
650 | _GL_CXXALIASWARN (execl); | ||
651 | #endif | ||
652 | |||
653 | #if @GNULIB_EXECLE@ | ||
654 | # if @REPLACE_EXECLE@ | ||
655 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
656 | # undef execle | ||
657 | # define execle rpl_execle | ||
658 | # endif | ||
659 | _GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) | ||
660 | _GL_ARG_NONNULL ((1))); | ||
661 | _GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); | ||
662 | # else | ||
663 | _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...)); | ||
664 | # endif | ||
665 | _GL_CXXALIASWARN (execle); | ||
666 | #elif defined GNULIB_POSIXCHECK | ||
667 | # undef execle | ||
668 | # if HAVE_RAW_DECL_EXECLE | ||
669 | _GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - " | ||
670 | "use gnulib module execle for portability"); | ||
671 | # endif | ||
672 | #elif @GNULIB_MDA_EXECLE@ | ||
673 | /* On native Windows, map 'execle' to '_execle', so that -loldnames is not | ||
674 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
675 | platforms by defining GNULIB_NAMESPACE::execle always. */ | ||
676 | # if defined _WIN32 && !defined __CYGWIN__ | ||
677 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
678 | # undef execle | ||
679 | # define execle _execle | ||
680 | # endif | ||
681 | _GL_CXXALIAS_MDA (execle, intptr_t, | ||
682 | (const char *program, const char *arg, ...)); | ||
683 | # else | ||
684 | _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...)); | ||
685 | # endif | ||
686 | _GL_CXXALIASWARN (execle); | ||
687 | #endif | ||
688 | |||
689 | #if @GNULIB_EXECLP@ | ||
690 | # if @REPLACE_EXECLP@ | ||
691 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
692 | # undef execlp | ||
693 | # define execlp rpl_execlp | ||
694 | # endif | ||
695 | _GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) | ||
696 | _GL_ARG_NONNULL ((1))); | ||
697 | _GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); | ||
698 | # else | ||
699 | _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...)); | ||
700 | # endif | ||
701 | _GL_CXXALIASWARN (execlp); | ||
702 | #elif defined GNULIB_POSIXCHECK | ||
703 | # undef execlp | ||
704 | # if HAVE_RAW_DECL_EXECLP | ||
705 | _GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - " | ||
706 | "use gnulib module execlp for portability"); | ||
707 | # endif | ||
708 | #elif @GNULIB_MDA_EXECLP@ | ||
709 | /* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not | ||
710 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
711 | platforms by defining GNULIB_NAMESPACE::execlp always. */ | ||
712 | # if defined _WIN32 && !defined __CYGWIN__ | ||
713 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
714 | # undef execlp | ||
715 | # define execlp _execlp | ||
716 | # endif | ||
717 | _GL_CXXALIAS_MDA (execlp, intptr_t, | ||
718 | (const char *program, const char *arg, ...)); | ||
719 | # else | ||
720 | _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...)); | ||
721 | # endif | ||
722 | _GL_CXXALIASWARN (execlp); | ||
723 | #endif | ||
724 | |||
725 | |||
726 | #if @GNULIB_EXECV@ | ||
727 | # if @REPLACE_EXECV@ | ||
728 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
729 | # undef execv | ||
730 | # define execv rpl_execv | ||
731 | # endif | ||
732 | _GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) | ||
733 | _GL_ARG_NONNULL ((1, 2))); | ||
734 | _GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); | ||
735 | # else | ||
736 | _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv)); | ||
737 | # endif | ||
738 | _GL_CXXALIASWARN (execv); | ||
739 | #elif defined GNULIB_POSIXCHECK | ||
740 | # undef execv | ||
741 | # if HAVE_RAW_DECL_EXECV | ||
742 | _GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - " | ||
743 | "use gnulib module execv for portability"); | ||
744 | # endif | ||
745 | #elif @GNULIB_MDA_EXECV@ | ||
746 | /* On native Windows, map 'execv' to '_execv', so that -loldnames is not | ||
747 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
748 | platforms by defining GNULIB_NAMESPACE::execv always. */ | ||
749 | # if defined _WIN32 && !defined __CYGWIN__ | ||
750 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
751 | # undef execv | ||
752 | # define execv _execv | ||
753 | # endif | ||
754 | _GL_CXXALIAS_MDA_CAST (execv, intptr_t, | ||
755 | (const char *program, char * const *argv)); | ||
756 | # else | ||
757 | _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv)); | ||
758 | # endif | ||
759 | _GL_CXXALIASWARN (execv); | ||
760 | #endif | ||
761 | |||
762 | #if @GNULIB_EXECVE@ | ||
763 | # if @REPLACE_EXECVE@ | ||
764 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
765 | # undef execve | ||
766 | # define execve rpl_execve | ||
767 | # endif | ||
768 | _GL_FUNCDECL_RPL (execve, int, | ||
769 | (const char *program, char * const *argv, char * const *env) | ||
770 | _GL_ARG_NONNULL ((1, 2))); | ||
771 | _GL_CXXALIAS_RPL (execve, int, | ||
772 | (const char *program, char * const *argv, char * const *env)); | ||
773 | # else | ||
774 | _GL_CXXALIAS_SYS (execve, int, | ||
775 | (const char *program, char * const *argv, char * const *env)); | ||
776 | # endif | ||
777 | _GL_CXXALIASWARN (execve); | ||
778 | #elif defined GNULIB_POSIXCHECK | ||
779 | # undef execve | ||
780 | # if HAVE_RAW_DECL_EXECVE | ||
781 | _GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - " | ||
782 | "use gnulib module execve for portability"); | ||
783 | # endif | ||
784 | #elif @GNULIB_MDA_EXECVE@ | ||
785 | /* On native Windows, map 'execve' to '_execve', so that -loldnames is not | ||
786 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
787 | platforms by defining GNULIB_NAMESPACE::execve always. */ | ||
788 | # if defined _WIN32 && !defined __CYGWIN__ | ||
789 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
790 | # undef execve | ||
791 | # define execve _execve | ||
792 | # endif | ||
793 | _GL_CXXALIAS_MDA_CAST (execve, intptr_t, | ||
794 | (const char *program, char * const *argv, | ||
795 | char * const *env)); | ||
796 | # else | ||
797 | _GL_CXXALIAS_SYS (execve, int, | ||
798 | (const char *program, char * const *argv, char * const *env)); | ||
799 | # endif | ||
800 | _GL_CXXALIASWARN (execve); | ||
801 | #endif | ||
802 | |||
803 | #if @GNULIB_EXECVP@ | ||
804 | # if @REPLACE_EXECVP@ | ||
805 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
806 | # undef execvp | ||
807 | # define execvp rpl_execvp | ||
808 | # endif | ||
809 | _GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) | ||
810 | _GL_ARG_NONNULL ((1, 2))); | ||
811 | _GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); | ||
812 | # else | ||
813 | _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv)); | ||
814 | # endif | ||
815 | _GL_CXXALIASWARN (execvp); | ||
816 | #elif defined GNULIB_POSIXCHECK | ||
817 | # undef execvp | ||
818 | # if HAVE_RAW_DECL_EXECVP | ||
819 | _GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - " | ||
820 | "use gnulib module execvp for portability"); | ||
821 | # endif | ||
822 | #elif @GNULIB_MDA_EXECVP@ | ||
823 | /* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not | ||
824 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
825 | platforms by defining GNULIB_NAMESPACE::execvp always. */ | ||
826 | # if defined _WIN32 && !defined __CYGWIN__ | ||
827 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
828 | # undef execvp | ||
829 | # define execvp _execvp | ||
830 | # endif | ||
831 | _GL_CXXALIAS_MDA_CAST (execvp, intptr_t, | ||
832 | (const char *program, char * const *argv)); | ||
833 | # else | ||
834 | _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv)); | ||
835 | # endif | ||
836 | _GL_CXXALIASWARN (execvp); | ||
837 | #endif | ||
838 | |||
839 | #if @GNULIB_EXECVPE@ | ||
840 | # if @REPLACE_EXECVPE@ | ||
841 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
842 | # undef execvpe | ||
843 | # define execvpe rpl_execvpe | ||
844 | # endif | ||
845 | _GL_FUNCDECL_RPL (execvpe, int, | ||
846 | (const char *program, char * const *argv, char * const *env) | ||
847 | _GL_ARG_NONNULL ((1, 2))); | ||
848 | _GL_CXXALIAS_RPL (execvpe, int, | ||
849 | (const char *program, char * const *argv, char * const *env)); | ||
850 | # else | ||
851 | # if !@HAVE_DECL_EXECVPE@ | ||
852 | _GL_FUNCDECL_SYS (execvpe, int, | ||
853 | (const char *program, char * const *argv, char * const *env) | ||
854 | _GL_ARG_NONNULL ((1, 2))); | ||
855 | # endif | ||
856 | _GL_CXXALIAS_SYS (execvpe, int, | ||
857 | (const char *program, char * const *argv, char * const *env)); | ||
858 | # endif | ||
859 | _GL_CXXALIASWARN (execvpe); | ||
860 | #elif defined GNULIB_POSIXCHECK | ||
861 | # undef execvpe | ||
862 | # if HAVE_RAW_DECL_EXECVPE | ||
863 | _GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - " | ||
864 | "use gnulib module execvpe for portability"); | ||
865 | # endif | ||
866 | #elif @GNULIB_MDA_EXECVPE@ | ||
867 | /* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not | ||
868 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
869 | platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have | ||
870 | it. */ | ||
871 | # if defined _WIN32 && !defined __CYGWIN__ | ||
872 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
873 | # undef execvpe | ||
874 | # define execvpe _execvpe | ||
875 | # endif | ||
876 | _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t, | ||
877 | (const char *program, char * const *argv, | ||
878 | char * const *env)); | ||
879 | # elif @HAVE_EXECVPE@ | ||
880 | # if !@HAVE_DECL_EXECVPE@ | ||
881 | _GL_FUNCDECL_SYS (execvpe, int, | ||
882 | (const char *program, char * const *argv, char * const *env) | ||
883 | _GL_ARG_NONNULL ((1, 2))); | ||
884 | # endif | ||
885 | _GL_CXXALIAS_SYS (execvpe, int, | ||
886 | (const char *program, char * const *argv, char * const *env)); | ||
887 | # endif | ||
888 | # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_EXECVPE@ | ||
889 | _GL_CXXALIASWARN (execvpe); | ||
890 | # endif | ||
891 | #endif | ||
892 | |||
893 | |||
437 | #if @GNULIB_FACCESSAT@ | 894 | #if @GNULIB_FACCESSAT@ |
438 | # if !@HAVE_FACCESSAT@ | 895 | # if @REPLACE_FACCESSAT@ |
896 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
897 | # undef faccessat | ||
898 | # define faccessat rpl_faccessat | ||
899 | # endif | ||
900 | _GL_FUNCDECL_RPL (faccessat, int, | ||
901 | (int fd, char const *name, int mode, int flag) | ||
902 | _GL_ARG_NONNULL ((2))); | ||
903 | _GL_CXXALIAS_RPL (faccessat, int, | ||
904 | (int fd, char const *name, int mode, int flag)); | ||
905 | # else | ||
906 | # if !@HAVE_FACCESSAT@ | ||
439 | _GL_FUNCDECL_SYS (faccessat, int, | 907 | _GL_FUNCDECL_SYS (faccessat, int, |
440 | (int fd, char const *file, int mode, int flag) | 908 | (int fd, char const *file, int mode, int flag) |
441 | _GL_ARG_NONNULL ((2))); | 909 | _GL_ARG_NONNULL ((2))); |
442 | # endif | 910 | # endif |
443 | _GL_CXXALIAS_SYS (faccessat, int, | 911 | _GL_CXXALIAS_SYS (faccessat, int, |
444 | (int fd, char const *file, int mode, int flag)); | 912 | (int fd, char const *file, int mode, int flag)); |
913 | # endif | ||
445 | _GL_CXXALIASWARN (faccessat); | 914 | _GL_CXXALIASWARN (faccessat); |
446 | #elif defined GNULIB_POSIXCHECK | 915 | #elif defined GNULIB_POSIXCHECK |
447 | # undef faccessat | 916 | # undef faccessat |
@@ -457,7 +926,7 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " | |||
457 | the given file descriptor is open. | 926 | the given file descriptor is open. |
458 | Return 0 if successful, otherwise -1 and errno set. | 927 | Return 0 if successful, otherwise -1 and errno set. |
459 | See the POSIX:2008 specification | 928 | See the POSIX:2008 specification |
460 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ | 929 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ |
461 | # if ! @HAVE_FCHDIR@ | 930 | # if ! @HAVE_FCHDIR@ |
462 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); | 931 | _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); |
463 | 932 | ||
@@ -509,7 +978,7 @@ _GL_CXXALIASWARN (fchownat); | |||
509 | # undef fchownat | 978 | # undef fchownat |
510 | # if HAVE_RAW_DECL_FCHOWNAT | 979 | # if HAVE_RAW_DECL_FCHOWNAT |
511 | _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " | 980 | _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " |
512 | "use gnulib module openat for portability"); | 981 | "use gnulib module fchownat for portability"); |
513 | # endif | 982 | # endif |
514 | #endif | 983 | #endif |
515 | 984 | ||
@@ -518,7 +987,7 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " | |||
518 | /* Synchronize changes to a file. | 987 | /* Synchronize changes to a file. |
519 | Return 0 if successful, otherwise -1 and errno set. | 988 | Return 0 if successful, otherwise -1 and errno set. |
520 | See POSIX:2008 specification | 989 | See POSIX:2008 specification |
521 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ | 990 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ |
522 | # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ | 991 | # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ |
523 | _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); | 992 | _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); |
524 | # endif | 993 | # endif |
@@ -537,7 +1006,7 @@ _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " | |||
537 | /* Synchronize changes, including metadata, to a file. | 1006 | /* Synchronize changes, including metadata, to a file. |
538 | Return 0 if successful, otherwise -1 and errno set. | 1007 | Return 0 if successful, otherwise -1 and errno set. |
539 | See POSIX:2008 specification | 1008 | See POSIX:2008 specification |
540 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ | 1009 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ |
541 | # if !@HAVE_FSYNC@ | 1010 | # if !@HAVE_FSYNC@ |
542 | _GL_FUNCDECL_SYS (fsync, int, (int fd)); | 1011 | _GL_FUNCDECL_SYS (fsync, int, (int fd)); |
543 | # endif | 1012 | # endif |
@@ -556,7 +1025,7 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - " | |||
556 | /* Change the size of the file to which FD is opened to become equal to LENGTH. | 1025 | /* Change the size of the file to which FD is opened to become equal to LENGTH. |
557 | Return 0 if successful, otherwise -1 and errno set. | 1026 | Return 0 if successful, otherwise -1 and errno set. |
558 | See the POSIX:2008 specification | 1027 | See the POSIX:2008 specification |
559 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ | 1028 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ |
560 | # if @REPLACE_FTRUNCATE@ | 1029 | # if @REPLACE_FTRUNCATE@ |
561 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1030 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
562 | # undef ftruncate | 1031 | # undef ftruncate |
@@ -586,7 +1055,7 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " | |||
586 | Return BUF if successful, or NULL if the directory couldn't be determined | 1055 | Return BUF if successful, or NULL if the directory couldn't be determined |
587 | or SIZE was too small. | 1056 | or SIZE was too small. |
588 | See the POSIX:2008 specification | 1057 | See the POSIX:2008 specification |
589 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. | 1058 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. |
590 | Additionally, the gnulib module 'getcwd' guarantees the following GNU | 1059 | Additionally, the gnulib module 'getcwd' guarantees the following GNU |
591 | extension: If BUF is NULL, an array is allocated with 'malloc'; the array | 1060 | extension: If BUF is NULL, an array is allocated with 'malloc'; the array |
592 | is SIZE bytes long, unless SIZE == 0, in which case it is as big as | 1061 | is SIZE bytes long, unless SIZE == 0, in which case it is as big as |
@@ -597,6 +1066,12 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " | |||
597 | # endif | 1066 | # endif |
598 | _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); | 1067 | _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); |
599 | _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); | 1068 | _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); |
1069 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
1070 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1071 | # undef getcwd | ||
1072 | # define getcwd _getcwd | ||
1073 | # endif | ||
1074 | _GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size)); | ||
600 | # else | 1075 | # else |
601 | /* Need to cast, because on mingw, the second parameter is | 1076 | /* Need to cast, because on mingw, the second parameter is |
602 | int size. */ | 1077 | int size. */ |
@@ -609,6 +1084,22 @@ _GL_CXXALIASWARN (getcwd); | |||
609 | _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " | 1084 | _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " |
610 | "use gnulib module getcwd for portability"); | 1085 | "use gnulib module getcwd for portability"); |
611 | # endif | 1086 | # endif |
1087 | #elif @GNULIB_MDA_GETCWD@ | ||
1088 | /* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not | ||
1089 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
1090 | platforms by defining GNULIB_NAMESPACE::getcwd always. */ | ||
1091 | # if defined _WIN32 && !defined __CYGWIN__ | ||
1092 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1093 | # undef getcwd | ||
1094 | # define getcwd _getcwd | ||
1095 | # endif | ||
1096 | /* Need to cast, because on mingw, the second parameter is either | ||
1097 | 'int size' or 'size_t size'. */ | ||
1098 | _GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size)); | ||
1099 | # else | ||
1100 | _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); | ||
1101 | # endif | ||
1102 | _GL_CXXALIASWARN (getcwd); | ||
612 | #endif | 1103 | #endif |
613 | 1104 | ||
614 | 1105 | ||
@@ -651,10 +1142,21 @@ _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " | |||
651 | #if @GNULIB_GETDTABLESIZE@ | 1142 | #if @GNULIB_GETDTABLESIZE@ |
652 | /* Return the maximum number of file descriptors in the current process. | 1143 | /* Return the maximum number of file descriptors in the current process. |
653 | In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ | 1144 | In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ |
654 | # if !@HAVE_GETDTABLESIZE@ | 1145 | # if @REPLACE_GETDTABLESIZE@ |
1146 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1147 | # undef getdtablesize | ||
1148 | # define getdtablesize rpl_getdtablesize | ||
1149 | # endif | ||
1150 | _GL_FUNCDECL_RPL (getdtablesize, int, (void)); | ||
1151 | _GL_CXXALIAS_RPL (getdtablesize, int, (void)); | ||
1152 | # else | ||
1153 | # if !@HAVE_GETDTABLESIZE@ | ||
655 | _GL_FUNCDECL_SYS (getdtablesize, int, (void)); | 1154 | _GL_FUNCDECL_SYS (getdtablesize, int, (void)); |
1155 | # endif | ||
1156 | /* Need to cast, because on AIX, the parameter list is | ||
1157 | (...). */ | ||
1158 | _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void)); | ||
656 | # endif | 1159 | # endif |
657 | _GL_CXXALIAS_SYS (getdtablesize, int, (void)); | ||
658 | _GL_CXXALIASWARN (getdtablesize); | 1160 | _GL_CXXALIASWARN (getdtablesize); |
659 | #elif defined GNULIB_POSIXCHECK | 1161 | #elif defined GNULIB_POSIXCHECK |
660 | # undef getdtablesize | 1162 | # undef getdtablesize |
@@ -665,6 +1167,22 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " | |||
665 | #endif | 1167 | #endif |
666 | 1168 | ||
667 | 1169 | ||
1170 | #if @GNULIB_GETENTROPY@ | ||
1171 | /* Fill a buffer with random bytes. */ | ||
1172 | # if !@HAVE_GETENTROPY@ | ||
1173 | _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); | ||
1174 | # endif | ||
1175 | _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); | ||
1176 | _GL_CXXALIASWARN (getentropy); | ||
1177 | #elif defined GNULIB_POSIXCHECK | ||
1178 | # undef getentropy | ||
1179 | # if HAVE_RAW_DECL_GETENTROPY | ||
1180 | _GL_WARN_ON_USE (getentropy, "getentropy is unportable - " | ||
1181 | "use gnulib module getentropy for portability"); | ||
1182 | # endif | ||
1183 | #endif | ||
1184 | |||
1185 | |||
668 | #if @GNULIB_GETGROUPS@ | 1186 | #if @GNULIB_GETGROUPS@ |
669 | /* Return the supplemental groups that the current process belongs to. | 1187 | /* Return the supplemental groups that the current process belongs to. |
670 | It is unspecified whether the effective group id is in the list. | 1188 | It is unspecified whether the effective group id is in the list. |
@@ -737,14 +1255,14 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " | |||
737 | /* Returns the user's login name, or NULL if it cannot be found. Upon error, | 1255 | /* Returns the user's login name, or NULL if it cannot be found. Upon error, |
738 | returns NULL with errno set. | 1256 | returns NULL with errno set. |
739 | 1257 | ||
740 | See <http://www.opengroup.org/susv3xsh/getlogin.html>. | 1258 | See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>. |
741 | 1259 | ||
742 | Most programs don't need to use this function, because the information is | 1260 | Most programs don't need to use this function, because the information is |
743 | available through environment variables: | 1261 | available through environment variables: |
744 | ${LOGNAME-$USER} on Unix platforms, | 1262 | ${LOGNAME-$USER} on Unix platforms, |
745 | $USERNAME on native Windows platforms. | 1263 | $USERNAME on native Windows platforms. |
746 | */ | 1264 | */ |
747 | # if !@HAVE_GETLOGIN@ | 1265 | # if !@HAVE_DECL_GETLOGIN@ |
748 | _GL_FUNCDECL_SYS (getlogin, char *, (void)); | 1266 | _GL_FUNCDECL_SYS (getlogin, char *, (void)); |
749 | # endif | 1267 | # endif |
750 | _GL_CXXALIAS_SYS (getlogin, char *, (void)); | 1268 | _GL_CXXALIAS_SYS (getlogin, char *, (void)); |
@@ -766,7 +1284,7 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " | |||
766 | the case that the login name cannot be found but no specific error is | 1284 | the case that the login name cannot be found but no specific error is |
767 | provided (this case is hopefully rare but is left open by the POSIX spec). | 1285 | provided (this case is hopefully rare but is left open by the POSIX spec). |
768 | 1286 | ||
769 | See <http://www.opengroup.org/susv3xsh/getlogin.html>. | 1287 | See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>. |
770 | 1288 | ||
771 | Most programs don't need to use this function, because the information is | 1289 | Most programs don't need to use this function, because the information is |
772 | available through environment variables: | 1290 | available through environment variables: |
@@ -807,6 +1325,11 @@ _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " | |||
807 | _GL_FUNCDECL_RPL (getpagesize, int, (void)); | 1325 | _GL_FUNCDECL_RPL (getpagesize, int, (void)); |
808 | _GL_CXXALIAS_RPL (getpagesize, int, (void)); | 1326 | _GL_CXXALIAS_RPL (getpagesize, int, (void)); |
809 | # else | 1327 | # else |
1328 | /* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if | ||
1329 | the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ | ||
1330 | # if defined __hpux | ||
1331 | _GL_FUNCDECL_SYS (getpagesize, int, (void)); | ||
1332 | # endif | ||
810 | # if !@HAVE_GETPAGESIZE@ | 1333 | # if !@HAVE_GETPAGESIZE@ |
811 | # if !defined getpagesize | 1334 | # if !defined getpagesize |
812 | /* This is for POSIX systems. */ | 1335 | /* This is for POSIX systems. */ |
@@ -881,6 +1404,53 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " | |||
881 | #endif | 1404 | #endif |
882 | 1405 | ||
883 | 1406 | ||
1407 | #if @GNULIB_GETPASS@ | ||
1408 | /* Function getpass() from module 'getpass': | ||
1409 | Read a password from /dev/tty or stdin. | ||
1410 | Function getpass() from module 'getpass-gnu': | ||
1411 | Read a password of arbitrary length from /dev/tty or stdin. */ | ||
1412 | # if @REPLACE_GETPASS@ | ||
1413 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1414 | # undef getpass | ||
1415 | # define getpass rpl_getpass | ||
1416 | # endif | ||
1417 | _GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) | ||
1418 | _GL_ARG_NONNULL ((1))); | ||
1419 | _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); | ||
1420 | # else | ||
1421 | # if !@HAVE_GETPASS@ | ||
1422 | _GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) | ||
1423 | _GL_ARG_NONNULL ((1))); | ||
1424 | # endif | ||
1425 | _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); | ||
1426 | # endif | ||
1427 | _GL_CXXALIASWARN (getpass); | ||
1428 | #elif defined GNULIB_POSIXCHECK | ||
1429 | # undef getpass | ||
1430 | # if HAVE_RAW_DECL_GETPASS | ||
1431 | _GL_WARN_ON_USE (getpass, "getpass is unportable - " | ||
1432 | "use gnulib module getpass or getpass-gnu for portability"); | ||
1433 | # endif | ||
1434 | #endif | ||
1435 | |||
1436 | |||
1437 | #if @GNULIB_MDA_GETPID@ | ||
1438 | /* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not | ||
1439 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
1440 | platforms by defining GNULIB_NAMESPACE::getpid always. */ | ||
1441 | # if defined _WIN32 && !defined __CYGWIN__ | ||
1442 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1443 | # undef getpid | ||
1444 | # define getpid _getpid | ||
1445 | # endif | ||
1446 | _GL_CXXALIAS_MDA (getpid, int, (void)); | ||
1447 | # else | ||
1448 | _GL_CXXALIAS_SYS (getpid, pid_t, (void)); | ||
1449 | # endif | ||
1450 | _GL_CXXALIASWARN (getpid); | ||
1451 | #endif | ||
1452 | |||
1453 | |||
884 | #if @GNULIB_GETUSERSHELL@ | 1454 | #if @GNULIB_GETUSERSHELL@ |
885 | /* Return the next valid login shell on the system, or NULL when the end of | 1455 | /* Return the next valid login shell on the system, or NULL when the end of |
886 | the list has been reached. */ | 1456 | the list has been reached. */ |
@@ -951,8 +1521,15 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - " | |||
951 | # undef isatty | 1521 | # undef isatty |
952 | # define isatty rpl_isatty | 1522 | # define isatty rpl_isatty |
953 | # endif | 1523 | # endif |
1524 | # define GNULIB_defined_isatty 1 | ||
954 | _GL_FUNCDECL_RPL (isatty, int, (int fd)); | 1525 | _GL_FUNCDECL_RPL (isatty, int, (int fd)); |
955 | _GL_CXXALIAS_RPL (isatty, int, (int fd)); | 1526 | _GL_CXXALIAS_RPL (isatty, int, (int fd)); |
1527 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
1528 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1529 | # undef isatty | ||
1530 | # define isatty _isatty | ||
1531 | # endif | ||
1532 | _GL_CXXALIAS_MDA (isatty, int, (int fd)); | ||
956 | # else | 1533 | # else |
957 | _GL_CXXALIAS_SYS (isatty, int, (int fd)); | 1534 | _GL_CXXALIAS_SYS (isatty, int, (int fd)); |
958 | # endif | 1535 | # endif |
@@ -963,6 +1540,20 @@ _GL_CXXALIASWARN (isatty); | |||
963 | _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " | 1540 | _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " |
964 | "use gnulib module isatty for portability"); | 1541 | "use gnulib module isatty for portability"); |
965 | # endif | 1542 | # endif |
1543 | #elif @GNULIB_MDA_ISATTY@ | ||
1544 | /* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not | ||
1545 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
1546 | platforms by defining GNULIB_NAMESPACE::isatty always. */ | ||
1547 | # if defined _WIN32 && !defined __CYGWIN__ | ||
1548 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1549 | # undef isatty | ||
1550 | # define isatty _isatty | ||
1551 | # endif | ||
1552 | _GL_CXXALIAS_MDA (isatty, int, (int fd)); | ||
1553 | # else | ||
1554 | _GL_CXXALIAS_SYS (isatty, int, (int fd)); | ||
1555 | # endif | ||
1556 | _GL_CXXALIASWARN (isatty); | ||
966 | #endif | 1557 | #endif |
967 | 1558 | ||
968 | 1559 | ||
@@ -971,7 +1562,7 @@ _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " | |||
971 | to GID (if GID is not -1). Do not follow symbolic links. | 1562 | to GID (if GID is not -1). Do not follow symbolic links. |
972 | Return 0 if successful, otherwise -1 and errno set. | 1563 | Return 0 if successful, otherwise -1 and errno set. |
973 | See the POSIX:2008 specification | 1564 | See the POSIX:2008 specification |
974 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */ | 1565 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */ |
975 | # if @REPLACE_LCHOWN@ | 1566 | # if @REPLACE_LCHOWN@ |
976 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1567 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
977 | # undef lchown | 1568 | # undef lchown |
@@ -1001,7 +1592,7 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " | |||
1001 | /* Create a new hard link for an existing file. | 1592 | /* Create a new hard link for an existing file. |
1002 | Return 0 if successful, otherwise -1 and errno set. | 1593 | Return 0 if successful, otherwise -1 and errno set. |
1003 | See POSIX:2008 specification | 1594 | See POSIX:2008 specification |
1004 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */ | 1595 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */ |
1005 | # if @REPLACE_LINK@ | 1596 | # if @REPLACE_LINK@ |
1006 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1597 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1007 | # define link rpl_link | 1598 | # define link rpl_link |
@@ -1067,13 +1658,19 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - " | |||
1067 | /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. | 1658 | /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. |
1068 | Return the new offset if successful, otherwise -1 and errno set. | 1659 | Return the new offset if successful, otherwise -1 and errno set. |
1069 | See the POSIX:2008 specification | 1660 | See the POSIX:2008 specification |
1070 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */ | 1661 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */ |
1071 | # if @REPLACE_LSEEK@ | 1662 | # if @REPLACE_LSEEK@ |
1072 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1663 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1073 | # define lseek rpl_lseek | 1664 | # define lseek rpl_lseek |
1074 | # endif | 1665 | # endif |
1075 | _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); | 1666 | _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); |
1076 | _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); | 1667 | _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); |
1668 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
1669 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1670 | # undef lseek | ||
1671 | # define lseek _lseek | ||
1672 | # endif | ||
1673 | _GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence)); | ||
1077 | # else | 1674 | # else |
1078 | _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); | 1675 | _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); |
1079 | # endif | 1676 | # endif |
@@ -1084,6 +1681,20 @@ _GL_CXXALIASWARN (lseek); | |||
1084 | _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " | 1681 | _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " |
1085 | "systems - use gnulib module lseek for portability"); | 1682 | "systems - use gnulib module lseek for portability"); |
1086 | # endif | 1683 | # endif |
1684 | #elif @GNULIB_MDA_LSEEK@ | ||
1685 | /* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not | ||
1686 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
1687 | platforms by defining GNULIB_NAMESPACE::lseek always. */ | ||
1688 | # if defined _WIN32 && !defined __CYGWIN__ | ||
1689 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1690 | # undef lseek | ||
1691 | # define lseek _lseek | ||
1692 | # endif | ||
1693 | _GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence)); | ||
1694 | # else | ||
1695 | _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); | ||
1696 | # endif | ||
1697 | _GL_CXXALIASWARN (lseek); | ||
1087 | #endif | 1698 | #endif |
1088 | 1699 | ||
1089 | 1700 | ||
@@ -1113,7 +1724,7 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - " | |||
1113 | Store the read-end as fd[0] and the write-end as fd[1]. | 1724 | Store the read-end as fd[0] and the write-end as fd[1]. |
1114 | Return 0 upon success, or -1 with errno set upon failure. | 1725 | Return 0 upon success, or -1 with errno set upon failure. |
1115 | See also the Linux man page at | 1726 | See also the Linux man page at |
1116 | <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ | 1727 | <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ |
1117 | # if @HAVE_PIPE2@ | 1728 | # if @HAVE_PIPE2@ |
1118 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1729 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1119 | # define pipe2 rpl_pipe2 | 1730 | # define pipe2 rpl_pipe2 |
@@ -1139,7 +1750,7 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " | |||
1139 | Return the number of bytes placed into BUF if successful, otherwise | 1750 | Return the number of bytes placed into BUF if successful, otherwise |
1140 | set errno and return -1. 0 indicates EOF. | 1751 | set errno and return -1. 0 indicates EOF. |
1141 | See the POSIX:2008 specification | 1752 | See the POSIX:2008 specification |
1142 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */ | 1753 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */ |
1143 | # if @REPLACE_PREAD@ | 1754 | # if @REPLACE_PREAD@ |
1144 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1755 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1145 | # undef pread | 1756 | # undef pread |
@@ -1174,7 +1785,7 @@ _GL_WARN_ON_USE (pread, "pread is unportable - " | |||
1174 | Return the number of bytes written if successful, otherwise | 1785 | Return the number of bytes written if successful, otherwise |
1175 | set errno and return -1. 0 indicates nothing written. See the | 1786 | set errno and return -1. 0 indicates nothing written. See the |
1176 | POSIX:2008 specification | 1787 | POSIX:2008 specification |
1177 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */ | 1788 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */ |
1178 | # if @REPLACE_PWRITE@ | 1789 | # if @REPLACE_PWRITE@ |
1179 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1790 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1180 | # undef pwrite | 1791 | # undef pwrite |
@@ -1207,7 +1818,7 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " | |||
1207 | #if @GNULIB_READ@ | 1818 | #if @GNULIB_READ@ |
1208 | /* Read up to COUNT bytes from file descriptor FD into the buffer starting | 1819 | /* Read up to COUNT bytes from file descriptor FD into the buffer starting |
1209 | at BUF. See the POSIX:2008 specification | 1820 | at BUF. See the POSIX:2008 specification |
1210 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */ | 1821 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */ |
1211 | # if @REPLACE_READ@ | 1822 | # if @REPLACE_READ@ |
1212 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1823 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1213 | # undef read | 1824 | # undef read |
@@ -1216,11 +1827,32 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " | |||
1216 | _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) | 1827 | _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) |
1217 | _GL_ARG_NONNULL ((2))); | 1828 | _GL_ARG_NONNULL ((2))); |
1218 | _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); | 1829 | _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); |
1830 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
1831 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1832 | # undef read | ||
1833 | # define read _read | ||
1834 | # endif | ||
1835 | _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count)); | ||
1836 | # else | ||
1837 | _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); | ||
1838 | # endif | ||
1839 | _GL_CXXALIASWARN (read); | ||
1840 | #elif @GNULIB_MDA_READ@ | ||
1841 | /* On native Windows, map 'read' to '_read', so that -loldnames is not | ||
1842 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
1843 | platforms by defining GNULIB_NAMESPACE::read always. */ | ||
1844 | # if defined _WIN32 && !defined __CYGWIN__ | ||
1845 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1846 | # undef read | ||
1847 | # define read _read | ||
1848 | # endif | ||
1849 | # ifdef __MINGW32__ | ||
1850 | _GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count)); | ||
1851 | # else | ||
1852 | _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count)); | ||
1853 | # endif | ||
1219 | # else | 1854 | # else |
1220 | /* Need to cast, because on mingw, the third parameter is | 1855 | _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); |
1221 | unsigned int count | ||
1222 | and the return type is 'int'. */ | ||
1223 | _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count)); | ||
1224 | # endif | 1856 | # endif |
1225 | _GL_CXXALIASWARN (read); | 1857 | _GL_CXXALIASWARN (read); |
1226 | #endif | 1858 | #endif |
@@ -1231,24 +1863,28 @@ _GL_CXXALIASWARN (read); | |||
1231 | bytes of it into BUF. Return the number of bytes placed into BUF if | 1863 | bytes of it into BUF. Return the number of bytes placed into BUF if |
1232 | successful, otherwise -1 and errno set. | 1864 | successful, otherwise -1 and errno set. |
1233 | See the POSIX:2008 specification | 1865 | See the POSIX:2008 specification |
1234 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ | 1866 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ |
1235 | # if @REPLACE_READLINK@ | 1867 | # if @REPLACE_READLINK@ |
1236 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 1868 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1237 | # define readlink rpl_readlink | 1869 | # define readlink rpl_readlink |
1238 | # endif | 1870 | # endif |
1239 | _GL_FUNCDECL_RPL (readlink, ssize_t, | 1871 | _GL_FUNCDECL_RPL (readlink, ssize_t, |
1240 | (const char *file, char *buf, size_t bufsize) | 1872 | (const char *restrict file, |
1873 | char *restrict buf, size_t bufsize) | ||
1241 | _GL_ARG_NONNULL ((1, 2))); | 1874 | _GL_ARG_NONNULL ((1, 2))); |
1242 | _GL_CXXALIAS_RPL (readlink, ssize_t, | 1875 | _GL_CXXALIAS_RPL (readlink, ssize_t, |
1243 | (const char *file, char *buf, size_t bufsize)); | 1876 | (const char *restrict file, |
1877 | char *restrict buf, size_t bufsize)); | ||
1244 | # else | 1878 | # else |
1245 | # if !@HAVE_READLINK@ | 1879 | # if !@HAVE_READLINK@ |
1246 | _GL_FUNCDECL_SYS (readlink, ssize_t, | 1880 | _GL_FUNCDECL_SYS (readlink, ssize_t, |
1247 | (const char *file, char *buf, size_t bufsize) | 1881 | (const char *restrict file, |
1882 | char *restrict buf, size_t bufsize) | ||
1248 | _GL_ARG_NONNULL ((1, 2))); | 1883 | _GL_ARG_NONNULL ((1, 2))); |
1249 | # endif | 1884 | # endif |
1250 | _GL_CXXALIAS_SYS (readlink, ssize_t, | 1885 | _GL_CXXALIAS_SYS (readlink, ssize_t, |
1251 | (const char *file, char *buf, size_t bufsize)); | 1886 | (const char *restrict file, |
1887 | char *restrict buf, size_t bufsize)); | ||
1252 | # endif | 1888 | # endif |
1253 | _GL_CXXALIASWARN (readlink); | 1889 | _GL_CXXALIASWARN (readlink); |
1254 | #elif defined GNULIB_POSIXCHECK | 1890 | #elif defined GNULIB_POSIXCHECK |
@@ -1261,13 +1897,28 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - " | |||
1261 | 1897 | ||
1262 | 1898 | ||
1263 | #if @GNULIB_READLINKAT@ | 1899 | #if @GNULIB_READLINKAT@ |
1264 | # if !@HAVE_READLINKAT@ | 1900 | # if @REPLACE_READLINKAT@ |
1901 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1902 | # define readlinkat rpl_readlinkat | ||
1903 | # endif | ||
1904 | _GL_FUNCDECL_RPL (readlinkat, ssize_t, | ||
1905 | (int fd, char const *restrict file, | ||
1906 | char *restrict buf, size_t len) | ||
1907 | _GL_ARG_NONNULL ((2, 3))); | ||
1908 | _GL_CXXALIAS_RPL (readlinkat, ssize_t, | ||
1909 | (int fd, char const *restrict file, | ||
1910 | char *restrict buf, size_t len)); | ||
1911 | # else | ||
1912 | # if !@HAVE_READLINKAT@ | ||
1265 | _GL_FUNCDECL_SYS (readlinkat, ssize_t, | 1913 | _GL_FUNCDECL_SYS (readlinkat, ssize_t, |
1266 | (int fd, char const *file, char *buf, size_t len) | 1914 | (int fd, char const *restrict file, |
1915 | char *restrict buf, size_t len) | ||
1267 | _GL_ARG_NONNULL ((2, 3))); | 1916 | _GL_ARG_NONNULL ((2, 3))); |
1268 | # endif | 1917 | # endif |
1269 | _GL_CXXALIAS_SYS (readlinkat, ssize_t, | 1918 | _GL_CXXALIAS_SYS (readlinkat, ssize_t, |
1270 | (int fd, char const *file, char *buf, size_t len)); | 1919 | (int fd, char const *restrict file, |
1920 | char *restrict buf, size_t len)); | ||
1921 | # endif | ||
1271 | _GL_CXXALIASWARN (readlinkat); | 1922 | _GL_CXXALIASWARN (readlinkat); |
1272 | #elif defined GNULIB_POSIXCHECK | 1923 | #elif defined GNULIB_POSIXCHECK |
1273 | # undef readlinkat | 1924 | # undef readlinkat |
@@ -1286,6 +1937,12 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " | |||
1286 | # endif | 1937 | # endif |
1287 | _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); | 1938 | _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); |
1288 | _GL_CXXALIAS_RPL (rmdir, int, (char const *name)); | 1939 | _GL_CXXALIAS_RPL (rmdir, int, (char const *name)); |
1940 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
1941 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1942 | # undef rmdir | ||
1943 | # define rmdir _rmdir | ||
1944 | # endif | ||
1945 | _GL_CXXALIAS_MDA (rmdir, int, (char const *name)); | ||
1289 | # else | 1946 | # else |
1290 | _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); | 1947 | _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); |
1291 | # endif | 1948 | # endif |
@@ -1296,6 +1953,20 @@ _GL_CXXALIASWARN (rmdir); | |||
1296 | _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " | 1953 | _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " |
1297 | "use gnulib module rmdir for portability"); | 1954 | "use gnulib module rmdir for portability"); |
1298 | # endif | 1955 | # endif |
1956 | #elif @GNULIB_MDA_RMDIR@ | ||
1957 | /* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not | ||
1958 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
1959 | platforms by defining GNULIB_NAMESPACE::rmdir always. */ | ||
1960 | # if defined _WIN32 && !defined __CYGWIN__ | ||
1961 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1962 | # undef rmdir | ||
1963 | # define rmdir _rmdir | ||
1964 | # endif | ||
1965 | _GL_CXXALIAS_MDA (rmdir, int, (char const *name)); | ||
1966 | # else | ||
1967 | _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); | ||
1968 | # endif | ||
1969 | _GL_CXXALIASWARN (rmdir); | ||
1299 | #endif | 1970 | #endif |
1300 | 1971 | ||
1301 | 1972 | ||
@@ -1330,7 +2001,7 @@ _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " | |||
1330 | /* Pause the execution of the current thread for N seconds. | 2001 | /* Pause the execution of the current thread for N seconds. |
1331 | Returns the number of seconds left to sleep. | 2002 | Returns the number of seconds left to sleep. |
1332 | See the POSIX:2008 specification | 2003 | See the POSIX:2008 specification |
1333 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */ | 2004 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */ |
1334 | # if @REPLACE_SLEEP@ | 2005 | # if @REPLACE_SLEEP@ |
1335 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 2006 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1336 | # undef sleep | 2007 | # undef sleep |
@@ -1354,6 +2025,31 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - " | |||
1354 | #endif | 2025 | #endif |
1355 | 2026 | ||
1356 | 2027 | ||
2028 | #if @GNULIB_MDA_SWAB@ | ||
2029 | /* On native Windows, map 'swab' to '_swab', so that -loldnames is not | ||
2030 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
2031 | platforms by defining GNULIB_NAMESPACE::swab always. */ | ||
2032 | # if defined _WIN32 && !defined __CYGWIN__ | ||
2033 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2034 | # undef swab | ||
2035 | # define swab _swab | ||
2036 | # endif | ||
2037 | /* Need to cast, because in old mingw the arguments are | ||
2038 | (const char *from, char *to, size_t n). */ | ||
2039 | _GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n)); | ||
2040 | # else | ||
2041 | # if defined __hpux /* HP-UX */ | ||
2042 | _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n)); | ||
2043 | # elif defined __sun && !defined _XPG4 /* Solaris */ | ||
2044 | _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n)); | ||
2045 | # else | ||
2046 | _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n)); | ||
2047 | # endif | ||
2048 | # endif | ||
2049 | _GL_CXXALIASWARN (swab); | ||
2050 | #endif | ||
2051 | |||
2052 | |||
1357 | #if @GNULIB_SYMLINK@ | 2053 | #if @GNULIB_SYMLINK@ |
1358 | # if @REPLACE_SYMLINK@ | 2054 | # if @REPLACE_SYMLINK@ |
1359 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 2055 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
@@ -1381,13 +2077,25 @@ _GL_WARN_ON_USE (symlink, "symlink is not portable - " | |||
1381 | 2077 | ||
1382 | 2078 | ||
1383 | #if @GNULIB_SYMLINKAT@ | 2079 | #if @GNULIB_SYMLINKAT@ |
1384 | # if !@HAVE_SYMLINKAT@ | 2080 | # if @REPLACE_SYMLINKAT@ |
2081 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2082 | # undef symlinkat | ||
2083 | # define symlinkat rpl_symlinkat | ||
2084 | # endif | ||
2085 | _GL_FUNCDECL_RPL (symlinkat, int, | ||
2086 | (char const *contents, int fd, char const *file) | ||
2087 | _GL_ARG_NONNULL ((1, 3))); | ||
2088 | _GL_CXXALIAS_RPL (symlinkat, int, | ||
2089 | (char const *contents, int fd, char const *file)); | ||
2090 | # else | ||
2091 | # if !@HAVE_SYMLINKAT@ | ||
1385 | _GL_FUNCDECL_SYS (symlinkat, int, | 2092 | _GL_FUNCDECL_SYS (symlinkat, int, |
1386 | (char const *contents, int fd, char const *file) | 2093 | (char const *contents, int fd, char const *file) |
1387 | _GL_ARG_NONNULL ((1, 3))); | 2094 | _GL_ARG_NONNULL ((1, 3))); |
1388 | # endif | 2095 | # endif |
1389 | _GL_CXXALIAS_SYS (symlinkat, int, | 2096 | _GL_CXXALIAS_SYS (symlinkat, int, |
1390 | (char const *contents, int fd, char const *file)); | 2097 | (char const *contents, int fd, char const *file)); |
2098 | # endif | ||
1391 | _GL_CXXALIASWARN (symlinkat); | 2099 | _GL_CXXALIASWARN (symlinkat); |
1392 | #elif defined GNULIB_POSIXCHECK | 2100 | #elif defined GNULIB_POSIXCHECK |
1393 | # undef symlinkat | 2101 | # undef symlinkat |
@@ -1398,6 +2106,36 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " | |||
1398 | #endif | 2106 | #endif |
1399 | 2107 | ||
1400 | 2108 | ||
2109 | #if @GNULIB_TRUNCATE@ | ||
2110 | /* Change the size of the file designated by FILENAME to become equal to LENGTH. | ||
2111 | Return 0 if successful, otherwise -1 and errno set. | ||
2112 | See the POSIX:2008 specification | ||
2113 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */ | ||
2114 | # if @REPLACE_TRUNCATE@ | ||
2115 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2116 | # undef truncate | ||
2117 | # define truncate rpl_truncate | ||
2118 | # endif | ||
2119 | _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) | ||
2120 | _GL_ARG_NONNULL ((1))); | ||
2121 | _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); | ||
2122 | # else | ||
2123 | # if !@HAVE_DECL_TRUNCATE@ | ||
2124 | _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) | ||
2125 | _GL_ARG_NONNULL ((1))); | ||
2126 | # endif | ||
2127 | _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); | ||
2128 | # endif | ||
2129 | _GL_CXXALIASWARN (truncate); | ||
2130 | #elif defined GNULIB_POSIXCHECK | ||
2131 | # undef truncate | ||
2132 | # if HAVE_RAW_DECL_TRUNCATE | ||
2133 | _GL_WARN_ON_USE (truncate, "truncate is unportable - " | ||
2134 | "use gnulib module truncate for portability"); | ||
2135 | # endif | ||
2136 | #endif | ||
2137 | |||
2138 | |||
1401 | #if @GNULIB_TTYNAME_R@ | 2139 | #if @GNULIB_TTYNAME_R@ |
1402 | /* Store at most BUFLEN characters of the pathname of the terminal FD is | 2140 | /* Store at most BUFLEN characters of the pathname of the terminal FD is |
1403 | open on in BUF. Return 0 on success, otherwise an error number. */ | 2141 | open on in BUF. Return 0 on success, otherwise an error number. */ |
@@ -1436,6 +2174,12 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " | |||
1436 | # endif | 2174 | # endif |
1437 | _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); | 2175 | _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); |
1438 | _GL_CXXALIAS_RPL (unlink, int, (char const *file)); | 2176 | _GL_CXXALIAS_RPL (unlink, int, (char const *file)); |
2177 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
2178 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2179 | # undef unlink | ||
2180 | # define unlink _unlink | ||
2181 | # endif | ||
2182 | _GL_CXXALIAS_MDA (unlink, int, (char const *file)); | ||
1439 | # else | 2183 | # else |
1440 | _GL_CXXALIAS_SYS (unlink, int, (char const *file)); | 2184 | _GL_CXXALIAS_SYS (unlink, int, (char const *file)); |
1441 | # endif | 2185 | # endif |
@@ -1446,6 +2190,20 @@ _GL_CXXALIASWARN (unlink); | |||
1446 | _GL_WARN_ON_USE (unlink, "unlink is not portable - " | 2190 | _GL_WARN_ON_USE (unlink, "unlink is not portable - " |
1447 | "use gnulib module unlink for portability"); | 2191 | "use gnulib module unlink for portability"); |
1448 | # endif | 2192 | # endif |
2193 | #elif @GNULIB_MDA_UNLINK@ | ||
2194 | /* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not | ||
2195 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
2196 | platforms by defining GNULIB_NAMESPACE::unlink always. */ | ||
2197 | # if defined _WIN32 && !defined __CYGWIN__ | ||
2198 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2199 | # undef unlink | ||
2200 | # define unlink _unlink | ||
2201 | # endif | ||
2202 | _GL_CXXALIAS_MDA (unlink, int, (char const *file)); | ||
2203 | # else | ||
2204 | _GL_CXXALIAS_SYS (unlink, int, (char const *file)); | ||
2205 | # endif | ||
2206 | _GL_CXXALIASWARN (unlink); | ||
1449 | #endif | 2207 | #endif |
1450 | 2208 | ||
1451 | 2209 | ||
@@ -1470,7 +2228,7 @@ _GL_CXXALIASWARN (unlinkat); | |||
1470 | # undef unlinkat | 2228 | # undef unlinkat |
1471 | # if HAVE_RAW_DECL_UNLINKAT | 2229 | # if HAVE_RAW_DECL_UNLINKAT |
1472 | _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " | 2230 | _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " |
1473 | "use gnulib module openat for portability"); | 2231 | "use gnulib module unlinkat for portability"); |
1474 | # endif | 2232 | # endif |
1475 | #endif | 2233 | #endif |
1476 | 2234 | ||
@@ -1479,7 +2237,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " | |||
1479 | /* Pause the execution of the current thread for N microseconds. | 2237 | /* Pause the execution of the current thread for N microseconds. |
1480 | Returns 0 on completion, or -1 on range error. | 2238 | Returns 0 on completion, or -1 on range error. |
1481 | See the POSIX:2001 specification | 2239 | See the POSIX:2001 specification |
1482 | <http://www.opengroup.org/susv3xsh/usleep.html>. */ | 2240 | <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ |
1483 | # if @REPLACE_USLEEP@ | 2241 | # if @REPLACE_USLEEP@ |
1484 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 2242 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1485 | # undef usleep | 2243 | # undef usleep |
@@ -1491,7 +2249,9 @@ _GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); | |||
1491 | # if !@HAVE_USLEEP@ | 2249 | # if !@HAVE_USLEEP@ |
1492 | _GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); | 2250 | _GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); |
1493 | # endif | 2251 | # endif |
1494 | _GL_CXXALIAS_SYS (usleep, int, (useconds_t n)); | 2252 | /* Need to cast, because on Haiku, the first parameter is |
2253 | unsigned int n. */ | ||
2254 | _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n)); | ||
1495 | # endif | 2255 | # endif |
1496 | _GL_CXXALIASWARN (usleep); | 2256 | _GL_CXXALIASWARN (usleep); |
1497 | #elif defined GNULIB_POSIXCHECK | 2257 | #elif defined GNULIB_POSIXCHECK |
@@ -1506,7 +2266,7 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - " | |||
1506 | #if @GNULIB_WRITE@ | 2266 | #if @GNULIB_WRITE@ |
1507 | /* Write up to COUNT bytes starting at BUF to file descriptor FD. | 2267 | /* Write up to COUNT bytes starting at BUF to file descriptor FD. |
1508 | See the POSIX:2008 specification | 2268 | See the POSIX:2008 specification |
1509 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */ | 2269 | <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */ |
1510 | # if @REPLACE_WRITE@ | 2270 | # if @REPLACE_WRITE@ |
1511 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | 2271 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
1512 | # undef write | 2272 | # undef write |
@@ -1515,11 +2275,32 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - " | |||
1515 | _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) | 2275 | _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) |
1516 | _GL_ARG_NONNULL ((2))); | 2276 | _GL_ARG_NONNULL ((2))); |
1517 | _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); | 2277 | _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); |
2278 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
2279 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2280 | # undef write | ||
2281 | # define write _write | ||
2282 | # endif | ||
2283 | _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count)); | ||
2284 | # else | ||
2285 | _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); | ||
2286 | # endif | ||
2287 | _GL_CXXALIASWARN (write); | ||
2288 | #elif @GNULIB_MDA_WRITE@ | ||
2289 | /* On native Windows, map 'write' to '_write', so that -loldnames is not | ||
2290 | required. In C++ with GNULIB_NAMESPACE, avoid differences between | ||
2291 | platforms by defining GNULIB_NAMESPACE::write always. */ | ||
2292 | # if defined _WIN32 && !defined __CYGWIN__ | ||
2293 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
2294 | # undef write | ||
2295 | # define write _write | ||
2296 | # endif | ||
2297 | # ifdef __MINGW32__ | ||
2298 | _GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count)); | ||
2299 | # else | ||
2300 | _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count)); | ||
2301 | # endif | ||
1518 | # else | 2302 | # else |
1519 | /* Need to cast, because on mingw, the third parameter is | 2303 | _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); |
1520 | unsigned int count | ||
1521 | and the return type is 'int'. */ | ||
1522 | _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); | ||
1523 | # endif | 2304 | # endif |
1524 | _GL_CXXALIASWARN (write); | 2305 | _GL_CXXALIASWARN (write); |
1525 | #endif | 2306 | #endif |
@@ -1527,4 +2308,5 @@ _GL_CXXALIASWARN (write); | |||
1527 | _GL_INLINE_HEADER_END | 2308 | _GL_INLINE_HEADER_END |
1528 | 2309 | ||
1529 | #endif /* _@GUARD_PREFIX@_UNISTD_H */ | 2310 | #endif /* _@GUARD_PREFIX@_UNISTD_H */ |
2311 | #endif /* _GL_INCLUDING_UNISTD_H */ | ||
1530 | #endif /* _@GUARD_PREFIX@_UNISTD_H */ | 2312 | #endif /* _@GUARD_PREFIX@_UNISTD_H */ |