1 /* Substitute for and wrapper around <unistd.h>. 2 Copyright (C) 2003-2021 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 !@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 433 #endif 434 435 436 #if @GNULIB_DUP@ 437 # if @REPLACE_DUP@ 438 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 439 # define dup rpl_dup 440 # endif 441 _GL_FUNCDECL_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)); 449 # else 450 _GL_CXXALIAS_SYS (dup, int, (int oldfd)); 451 # endif 452 _GL_CXXALIASWARN (dup); 453 #elif defined GNULIB_POSIXCHECK 454 # undef dup 455 # if HAVE_RAW_DECL_DUP 456 _GL_WARN_ON_USE (dup, "dup is unportable - " 457 "use gnulib module dup for portability"); 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); 473 #endif 474 475 476 #if @GNULIB_DUP2@ 477 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if 478 NEWFD = OLDFD, otherwise close NEWFD first if it is open. 479 Return newfd if successful, otherwise -1 and errno set. 480 See the POSIX:2008 specification 481 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */ 482 # if @REPLACE_DUP2@ 483 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 484 # define dup2 rpl_dup2 485 # endif 486 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); 487 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); 488 # elif defined _WIN32 && !defined __CYGWIN__ 489 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 490 # undef dup2 491 # define dup2 _dup2 492 # endif 493 _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd)); 494 # else 495 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); 496 # endif 497 _GL_CXXALIASWARN (dup2); 498 #elif defined GNULIB_POSIXCHECK 499 # undef dup2 500 # if HAVE_RAW_DECL_DUP2 501 _GL_WARN_ON_USE (dup2, "dup2 is unportable - " 502 "use gnulib module dup2 for portability"); 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); 518 #endif 519 520 521 #if @GNULIB_DUP3@ 522 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the 523 specified flags. 524 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 525 and O_TEXT, O_BINARY (defined in "binary-io.h"). 526 Close NEWFD first if it is open. 527 Return newfd if successful, otherwise -1 and errno set. 528 See the Linux man page at 529 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ 530 # if @HAVE_DUP3@ 531 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 532 # define dup3 rpl_dup3 533 # endif 534 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); 535 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); 536 # else 537 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); 538 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); 539 # endif 540 _GL_CXXALIASWARN (dup3); 541 #elif defined GNULIB_POSIXCHECK 542 # undef dup3 543 # if HAVE_RAW_DECL_DUP3 544 _GL_WARN_ON_USE (dup3, "dup3 is unportable - " 545 "use gnulib module dup3 for portability"); 546 # endif 547 #endif 548 549 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 558 # if !@HAVE_DECL_ENVIRON@ 559 /* Set of environment variables and values. An array of strings of the form 560 "VARIABLE=VALUE", terminated with a NULL. */ 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 568 # include <crt_externs.h> 569 # define environ (*_NSGetEnviron ()) 570 # else 571 # ifdef __cplusplus 572 extern "C" { 573 # endif 574 extern char **environ; 575 # ifdef __cplusplus 576 } 577 # endif 578 # endif 579 # endif 580 #elif defined GNULIB_POSIXCHECK 581 # if HAVE_RAW_DECL_ENVIRON 582 _GL_UNISTD_INLINE char *** 583 _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - " 584 "use gnulib module environ for portability") 585 rpl_environ (void) 586 { 587 return &environ; 588 } 589 # undef environ 590 # define environ (*rpl_environ ()) 591 # endif 592 #endif 593 594 595 #if @GNULIB_EUIDACCESS@ 596 /* Like access(), except that it uses the effective user id and group id of 597 the current process. */ 598 # if !@HAVE_EUIDACCESS@ 599 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) 600 _GL_ARG_NONNULL ((1))); 601 # endif 602 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); 603 _GL_CXXALIASWARN (euidaccess); 604 # if defined GNULIB_POSIXCHECK 605 /* Like access(), this function is a security risk. */ 606 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " 607 "use the gnulib module faccessat instead"); 608 # endif 609 #elif defined GNULIB_POSIXCHECK 610 # undef euidaccess 611 # if HAVE_RAW_DECL_EUIDACCESS 612 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " 613 "use gnulib module euidaccess for portability"); 614 # endif 615 #endif 616 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 894 #if @GNULIB_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@ 907 _GL_FUNCDECL_SYS (faccessat, int, 908 (int fd, char const *file, int mode, int flag) 909 _GL_ARG_NONNULL ((2))); 910 # endif 911 _GL_CXXALIAS_SYS (faccessat, int, 912 (int fd, char const *file, int mode, int flag)); 913 # endif 914 _GL_CXXALIASWARN (faccessat); 915 #elif defined GNULIB_POSIXCHECK 916 # undef faccessat 917 # if HAVE_RAW_DECL_FACCESSAT 918 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " 919 "use gnulib module faccessat for portability"); 920 # endif 921 #endif 922 923 924 #if @GNULIB_FCHDIR@ 925 /* Change the process' current working directory to the directory on which 926 the given file descriptor is open. 927 Return 0 if successful, otherwise -1 and errno set. 928 See the POSIX:2008 specification 929 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ 930 # if ! @HAVE_FCHDIR@ 931 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 932 933 /* Gnulib internal hooks needed to maintain the fchdir metadata. */ 934 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) 935 _GL_ARG_NONNULL ((2)); 936 _GL_EXTERN_C void _gl_unregister_fd (int fd); 937 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); 938 _GL_EXTERN_C const char *_gl_directory_name (int fd); 939 940 # else 941 # if !@HAVE_DECL_FCHDIR@ 942 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 943 # endif 944 # endif 945 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); 946 _GL_CXXALIASWARN (fchdir); 947 #elif defined GNULIB_POSIXCHECK 948 # undef fchdir 949 # if HAVE_RAW_DECL_FCHDIR 950 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - " 951 "use gnulib module fchdir for portability"); 952 # endif 953 #endif 954 955 956 #if @GNULIB_FCHOWNAT@ 957 # if @REPLACE_FCHOWNAT@ 958 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 959 # undef fchownat 960 # define fchownat rpl_fchownat 961 # endif 962 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, 963 uid_t owner, gid_t group, int flag) 964 _GL_ARG_NONNULL ((2))); 965 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, 966 uid_t owner, gid_t group, int flag)); 967 # else 968 # if !@HAVE_FCHOWNAT@ 969 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, 970 uid_t owner, gid_t group, int flag) 971 _GL_ARG_NONNULL ((2))); 972 # endif 973 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, 974 uid_t owner, gid_t group, int flag)); 975 # endif 976 _GL_CXXALIASWARN (fchownat); 977 #elif defined GNULIB_POSIXCHECK 978 # undef fchownat 979 # if HAVE_RAW_DECL_FCHOWNAT 980 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " 981 "use gnulib module fchownat for portability"); 982 # endif 983 #endif 984 985 986 #if @GNULIB_FDATASYNC@ 987 /* Synchronize changes to a file. 988 Return 0 if successful, otherwise -1 and errno set. 989 See POSIX:2008 specification 990 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ 991 # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ 992 _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); 993 # endif 994 _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); 995 _GL_CXXALIASWARN (fdatasync); 996 #elif defined GNULIB_POSIXCHECK 997 # undef fdatasync 998 # if HAVE_RAW_DECL_FDATASYNC 999 _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " 1000 "use gnulib module fdatasync for portability"); 1001 # endif 1002 #endif 1003 1004 1005 #if @GNULIB_FSYNC@ 1006 /* Synchronize changes, including metadata, to a file. 1007 Return 0 if successful, otherwise -1 and errno set. 1008 See POSIX:2008 specification 1009 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ 1010 # if !@HAVE_FSYNC@ 1011 _GL_FUNCDECL_SYS (fsync, int, (int fd)); 1012 # endif 1013 _GL_CXXALIAS_SYS (fsync, int, (int fd)); 1014 _GL_CXXALIASWARN (fsync); 1015 #elif defined GNULIB_POSIXCHECK 1016 # undef fsync 1017 # if HAVE_RAW_DECL_FSYNC 1018 _GL_WARN_ON_USE (fsync, "fsync is unportable - " 1019 "use gnulib module fsync for portability"); 1020 # endif 1021 #endif 1022 1023 1024 #if @GNULIB_FTRUNCATE@ 1025 /* Change the size of the file to which FD is opened to become equal to LENGTH. 1026 Return 0 if successful, otherwise -1 and errno set. 1027 See the POSIX:2008 specification 1028 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ 1029 # if @REPLACE_FTRUNCATE@ 1030 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1031 # undef ftruncate 1032 # define ftruncate rpl_ftruncate 1033 # endif 1034 _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); 1035 _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); 1036 # else 1037 # if !@HAVE_FTRUNCATE@ 1038 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 1039 # endif 1040 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 1041 # endif 1042 _GL_CXXALIASWARN (ftruncate); 1043 #elif defined GNULIB_POSIXCHECK 1044 # undef ftruncate 1045 # if HAVE_RAW_DECL_FTRUNCATE 1046 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " 1047 "use gnulib module ftruncate for portability"); 1048 # endif 1049 #endif 1050 1051 1052 #if @GNULIB_GETCWD@ 1053 /* Get the name of the current working directory, and put it in SIZE bytes 1054 of BUF. 1055 Return BUF if successful, or NULL if the directory couldn't be determined 1056 or SIZE was too small. 1057 See the POSIX:2008 specification 1058 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. 1059 Additionally, the gnulib module 'getcwd' guarantees the following GNU 1060 extension: If BUF is NULL, an array is allocated with 'malloc'; the array 1061 is SIZE bytes long, unless SIZE == 0, in which case it is as big as 1062 necessary. */ 1063 # if @REPLACE_GETCWD@ 1064 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1065 # define getcwd rpl_getcwd 1066 # endif 1067 _GL_FUNCDECL_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)); 1075 # else 1076 /* Need to cast, because on mingw, the second parameter is 1077 int size. */ 1078 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); 1079 # endif 1080 _GL_CXXALIASWARN (getcwd); 1081 #elif defined GNULIB_POSIXCHECK 1082 # undef getcwd 1083 # if HAVE_RAW_DECL_GETCWD 1084 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " 1085 "use gnulib module getcwd for portability"); 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); 1103 #endif 1104 1105 1106 #if @GNULIB_GETDOMAINNAME@ 1107 /* Return the NIS domain name of the machine. 1108 WARNING! The NIS domain name is unrelated to the fully qualified host name 1109 of the machine. It is also unrelated to email addresses. 1110 WARNING! The NIS domain name is usually the empty string or "(none)" when 1111 not using NIS. 1112 1113 Put up to LEN bytes of the NIS domain name into NAME. 1114 Null terminate it if the name is shorter than LEN. 1115 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. 1116 Return 0 if successful, otherwise set errno and return -1. */ 1117 # if @REPLACE_GETDOMAINNAME@ 1118 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1119 # undef getdomainname 1120 # define getdomainname rpl_getdomainname 1121 # endif 1122 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) 1123 _GL_ARG_NONNULL ((1))); 1124 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); 1125 # else 1126 # if !@HAVE_DECL_GETDOMAINNAME@ 1127 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) 1128 _GL_ARG_NONNULL ((1))); 1129 # endif 1130 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); 1131 # endif 1132 _GL_CXXALIASWARN (getdomainname); 1133 #elif defined GNULIB_POSIXCHECK 1134 # undef getdomainname 1135 # if HAVE_RAW_DECL_GETDOMAINNAME 1136 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " 1137 "use gnulib module getdomainname for portability"); 1138 # endif 1139 #endif 1140 1141 1142 #if @GNULIB_GETDTABLESIZE@ 1143 /* Return the maximum number of file descriptors in the current process. 1144 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ 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@ 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)); 1159 # endif 1160 _GL_CXXALIASWARN (getdtablesize); 1161 #elif defined GNULIB_POSIXCHECK 1162 # undef getdtablesize 1163 # if HAVE_RAW_DECL_GETDTABLESIZE 1164 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " 1165 "use gnulib module getdtablesize for portability"); 1166 # endif 1167 #endif 1168 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 1186 #if @GNULIB_GETGROUPS@ 1187 /* Return the supplemental groups that the current process belongs to. 1188 It is unspecified whether the effective group id is in the list. 1189 If N is 0, return the group count; otherwise, N describes how many 1190 entries are available in GROUPS. Return -1 and set errno if N is 1191 not 0 and not large enough. Fails with ENOSYS on some systems. */ 1192 # if @REPLACE_GETGROUPS@ 1193 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1194 # undef getgroups 1195 # define getgroups rpl_getgroups 1196 # endif 1197 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); 1198 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); 1199 # else 1200 # if !@HAVE_GETGROUPS@ 1201 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); 1202 # endif 1203 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); 1204 # endif 1205 _GL_CXXALIASWARN (getgroups); 1206 #elif defined GNULIB_POSIXCHECK 1207 # undef getgroups 1208 # if HAVE_RAW_DECL_GETGROUPS 1209 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - " 1210 "use gnulib module getgroups for portability"); 1211 # endif 1212 #endif 1213 1214 1215 #if @GNULIB_GETHOSTNAME@ 1216 /* Return the standard host name of the machine. 1217 WARNING! The host name may or may not be fully qualified. 1218 1219 Put up to LEN bytes of the host name into NAME. 1220 Null terminate it if the name is shorter than LEN. 1221 If the host name is longer than LEN, set errno = EINVAL and return -1. 1222 Return 0 if successful, otherwise set errno and return -1. */ 1223 # if @UNISTD_H_HAVE_WINSOCK2_H@ 1224 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1225 # undef gethostname 1226 # define gethostname rpl_gethostname 1227 # endif 1228 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) 1229 _GL_ARG_NONNULL ((1))); 1230 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); 1231 # else 1232 # if !@HAVE_GETHOSTNAME@ 1233 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) 1234 _GL_ARG_NONNULL ((1))); 1235 # endif 1236 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second 1237 parameter is 1238 int len. */ 1239 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); 1240 # endif 1241 _GL_CXXALIASWARN (gethostname); 1242 #elif @UNISTD_H_HAVE_WINSOCK2_H@ 1243 # undef gethostname 1244 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname 1245 #elif defined GNULIB_POSIXCHECK 1246 # undef gethostname 1247 # if HAVE_RAW_DECL_GETHOSTNAME 1248 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " 1249 "use gnulib module gethostname for portability"); 1250 # endif 1251 #endif 1252 1253 1254 #if @GNULIB_GETLOGIN@ 1255 /* Returns the user's login name, or NULL if it cannot be found. Upon error, 1256 returns NULL with errno set. 1257 1258 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>. 1259 1260 Most programs don't need to use this function, because the information is 1261 available through environment variables: 1262 ${LOGNAME-$USER} on Unix platforms, 1263 $USERNAME on native Windows platforms. 1264 */ 1265 # if !@HAVE_DECL_GETLOGIN@ 1266 _GL_FUNCDECL_SYS (getlogin, char *, (void)); 1267 # endif 1268 _GL_CXXALIAS_SYS (getlogin, char *, (void)); 1269 _GL_CXXALIASWARN (getlogin); 1270 #elif defined GNULIB_POSIXCHECK 1271 # undef getlogin 1272 # if HAVE_RAW_DECL_GETLOGIN 1273 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " 1274 "use gnulib module getlogin for portability"); 1275 # endif 1276 #endif 1277 1278 1279 #if @GNULIB_GETLOGIN_R@ 1280 /* Copies the user's login name to NAME. 1281 The array pointed to by NAME has room for SIZE bytes. 1282 1283 Returns 0 if successful. Upon error, an error number is returned, or -1 in 1284 the case that the login name cannot be found but no specific error is 1285 provided (this case is hopefully rare but is left open by the POSIX spec). 1286 1287 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>. 1288 1289 Most programs don't need to use this function, because the information is 1290 available through environment variables: 1291 ${LOGNAME-$USER} on Unix platforms, 1292 $USERNAME on native Windows platforms. 1293 */ 1294 # if @REPLACE_GETLOGIN_R@ 1295 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1296 # define getlogin_r rpl_getlogin_r 1297 # endif 1298 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) 1299 _GL_ARG_NONNULL ((1))); 1300 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); 1301 # else 1302 # if !@HAVE_DECL_GETLOGIN_R@ 1303 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) 1304 _GL_ARG_NONNULL ((1))); 1305 # endif 1306 /* Need to cast, because on Solaris 10 systems, the second argument is 1307 int size. */ 1308 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); 1309 # endif 1310 _GL_CXXALIASWARN (getlogin_r); 1311 #elif defined GNULIB_POSIXCHECK 1312 # undef getlogin_r 1313 # if HAVE_RAW_DECL_GETLOGIN_R 1314 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " 1315 "use gnulib module getlogin_r for portability"); 1316 # endif 1317 #endif 1318 1319 1320 #if @GNULIB_GETPAGESIZE@ 1321 # if @REPLACE_GETPAGESIZE@ 1322 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1323 # define getpagesize rpl_getpagesize 1324 # endif 1325 _GL_FUNCDECL_RPL (getpagesize, int, (void)); 1326 _GL_CXXALIAS_RPL (getpagesize, int, (void)); 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 1333 # if !@HAVE_GETPAGESIZE@ 1334 # if !defined getpagesize 1335 /* This is for POSIX systems. */ 1336 # if !defined _gl_getpagesize && defined _SC_PAGESIZE 1337 # if ! (defined __VMS && __VMS_VER < 70000000) 1338 # define _gl_getpagesize() sysconf (_SC_PAGESIZE) 1339 # endif 1340 # endif 1341 /* This is for older VMS. */ 1342 # if !defined _gl_getpagesize && defined __VMS 1343 # ifdef __ALPHA 1344 # define _gl_getpagesize() 8192 1345 # else 1346 # define _gl_getpagesize() 512 1347 # endif 1348 # endif 1349 /* This is for BeOS. */ 1350 # if !defined _gl_getpagesize && @HAVE_OS_H@ 1351 # include <OS.h> 1352 # if defined B_PAGE_SIZE 1353 # define _gl_getpagesize() B_PAGE_SIZE 1354 # endif 1355 # endif 1356 /* This is for AmigaOS4.0. */ 1357 # if !defined _gl_getpagesize && defined __amigaos4__ 1358 # define _gl_getpagesize() 2048 1359 # endif 1360 /* This is for older Unix systems. */ 1361 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@ 1362 # include <sys/param.h> 1363 # ifdef EXEC_PAGESIZE 1364 # define _gl_getpagesize() EXEC_PAGESIZE 1365 # else 1366 # ifdef NBPG 1367 # ifndef CLSIZE 1368 # define CLSIZE 1 1369 # endif 1370 # define _gl_getpagesize() (NBPG * CLSIZE) 1371 # else 1372 # ifdef NBPC 1373 # define _gl_getpagesize() NBPC 1374 # endif 1375 # endif 1376 # endif 1377 # endif 1378 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1379 # define getpagesize() _gl_getpagesize () 1380 # else 1381 # if !GNULIB_defined_getpagesize_function 1382 _GL_UNISTD_INLINE int 1383 getpagesize () 1384 { 1385 return _gl_getpagesize (); 1386 } 1387 # define GNULIB_defined_getpagesize_function 1 1388 # endif 1389 # endif 1390 # endif 1391 # endif 1392 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ 1393 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); 1394 # endif 1395 # if @HAVE_DECL_GETPAGESIZE@ 1396 _GL_CXXALIASWARN (getpagesize); 1397 # endif 1398 #elif defined GNULIB_POSIXCHECK 1399 # undef getpagesize 1400 # if HAVE_RAW_DECL_GETPAGESIZE 1401 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " 1402 "use gnulib module getpagesize for portability"); 1403 # endif 1404 #endif 1405 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 1454 #if @GNULIB_GETUSERSHELL@ 1455 /* Return the next valid login shell on the system, or NULL when the end of 1456 the list has been reached. */ 1457 # if !@HAVE_DECL_GETUSERSHELL@ 1458 _GL_FUNCDECL_SYS (getusershell, char *, (void)); 1459 # endif 1460 _GL_CXXALIAS_SYS (getusershell, char *, (void)); 1461 _GL_CXXALIASWARN (getusershell); 1462 #elif defined GNULIB_POSIXCHECK 1463 # undef getusershell 1464 # if HAVE_RAW_DECL_GETUSERSHELL 1465 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - " 1466 "use gnulib module getusershell for portability"); 1467 # endif 1468 #endif 1469 1470 #if @GNULIB_GETUSERSHELL@ 1471 /* Rewind to pointer that is advanced at each getusershell() call. */ 1472 # if !@HAVE_DECL_GETUSERSHELL@ 1473 _GL_FUNCDECL_SYS (setusershell, void, (void)); 1474 # endif 1475 _GL_CXXALIAS_SYS (setusershell, void, (void)); 1476 _GL_CXXALIASWARN (setusershell); 1477 #elif defined GNULIB_POSIXCHECK 1478 # undef setusershell 1479 # if HAVE_RAW_DECL_SETUSERSHELL 1480 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - " 1481 "use gnulib module getusershell for portability"); 1482 # endif 1483 #endif 1484 1485 #if @GNULIB_GETUSERSHELL@ 1486 /* Free the pointer that is advanced at each getusershell() call and 1487 associated resources. */ 1488 # if !@HAVE_DECL_GETUSERSHELL@ 1489 _GL_FUNCDECL_SYS (endusershell, void, (void)); 1490 # endif 1491 _GL_CXXALIAS_SYS (endusershell, void, (void)); 1492 _GL_CXXALIASWARN (endusershell); 1493 #elif defined GNULIB_POSIXCHECK 1494 # undef endusershell 1495 # if HAVE_RAW_DECL_ENDUSERSHELL 1496 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " 1497 "use gnulib module getusershell for portability"); 1498 # endif 1499 #endif 1500 1501 1502 #if @GNULIB_GROUP_MEMBER@ 1503 /* Determine whether group id is in calling user's group list. */ 1504 # if !@HAVE_GROUP_MEMBER@ 1505 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); 1506 # endif 1507 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); 1508 _GL_CXXALIASWARN (group_member); 1509 #elif defined GNULIB_POSIXCHECK 1510 # undef group_member 1511 # if HAVE_RAW_DECL_GROUP_MEMBER 1512 _GL_WARN_ON_USE (group_member, "group_member is unportable - " 1513 "use gnulib module group-member for portability"); 1514 # endif 1515 #endif 1516 1517 1518 #if @GNULIB_ISATTY@ 1519 # if @REPLACE_ISATTY@ 1520 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1521 # undef isatty 1522 # define isatty rpl_isatty 1523 # endif 1524 # define GNULIB_defined_isatty 1 1525 _GL_FUNCDECL_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)); 1533 # else 1534 _GL_CXXALIAS_SYS (isatty, int, (int fd)); 1535 # endif 1536 _GL_CXXALIASWARN (isatty); 1537 #elif defined GNULIB_POSIXCHECK 1538 # undef isatty 1539 # if HAVE_RAW_DECL_ISATTY 1540 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " 1541 "use gnulib module isatty for portability"); 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); 1557 #endif 1558 1559 1560 #if @GNULIB_LCHOWN@ 1561 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 1562 to GID (if GID is not -1). Do not follow symbolic links. 1563 Return 0 if successful, otherwise -1 and errno set. 1564 See the POSIX:2008 specification 1565 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */ 1566 # if @REPLACE_LCHOWN@ 1567 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1568 # undef lchown 1569 # define lchown rpl_lchown 1570 # endif 1571 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) 1572 _GL_ARG_NONNULL ((1))); 1573 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); 1574 # else 1575 # if !@HAVE_LCHOWN@ 1576 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) 1577 _GL_ARG_NONNULL ((1))); 1578 # endif 1579 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); 1580 # endif 1581 _GL_CXXALIASWARN (lchown); 1582 #elif defined GNULIB_POSIXCHECK 1583 # undef lchown 1584 # if HAVE_RAW_DECL_LCHOWN 1585 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " 1586 "use gnulib module lchown for portability"); 1587 # endif 1588 #endif 1589 1590 1591 #if @GNULIB_LINK@ 1592 /* Create a new hard link for an existing file. 1593 Return 0 if successful, otherwise -1 and errno set. 1594 See POSIX:2008 specification 1595 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */ 1596 # if @REPLACE_LINK@ 1597 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1598 # define link rpl_link 1599 # endif 1600 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) 1601 _GL_ARG_NONNULL ((1, 2))); 1602 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); 1603 # else 1604 # if !@HAVE_LINK@ 1605 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) 1606 _GL_ARG_NONNULL ((1, 2))); 1607 # endif 1608 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); 1609 # endif 1610 _GL_CXXALIASWARN (link); 1611 #elif defined GNULIB_POSIXCHECK 1612 # undef link 1613 # if HAVE_RAW_DECL_LINK 1614 _GL_WARN_ON_USE (link, "link is unportable - " 1615 "use gnulib module link for portability"); 1616 # endif 1617 #endif 1618 1619 1620 #if @GNULIB_LINKAT@ 1621 /* Create a new hard link for an existing file, relative to two 1622 directories. FLAG controls whether symlinks are followed. 1623 Return 0 if successful, otherwise -1 and errno set. */ 1624 # if @REPLACE_LINKAT@ 1625 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1626 # undef linkat 1627 # define linkat rpl_linkat 1628 # endif 1629 _GL_FUNCDECL_RPL (linkat, int, 1630 (int fd1, const char *path1, int fd2, const char *path2, 1631 int flag) 1632 _GL_ARG_NONNULL ((2, 4))); 1633 _GL_CXXALIAS_RPL (linkat, int, 1634 (int fd1, const char *path1, int fd2, const char *path2, 1635 int flag)); 1636 # else 1637 # if !@HAVE_LINKAT@ 1638 _GL_FUNCDECL_SYS (linkat, int, 1639 (int fd1, const char *path1, int fd2, const char *path2, 1640 int flag) 1641 _GL_ARG_NONNULL ((2, 4))); 1642 # endif 1643 _GL_CXXALIAS_SYS (linkat, int, 1644 (int fd1, const char *path1, int fd2, const char *path2, 1645 int flag)); 1646 # endif 1647 _GL_CXXALIASWARN (linkat); 1648 #elif defined GNULIB_POSIXCHECK 1649 # undef linkat 1650 # if HAVE_RAW_DECL_LINKAT 1651 _GL_WARN_ON_USE (linkat, "linkat is unportable - " 1652 "use gnulib module linkat for portability"); 1653 # endif 1654 #endif 1655 1656 1657 #if @GNULIB_LSEEK@ 1658 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. 1659 Return the new offset if successful, otherwise -1 and errno set. 1660 See the POSIX:2008 specification 1661 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */ 1662 # if @REPLACE_LSEEK@ 1663 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1664 # define lseek rpl_lseek 1665 # endif 1666 _GL_FUNCDECL_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)); 1674 # else 1675 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); 1676 # endif 1677 _GL_CXXALIASWARN (lseek); 1678 #elif defined GNULIB_POSIXCHECK 1679 # undef lseek 1680 # if HAVE_RAW_DECL_LSEEK 1681 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " 1682 "systems - use gnulib module lseek for portability"); 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); 1698 #endif 1699 1700 1701 #if @GNULIB_PIPE@ 1702 /* Create a pipe, defaulting to O_BINARY mode. 1703 Store the read-end as fd[0] and the write-end as fd[1]. 1704 Return 0 upon success, or -1 with errno set upon failure. */ 1705 # if !@HAVE_PIPE@ 1706 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); 1707 # endif 1708 _GL_CXXALIAS_SYS (pipe, int, (int fd[2])); 1709 _GL_CXXALIASWARN (pipe); 1710 #elif defined GNULIB_POSIXCHECK 1711 # undef pipe 1712 # if HAVE_RAW_DECL_PIPE 1713 _GL_WARN_ON_USE (pipe, "pipe is unportable - " 1714 "use gnulib module pipe-posix for portability"); 1715 # endif 1716 #endif 1717 1718 1719 #if @GNULIB_PIPE2@ 1720 /* Create a pipe, applying the given flags when opening the read-end of the 1721 pipe and the write-end of the pipe. 1722 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 1723 and O_TEXT, O_BINARY (defined in "binary-io.h"). 1724 Store the read-end as fd[0] and the write-end as fd[1]. 1725 Return 0 upon success, or -1 with errno set upon failure. 1726 See also the Linux man page at 1727 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ 1728 # if @HAVE_PIPE2@ 1729 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1730 # define pipe2 rpl_pipe2 1731 # endif 1732 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1733 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); 1734 # else 1735 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1736 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); 1737 # endif 1738 _GL_CXXALIASWARN (pipe2); 1739 #elif defined GNULIB_POSIXCHECK 1740 # undef pipe2 1741 # if HAVE_RAW_DECL_PIPE2 1742 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " 1743 "use gnulib module pipe2 for portability"); 1744 # endif 1745 #endif 1746 1747 1748 #if @GNULIB_PREAD@ 1749 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. 1750 Return the number of bytes placed into BUF if successful, otherwise 1751 set errno and return -1. 0 indicates EOF. 1752 See the POSIX:2008 specification 1753 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */ 1754 # if @REPLACE_PREAD@ 1755 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1756 # undef pread 1757 # define pread rpl_pread 1758 # endif 1759 _GL_FUNCDECL_RPL (pread, ssize_t, 1760 (int fd, void *buf, size_t bufsize, off_t offset) 1761 _GL_ARG_NONNULL ((2))); 1762 _GL_CXXALIAS_RPL (pread, ssize_t, 1763 (int fd, void *buf, size_t bufsize, off_t offset)); 1764 # else 1765 # if !@HAVE_PREAD@ 1766 _GL_FUNCDECL_SYS (pread, ssize_t, 1767 (int fd, void *buf, size_t bufsize, off_t offset) 1768 _GL_ARG_NONNULL ((2))); 1769 # endif 1770 _GL_CXXALIAS_SYS (pread, ssize_t, 1771 (int fd, void *buf, size_t bufsize, off_t offset)); 1772 # endif 1773 _GL_CXXALIASWARN (pread); 1774 #elif defined GNULIB_POSIXCHECK 1775 # undef pread 1776 # if HAVE_RAW_DECL_PREAD 1777 _GL_WARN_ON_USE (pread, "pread is unportable - " 1778 "use gnulib module pread for portability"); 1779 # endif 1780 #endif 1781 1782 1783 #if @GNULIB_PWRITE@ 1784 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. 1785 Return the number of bytes written if successful, otherwise 1786 set errno and return -1. 0 indicates nothing written. See the 1787 POSIX:2008 specification 1788 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */ 1789 # if @REPLACE_PWRITE@ 1790 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1791 # undef pwrite 1792 # define pwrite rpl_pwrite 1793 # endif 1794 _GL_FUNCDECL_RPL (pwrite, ssize_t, 1795 (int fd, const void *buf, size_t bufsize, off_t offset) 1796 _GL_ARG_NONNULL ((2))); 1797 _GL_CXXALIAS_RPL (pwrite, ssize_t, 1798 (int fd, const void *buf, size_t bufsize, off_t offset)); 1799 # else 1800 # if !@HAVE_PWRITE@ 1801 _GL_FUNCDECL_SYS (pwrite, ssize_t, 1802 (int fd, const void *buf, size_t bufsize, off_t offset) 1803 _GL_ARG_NONNULL ((2))); 1804 # endif 1805 _GL_CXXALIAS_SYS (pwrite, ssize_t, 1806 (int fd, const void *buf, size_t bufsize, off_t offset)); 1807 # endif 1808 _GL_CXXALIASWARN (pwrite); 1809 #elif defined GNULIB_POSIXCHECK 1810 # undef pwrite 1811 # if HAVE_RAW_DECL_PWRITE 1812 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " 1813 "use gnulib module pwrite for portability"); 1814 # endif 1815 #endif 1816 1817 1818 #if @GNULIB_READ@ 1819 /* Read up to COUNT bytes from file descriptor FD into the buffer starting 1820 at BUF. See the POSIX:2008 specification 1821 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */ 1822 # if @REPLACE_READ@ 1823 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1824 # undef read 1825 # define read rpl_read 1826 # endif 1827 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 1828 _GL_ARG_NONNULL ((2))); 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 1854 # else 1855 _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); 1856 # endif 1857 _GL_CXXALIASWARN (read); 1858 #endif 1859 1860 1861 #if @GNULIB_READLINK@ 1862 /* Read the contents of the symbolic link FILE and place the first BUFSIZE 1863 bytes of it into BUF. Return the number of bytes placed into BUF if 1864 successful, otherwise -1 and errno set. 1865 See the POSIX:2008 specification 1866 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ 1867 # if @REPLACE_READLINK@ 1868 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1869 # define readlink rpl_readlink 1870 # endif 1871 _GL_FUNCDECL_RPL (readlink, ssize_t, 1872 (const char *restrict file, 1873 char *restrict buf, size_t bufsize) 1874 _GL_ARG_NONNULL ((1, 2))); 1875 _GL_CXXALIAS_RPL (readlink, ssize_t, 1876 (const char *restrict file, 1877 char *restrict buf, size_t bufsize)); 1878 # else 1879 # if !@HAVE_READLINK@ 1880 _GL_FUNCDECL_SYS (readlink, ssize_t, 1881 (const char *restrict file, 1882 char *restrict buf, size_t bufsize) 1883 _GL_ARG_NONNULL ((1, 2))); 1884 # endif 1885 _GL_CXXALIAS_SYS (readlink, ssize_t, 1886 (const char *restrict file, 1887 char *restrict buf, size_t bufsize)); 1888 # endif 1889 _GL_CXXALIASWARN (readlink); 1890 #elif defined GNULIB_POSIXCHECK 1891 # undef readlink 1892 # if HAVE_RAW_DECL_READLINK 1893 _GL_WARN_ON_USE (readlink, "readlink is unportable - " 1894 "use gnulib module readlink for portability"); 1895 # endif 1896 #endif 1897 1898 1899 #if @GNULIB_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@ 1913 _GL_FUNCDECL_SYS (readlinkat, ssize_t, 1914 (int fd, char const *restrict file, 1915 char *restrict buf, size_t len) 1916 _GL_ARG_NONNULL ((2, 3))); 1917 # endif 1918 _GL_CXXALIAS_SYS (readlinkat, ssize_t, 1919 (int fd, char const *restrict file, 1920 char *restrict buf, size_t len)); 1921 # endif 1922 _GL_CXXALIASWARN (readlinkat); 1923 #elif defined GNULIB_POSIXCHECK 1924 # undef readlinkat 1925 # if HAVE_RAW_DECL_READLINKAT 1926 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " 1927 "use gnulib module readlinkat for portability"); 1928 # endif 1929 #endif 1930 1931 1932 #if @GNULIB_RMDIR@ 1933 /* Remove the directory DIR. */ 1934 # if @REPLACE_RMDIR@ 1935 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1936 # define rmdir rpl_rmdir 1937 # endif 1938 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); 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)); 1946 # else 1947 _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); 1948 # endif 1949 _GL_CXXALIASWARN (rmdir); 1950 #elif defined GNULIB_POSIXCHECK 1951 # undef rmdir 1952 # if HAVE_RAW_DECL_RMDIR 1953 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " 1954 "use gnulib module rmdir for portability"); 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); 1970 #endif 1971 1972 1973 #if @GNULIB_SETHOSTNAME@ 1974 /* Set the host name of the machine. 1975 The host name may or may not be fully qualified. 1976 1977 Put LEN bytes of NAME into the host name. 1978 Return 0 if successful, otherwise, set errno and return -1. 1979 1980 Platforms with no ability to set the hostname return -1 and set 1981 errno = ENOSYS. */ 1982 # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ 1983 _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) 1984 _GL_ARG_NONNULL ((1))); 1985 # endif 1986 /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 1987 and FreeBSD 6.4 the second parameter is int. On Solaris 11 1988 2011-10, the first parameter is not const. */ 1989 _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); 1990 _GL_CXXALIASWARN (sethostname); 1991 #elif defined GNULIB_POSIXCHECK 1992 # undef sethostname 1993 # if HAVE_RAW_DECL_SETHOSTNAME 1994 _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " 1995 "use gnulib module sethostname for portability"); 1996 # endif 1997 #endif 1998 1999 2000 #if @GNULIB_SLEEP@ 2001 /* Pause the execution of the current thread for N seconds. 2002 Returns the number of seconds left to sleep. 2003 See the POSIX:2008 specification 2004 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */ 2005 # if @REPLACE_SLEEP@ 2006 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2007 # undef sleep 2008 # define sleep rpl_sleep 2009 # endif 2010 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); 2011 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); 2012 # else 2013 # if !@HAVE_SLEEP@ 2014 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); 2015 # endif 2016 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); 2017 # endif 2018 _GL_CXXALIASWARN (sleep); 2019 #elif defined GNULIB_POSIXCHECK 2020 # undef sleep 2021 # if HAVE_RAW_DECL_SLEEP 2022 _GL_WARN_ON_USE (sleep, "sleep is unportable - " 2023 "use gnulib module sleep for portability"); 2024 # endif 2025 #endif 2026 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 2053 #if @GNULIB_SYMLINK@ 2054 # if @REPLACE_SYMLINK@ 2055 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2056 # undef symlink 2057 # define symlink rpl_symlink 2058 # endif 2059 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) 2060 _GL_ARG_NONNULL ((1, 2))); 2061 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); 2062 # else 2063 # if !@HAVE_SYMLINK@ 2064 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) 2065 _GL_ARG_NONNULL ((1, 2))); 2066 # endif 2067 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); 2068 # endif 2069 _GL_CXXALIASWARN (symlink); 2070 #elif defined GNULIB_POSIXCHECK 2071 # undef symlink 2072 # if HAVE_RAW_DECL_SYMLINK 2073 _GL_WARN_ON_USE (symlink, "symlink is not portable - " 2074 "use gnulib module symlink for portability"); 2075 # endif 2076 #endif 2077 2078 2079 #if @GNULIB_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@ 2092 _GL_FUNCDECL_SYS (symlinkat, int, 2093 (char const *contents, int fd, char const *file) 2094 _GL_ARG_NONNULL ((1, 3))); 2095 # endif 2096 _GL_CXXALIAS_SYS (symlinkat, int, 2097 (char const *contents, int fd, char const *file)); 2098 # endif 2099 _GL_CXXALIASWARN (symlinkat); 2100 #elif defined GNULIB_POSIXCHECK 2101 # undef symlinkat 2102 # if HAVE_RAW_DECL_SYMLINKAT 2103 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " 2104 "use gnulib module symlinkat for portability"); 2105 # endif 2106 #endif 2107 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 2139 #if @GNULIB_TTYNAME_R@ 2140 /* Store at most BUFLEN characters of the pathname of the terminal FD is 2141 open on in BUF. Return 0 on success, otherwise an error number. */ 2142 # if @REPLACE_TTYNAME_R@ 2143 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2144 # undef ttyname_r 2145 # define ttyname_r rpl_ttyname_r 2146 # endif 2147 _GL_FUNCDECL_RPL (ttyname_r, int, 2148 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2149 _GL_CXXALIAS_RPL (ttyname_r, int, 2150 (int fd, char *buf, size_t buflen)); 2151 # else 2152 # if !@HAVE_DECL_TTYNAME_R@ 2153 _GL_FUNCDECL_SYS (ttyname_r, int, 2154 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2155 # endif 2156 _GL_CXXALIAS_SYS (ttyname_r, int, 2157 (int fd, char *buf, size_t buflen)); 2158 # endif 2159 _GL_CXXALIASWARN (ttyname_r); 2160 #elif defined GNULIB_POSIXCHECK 2161 # undef ttyname_r 2162 # if HAVE_RAW_DECL_TTYNAME_R 2163 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " 2164 "use gnulib module ttyname_r for portability"); 2165 # endif 2166 #endif 2167 2168 2169 #if @GNULIB_UNLINK@ 2170 # if @REPLACE_UNLINK@ 2171 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2172 # undef unlink 2173 # define unlink rpl_unlink 2174 # endif 2175 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); 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)); 2183 # else 2184 _GL_CXXALIAS_SYS (unlink, int, (char const *file)); 2185 # endif 2186 _GL_CXXALIASWARN (unlink); 2187 #elif defined GNULIB_POSIXCHECK 2188 # undef unlink 2189 # if HAVE_RAW_DECL_UNLINK 2190 _GL_WARN_ON_USE (unlink, "unlink is not portable - " 2191 "use gnulib module unlink for portability"); 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); 2207 #endif 2208 2209 2210 #if @GNULIB_UNLINKAT@ 2211 # if @REPLACE_UNLINKAT@ 2212 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2213 # undef unlinkat 2214 # define unlinkat rpl_unlinkat 2215 # endif 2216 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) 2217 _GL_ARG_NONNULL ((2))); 2218 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); 2219 # else 2220 # if !@HAVE_UNLINKAT@ 2221 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) 2222 _GL_ARG_NONNULL ((2))); 2223 # endif 2224 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); 2225 # endif 2226 _GL_CXXALIASWARN (unlinkat); 2227 #elif defined GNULIB_POSIXCHECK 2228 # undef unlinkat 2229 # if HAVE_RAW_DECL_UNLINKAT 2230 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " 2231 "use gnulib module unlinkat for portability"); 2232 # endif 2233 #endif 2234 2235 2236 #if @GNULIB_USLEEP@ 2237 /* Pause the execution of the current thread for N microseconds. 2238 Returns 0 on completion, or -1 on range error. 2239 See the POSIX:2001 specification 2240 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ 2241 # if @REPLACE_USLEEP@ 2242 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2243 # undef usleep 2244 # define usleep rpl_usleep 2245 # endif 2246 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); 2247 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); 2248 # else 2249 # if !@HAVE_USLEEP@ 2250 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); 2251 # endif 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)); 2255 # endif 2256 _GL_CXXALIASWARN (usleep); 2257 #elif defined GNULIB_POSIXCHECK 2258 # undef usleep 2259 # if HAVE_RAW_DECL_USLEEP 2260 _GL_WARN_ON_USE (usleep, "usleep is unportable - " 2261 "use gnulib module usleep for portability"); 2262 # endif 2263 #endif 2264 2265 2266 #if @GNULIB_WRITE@ 2267 /* Write up to COUNT bytes starting at BUF to file descriptor FD. 2268 See the POSIX:2008 specification 2269 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */ 2270 # if @REPLACE_WRITE@ 2271 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2272 # undef write 2273 # define write rpl_write 2274 # endif 2275 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 2276 _GL_ARG_NONNULL ((2))); 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 2302 # else 2303 _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2304 # endif 2305 _GL_CXXALIASWARN (write); 2306 #endif 2307 2308 _GL_INLINE_HEADER_END 2309 2310 #endif /* _@GUARD_PREFIX@_UNISTD_H */ 2311 #endif /* _GL_INCLUDING_UNISTD_H */ 2312 #endif /* _@GUARD_PREFIX@_UNISTD_H */ 2313