1 /* Substitute for and wrapper around <unistd.h>. 2 Copyright (C) 2003-2020 Free Software Foundation, Inc. 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 3, or (at your option) 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, see <https://www.gnu.org/licenses/>. */ 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 ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \ 101 || defined GNULIB_POSIXCHECK) \ 102 && (defined _WIN32 && ! defined __CYGWIN__)) 103 # include <io.h> /* mingw32, mingw64 */ 104 # include <direct.h> /* mingw64, MSVC 9 */ 105 #elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \ 106 || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \ 107 || defined GNULIB_POSIXCHECK) \ 108 && (defined _WIN32 && ! defined __CYGWIN__) 109 # include <io.h> 110 #endif 111 112 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. 113 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */ 114 /* But avoid namespace pollution on glibc systems. */ 115 #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \ 116 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \ 117 && !defined __GLIBC__ 118 # include <netdb.h> 119 #endif 120 121 /* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in 122 <sys/random.h>, not in <unistd.h>. */ 123 /* But avoid namespace pollution on glibc systems. */ 124 #if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \ 125 && ((defined __APPLE__ && defined __MACH__) || defined __sun \ 126 || defined __ANDROID__) \ 127 && @UNISTD_H_HAVE_SYS_RANDOM_H@ \ 128 && !defined __GLIBC__ 129 # include <sys/random.h> 130 #endif 131 132 /* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */ 133 /* But avoid namespace pollution on glibc systems. */ 134 #if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ 135 && !defined __GLIBC__ 136 # include <sys/stat.h> 137 #endif 138 139 /* MSVC defines off_t in <sys/types.h>. 140 May also define off_t to a 64-bit type on native Windows. */ 141 /* But avoid namespace pollution on glibc systems. */ 142 #ifndef __GLIBC__ 143 /* Get off_t, ssize_t. */ 144 # include <sys/types.h> 145 #endif 146 147 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 148 149 /* The definition of _GL_ARG_NONNULL is copied here. */ 150 151 /* The definition of _GL_WARN_ON_USE is copied here. */ 152 153 154 /* Get getopt(), optarg, optind, opterr, optopt. */ 155 /* Also, don't include <getopt.h> inside libgettextpo, because we use 156 the getopt module only in gettext-tools/gnulib-lib/, not in 157 gettext-tools/libgettextpo/, but there is only a single 158 GNULIB_UNISTD_H_GETOPT variable for both. */ 159 #if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined GTPO_CONFIG_H && !defined _GL_SYSTEM_GETOPT 160 # include <getopt-cdefs.h> 161 # include <getopt-pfx-core.h> 162 #endif 163 164 #ifndef _GL_INLINE_HEADER_BEGIN 165 #error "Please include config.h first." 166 #endif 167 _GL_INLINE_HEADER_BEGIN 168 #ifndef _GL_UNISTD_INLINE 169 # define _GL_UNISTD_INLINE _GL_INLINE 170 #endif 171 172 /* Hide some function declarations from <winsock2.h>. */ 173 174 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ 175 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H 176 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 177 # undef socket 178 # define socket socket_used_without_including_sys_socket_h 179 # undef connect 180 # define connect connect_used_without_including_sys_socket_h 181 # undef accept 182 # define accept accept_used_without_including_sys_socket_h 183 # undef bind 184 # define bind bind_used_without_including_sys_socket_h 185 # undef getpeername 186 # define getpeername getpeername_used_without_including_sys_socket_h 187 # undef getsockname 188 # define getsockname getsockname_used_without_including_sys_socket_h 189 # undef getsockopt 190 # define getsockopt getsockopt_used_without_including_sys_socket_h 191 # undef listen 192 # define listen listen_used_without_including_sys_socket_h 193 # undef recv 194 # define recv recv_used_without_including_sys_socket_h 195 # undef send 196 # define send send_used_without_including_sys_socket_h 197 # undef recvfrom 198 # define recvfrom recvfrom_used_without_including_sys_socket_h 199 # undef sendto 200 # define sendto sendto_used_without_including_sys_socket_h 201 # undef setsockopt 202 # define setsockopt setsockopt_used_without_including_sys_socket_h 203 # undef shutdown 204 # define shutdown shutdown_used_without_including_sys_socket_h 205 # else 206 _GL_WARN_ON_USE (socket, 207 "socket() used without including <sys/socket.h>"); 208 _GL_WARN_ON_USE (connect, 209 "connect() used without including <sys/socket.h>"); 210 _GL_WARN_ON_USE (accept, 211 "accept() used without including <sys/socket.h>"); 212 _GL_WARN_ON_USE (bind, 213 "bind() used without including <sys/socket.h>"); 214 _GL_WARN_ON_USE (getpeername, 215 "getpeername() used without including <sys/socket.h>"); 216 _GL_WARN_ON_USE (getsockname, 217 "getsockname() used without including <sys/socket.h>"); 218 _GL_WARN_ON_USE (getsockopt, 219 "getsockopt() used without including <sys/socket.h>"); 220 _GL_WARN_ON_USE (listen, 221 "listen() used without including <sys/socket.h>"); 222 _GL_WARN_ON_USE (recv, 223 "recv() used without including <sys/socket.h>"); 224 _GL_WARN_ON_USE (send, 225 "send() used without including <sys/socket.h>"); 226 _GL_WARN_ON_USE (recvfrom, 227 "recvfrom() used without including <sys/socket.h>"); 228 _GL_WARN_ON_USE (sendto, 229 "sendto() used without including <sys/socket.h>"); 230 _GL_WARN_ON_USE (setsockopt, 231 "setsockopt() used without including <sys/socket.h>"); 232 _GL_WARN_ON_USE (shutdown, 233 "shutdown() used without including <sys/socket.h>"); 234 # endif 235 # endif 236 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H 237 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 238 # undef select 239 # define select select_used_without_including_sys_select_h 240 # else 241 _GL_WARN_ON_USE (select, 242 "select() used without including <sys/select.h>"); 243 # endif 244 # endif 245 #endif 246 247 248 /* OS/2 EMX lacks these macros. */ 249 #ifndef STDIN_FILENO 250 # define STDIN_FILENO 0 251 #endif 252 #ifndef STDOUT_FILENO 253 # define STDOUT_FILENO 1 254 #endif 255 #ifndef STDERR_FILENO 256 # define STDERR_FILENO 2 257 #endif 258 259 /* Ensure *_OK macros exist. */ 260 #ifndef F_OK 261 # define F_OK 0 262 # define X_OK 1 263 # define W_OK 2 264 # define R_OK 4 265 #endif 266 267 268 /* Declare overridden functions. */ 269 270 271 #if @GNULIB_ACCESS@ 272 # if @REPLACE_ACCESS@ 273 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 274 # undef access 275 # define access rpl_access 276 # endif 277 _GL_FUNCDECL_RPL (access, int, (const char *file, int mode) 278 _GL_ARG_NONNULL ((1))); 279 _GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); 280 # else 281 _GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); 282 # endif 283 _GL_CXXALIASWARN (access); 284 #elif defined GNULIB_POSIXCHECK 285 # undef access 286 # if HAVE_RAW_DECL_ACCESS 287 /* The access() function is a security risk. */ 288 _GL_WARN_ON_USE (access, "access does not always support X_OK - " 289 "use gnulib module access for portability; " 290 "also, this function is a security risk - " 291 "use the gnulib module faccessat instead"); 292 # endif 293 #endif 294 295 296 #if @GNULIB_CHDIR@ 297 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); 298 _GL_CXXALIASWARN (chdir); 299 #elif defined GNULIB_POSIXCHECK 300 # undef chdir 301 # if HAVE_RAW_DECL_CHDIR 302 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " 303 "use gnulib module chdir for portability"); 304 # endif 305 #endif 306 307 308 #if @GNULIB_CHOWN@ 309 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 310 to GID (if GID is not -1). Follow symbolic links. 311 Return 0 if successful, otherwise -1 and errno set. 312 See the POSIX:2008 specification 313 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */ 314 # if @REPLACE_CHOWN@ 315 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 316 # undef chown 317 # define chown rpl_chown 318 # endif 319 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) 320 _GL_ARG_NONNULL ((1))); 321 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); 322 # else 323 # if !@HAVE_CHOWN@ 324 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) 325 _GL_ARG_NONNULL ((1))); 326 # endif 327 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); 328 # endif 329 _GL_CXXALIASWARN (chown); 330 #elif defined GNULIB_POSIXCHECK 331 # undef chown 332 # if HAVE_RAW_DECL_CHOWN 333 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " 334 "doesn't treat a uid or gid of -1 on some systems - " 335 "use gnulib module chown for portability"); 336 # endif 337 #endif 338 339 340 #if @GNULIB_CLOSE@ 341 # if @REPLACE_CLOSE@ 342 /* Automatically included by modules that need a replacement for close. */ 343 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 344 # undef close 345 # define close rpl_close 346 # endif 347 _GL_FUNCDECL_RPL (close, int, (int fd)); 348 _GL_CXXALIAS_RPL (close, int, (int fd)); 349 # else 350 _GL_CXXALIAS_SYS (close, int, (int fd)); 351 # endif 352 _GL_CXXALIASWARN (close); 353 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ 354 # undef close 355 # define close close_used_without_requesting_gnulib_module_close 356 #elif defined GNULIB_POSIXCHECK 357 # undef close 358 /* Assume close is always declared. */ 359 _GL_WARN_ON_USE (close, "close does not portably work on sockets - " 360 "use gnulib module close for portability"); 361 #endif 362 363 364 #if @GNULIB_COPY_FILE_RANGE@ 365 # if !@HAVE_COPY_FILE_RANGE@ 366 _GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 367 int ofd, off_t *opos, 368 size_t len, unsigned flags)); 369 _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 370 int ofd, off_t *opos, 371 size_t len, unsigned flags)); 372 # endif 373 _GL_CXXALIASWARN (copy_file_range); 374 #elif defined GNULIB_POSIXCHECK 375 /* Assume copy_file_range is always declared. */ 376 _GL_WARN_ON_USE (copy_file_range, 377 "copy_file_range is unportable - " 378 "use gnulib module copy_file_range for portability"); 379 #endif 380 381 382 #if @GNULIB_DUP@ 383 # if @REPLACE_DUP@ 384 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 385 # define dup rpl_dup 386 # endif 387 _GL_FUNCDECL_RPL (dup, int, (int oldfd)); 388 _GL_CXXALIAS_RPL (dup, int, (int oldfd)); 389 # else 390 _GL_CXXALIAS_SYS (dup, int, (int oldfd)); 391 # endif 392 _GL_CXXALIASWARN (dup); 393 #elif defined GNULIB_POSIXCHECK 394 # undef dup 395 # if HAVE_RAW_DECL_DUP 396 _GL_WARN_ON_USE (dup, "dup is unportable - " 397 "use gnulib module dup for portability"); 398 # endif 399 #endif 400 401 402 #if @GNULIB_DUP2@ 403 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if 404 NEWFD = OLDFD, otherwise close NEWFD first if it is open. 405 Return newfd if successful, otherwise -1 and errno set. 406 See the POSIX:2008 specification 407 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */ 408 # if @REPLACE_DUP2@ 409 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 410 # define dup2 rpl_dup2 411 # endif 412 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); 413 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); 414 # else 415 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); 416 # endif 417 _GL_CXXALIASWARN (dup2); 418 #elif defined GNULIB_POSIXCHECK 419 # undef dup2 420 # if HAVE_RAW_DECL_DUP2 421 _GL_WARN_ON_USE (dup2, "dup2 is unportable - " 422 "use gnulib module dup2 for portability"); 423 # endif 424 #endif 425 426 427 #if @GNULIB_DUP3@ 428 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the 429 specified flags. 430 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 431 and O_TEXT, O_BINARY (defined in "binary-io.h"). 432 Close NEWFD first if it is open. 433 Return newfd if successful, otherwise -1 and errno set. 434 See the Linux man page at 435 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ 436 # if @HAVE_DUP3@ 437 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 438 # define dup3 rpl_dup3 439 # endif 440 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); 441 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); 442 # else 443 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); 444 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); 445 # endif 446 _GL_CXXALIASWARN (dup3); 447 #elif defined GNULIB_POSIXCHECK 448 # undef dup3 449 # if HAVE_RAW_DECL_DUP3 450 _GL_WARN_ON_USE (dup3, "dup3 is unportable - " 451 "use gnulib module dup3 for portability"); 452 # endif 453 #endif 454 455 456 #if @GNULIB_ENVIRON@ 457 # if defined __CYGWIN__ && !defined __i386__ 458 /* The 'environ' variable is defined in a DLL. Therefore its declaration needs 459 the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it. 460 This leads to a link error on 64-bit Cygwin when the option 461 -Wl,--disable-auto-import is in use. */ 462 _GL_EXTERN_C __declspec(dllimport) char **environ; 463 # endif 464 # if !@HAVE_DECL_ENVIRON@ 465 /* Set of environment variables and values. An array of strings of the form 466 "VARIABLE=VALUE", terminated with a NULL. */ 467 # if defined __APPLE__ && defined __MACH__ 468 # include <TargetConditionals.h> 469 # if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR 470 # define _GL_USE_CRT_EXTERNS 471 # endif 472 # endif 473 # ifdef _GL_USE_CRT_EXTERNS 474 # include <crt_externs.h> 475 # define environ (*_NSGetEnviron ()) 476 # else 477 # ifdef __cplusplus 478 extern "C" { 479 # endif 480 extern char **environ; 481 # ifdef __cplusplus 482 } 483 # endif 484 # endif 485 # endif 486 #elif defined GNULIB_POSIXCHECK 487 # if HAVE_RAW_DECL_ENVIRON 488 _GL_UNISTD_INLINE char *** 489 _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - " 490 "use gnulib module environ for portability") 491 rpl_environ (void) 492 { 493 return &environ; 494 } 495 # undef environ 496 # define environ (*rpl_environ ()) 497 # endif 498 #endif 499 500 501 #if @GNULIB_EUIDACCESS@ 502 /* Like access(), except that it uses the effective user id and group id of 503 the current process. */ 504 # if !@HAVE_EUIDACCESS@ 505 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) 506 _GL_ARG_NONNULL ((1))); 507 # endif 508 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); 509 _GL_CXXALIASWARN (euidaccess); 510 # if defined GNULIB_POSIXCHECK 511 /* Like access(), this function is a security risk. */ 512 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " 513 "use the gnulib module faccessat instead"); 514 # endif 515 #elif defined GNULIB_POSIXCHECK 516 # undef euidaccess 517 # if HAVE_RAW_DECL_EUIDACCESS 518 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " 519 "use gnulib module euidaccess for portability"); 520 # endif 521 #endif 522 523 524 #if @GNULIB_FACCESSAT@ 525 # if @REPLACE_FACCESSAT@ 526 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 527 # undef faccessat 528 # define faccessat rpl_faccessat 529 # endif 530 _GL_FUNCDECL_RPL (faccessat, int, 531 (int fd, char const *name, int mode, int flag) 532 _GL_ARG_NONNULL ((2))); 533 _GL_CXXALIAS_RPL (faccessat, int, 534 (int fd, char const *name, int mode, int flag)); 535 # else 536 # if !@HAVE_FACCESSAT@ 537 _GL_FUNCDECL_SYS (faccessat, int, 538 (int fd, char const *file, int mode, int flag) 539 _GL_ARG_NONNULL ((2))); 540 # endif 541 _GL_CXXALIAS_SYS (faccessat, int, 542 (int fd, char const *file, int mode, int flag)); 543 # endif 544 _GL_CXXALIASWARN (faccessat); 545 #elif defined GNULIB_POSIXCHECK 546 # undef faccessat 547 # if HAVE_RAW_DECL_FACCESSAT 548 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " 549 "use gnulib module faccessat for portability"); 550 # endif 551 #endif 552 553 554 #if @GNULIB_FCHDIR@ 555 /* Change the process' current working directory to the directory on which 556 the given file descriptor is open. 557 Return 0 if successful, otherwise -1 and errno set. 558 See the POSIX:2008 specification 559 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ 560 # if ! @HAVE_FCHDIR@ 561 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 562 563 /* Gnulib internal hooks needed to maintain the fchdir metadata. */ 564 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) 565 _GL_ARG_NONNULL ((2)); 566 _GL_EXTERN_C void _gl_unregister_fd (int fd); 567 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); 568 _GL_EXTERN_C const char *_gl_directory_name (int fd); 569 570 # else 571 # if !@HAVE_DECL_FCHDIR@ 572 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 573 # endif 574 # endif 575 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); 576 _GL_CXXALIASWARN (fchdir); 577 #elif defined GNULIB_POSIXCHECK 578 # undef fchdir 579 # if HAVE_RAW_DECL_FCHDIR 580 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - " 581 "use gnulib module fchdir for portability"); 582 # endif 583 #endif 584 585 586 #if @GNULIB_FCHOWNAT@ 587 # if @REPLACE_FCHOWNAT@ 588 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 589 # undef fchownat 590 # define fchownat rpl_fchownat 591 # endif 592 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, 593 uid_t owner, gid_t group, int flag) 594 _GL_ARG_NONNULL ((2))); 595 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, 596 uid_t owner, gid_t group, int flag)); 597 # else 598 # if !@HAVE_FCHOWNAT@ 599 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, 600 uid_t owner, gid_t group, int flag) 601 _GL_ARG_NONNULL ((2))); 602 # endif 603 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, 604 uid_t owner, gid_t group, int flag)); 605 # endif 606 _GL_CXXALIASWARN (fchownat); 607 #elif defined GNULIB_POSIXCHECK 608 # undef fchownat 609 # if HAVE_RAW_DECL_FCHOWNAT 610 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " 611 "use gnulib module openat for portability"); 612 # endif 613 #endif 614 615 616 #if @GNULIB_FDATASYNC@ 617 /* Synchronize changes to a file. 618 Return 0 if successful, otherwise -1 and errno set. 619 See POSIX:2008 specification 620 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ 621 # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ 622 _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); 623 # endif 624 _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); 625 _GL_CXXALIASWARN (fdatasync); 626 #elif defined GNULIB_POSIXCHECK 627 # undef fdatasync 628 # if HAVE_RAW_DECL_FDATASYNC 629 _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " 630 "use gnulib module fdatasync for portability"); 631 # endif 632 #endif 633 634 635 #if @GNULIB_FSYNC@ 636 /* Synchronize changes, including metadata, to a file. 637 Return 0 if successful, otherwise -1 and errno set. 638 See POSIX:2008 specification 639 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ 640 # if !@HAVE_FSYNC@ 641 _GL_FUNCDECL_SYS (fsync, int, (int fd)); 642 # endif 643 _GL_CXXALIAS_SYS (fsync, int, (int fd)); 644 _GL_CXXALIASWARN (fsync); 645 #elif defined GNULIB_POSIXCHECK 646 # undef fsync 647 # if HAVE_RAW_DECL_FSYNC 648 _GL_WARN_ON_USE (fsync, "fsync is unportable - " 649 "use gnulib module fsync for portability"); 650 # endif 651 #endif 652 653 654 #if @GNULIB_FTRUNCATE@ 655 /* Change the size of the file to which FD is opened to become equal to LENGTH. 656 Return 0 if successful, otherwise -1 and errno set. 657 See the POSIX:2008 specification 658 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ 659 # if @REPLACE_FTRUNCATE@ 660 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 661 # undef ftruncate 662 # define ftruncate rpl_ftruncate 663 # endif 664 _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); 665 _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); 666 # else 667 # if !@HAVE_FTRUNCATE@ 668 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 669 # endif 670 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 671 # endif 672 _GL_CXXALIASWARN (ftruncate); 673 #elif defined GNULIB_POSIXCHECK 674 # undef ftruncate 675 # if HAVE_RAW_DECL_FTRUNCATE 676 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " 677 "use gnulib module ftruncate for portability"); 678 # endif 679 #endif 680 681 682 #if @GNULIB_GETCWD@ 683 /* Get the name of the current working directory, and put it in SIZE bytes 684 of BUF. 685 Return BUF if successful, or NULL if the directory couldn't be determined 686 or SIZE was too small. 687 See the POSIX:2008 specification 688 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. 689 Additionally, the gnulib module 'getcwd' guarantees the following GNU 690 extension: If BUF is NULL, an array is allocated with 'malloc'; the array 691 is SIZE bytes long, unless SIZE == 0, in which case it is as big as 692 necessary. */ 693 # if @REPLACE_GETCWD@ 694 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 695 # define getcwd rpl_getcwd 696 # endif 697 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); 698 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); 699 # else 700 /* Need to cast, because on mingw, the second parameter is 701 int size. */ 702 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); 703 # endif 704 _GL_CXXALIASWARN (getcwd); 705 #elif defined GNULIB_POSIXCHECK 706 # undef getcwd 707 # if HAVE_RAW_DECL_GETCWD 708 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " 709 "use gnulib module getcwd for portability"); 710 # endif 711 #endif 712 713 714 #if @GNULIB_GETDOMAINNAME@ 715 /* Return the NIS domain name of the machine. 716 WARNING! The NIS domain name is unrelated to the fully qualified host name 717 of the machine. It is also unrelated to email addresses. 718 WARNING! The NIS domain name is usually the empty string or "(none)" when 719 not using NIS. 720 721 Put up to LEN bytes of the NIS domain name into NAME. 722 Null terminate it if the name is shorter than LEN. 723 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. 724 Return 0 if successful, otherwise set errno and return -1. */ 725 # if @REPLACE_GETDOMAINNAME@ 726 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 727 # undef getdomainname 728 # define getdomainname rpl_getdomainname 729 # endif 730 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) 731 _GL_ARG_NONNULL ((1))); 732 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); 733 # else 734 # if !@HAVE_DECL_GETDOMAINNAME@ 735 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) 736 _GL_ARG_NONNULL ((1))); 737 # endif 738 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); 739 # endif 740 _GL_CXXALIASWARN (getdomainname); 741 #elif defined GNULIB_POSIXCHECK 742 # undef getdomainname 743 # if HAVE_RAW_DECL_GETDOMAINNAME 744 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " 745 "use gnulib module getdomainname for portability"); 746 # endif 747 #endif 748 749 750 #if @GNULIB_GETDTABLESIZE@ 751 /* Return the maximum number of file descriptors in the current process. 752 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ 753 # if @REPLACE_GETDTABLESIZE@ 754 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 755 # undef getdtablesize 756 # define getdtablesize rpl_getdtablesize 757 # endif 758 _GL_FUNCDECL_RPL (getdtablesize, int, (void)); 759 _GL_CXXALIAS_RPL (getdtablesize, int, (void)); 760 # else 761 # if !@HAVE_GETDTABLESIZE@ 762 _GL_FUNCDECL_SYS (getdtablesize, int, (void)); 763 # endif 764 /* Need to cast, because on AIX, the parameter list is 765 (...). */ 766 _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void)); 767 # endif 768 _GL_CXXALIASWARN (getdtablesize); 769 #elif defined GNULIB_POSIXCHECK 770 # undef getdtablesize 771 # if HAVE_RAW_DECL_GETDTABLESIZE 772 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " 773 "use gnulib module getdtablesize for portability"); 774 # endif 775 #endif 776 777 778 #if @GNULIB_GETENTROPY@ 779 /* Fill a buffer with random bytes. */ 780 # if !@HAVE_GETENTROPY@ 781 _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); 782 # endif 783 _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); 784 _GL_CXXALIASWARN (getentropy); 785 #elif defined GNULIB_POSIXCHECK 786 # undef getentropy 787 # if HAVE_RAW_DECL_GETENTROPY 788 _GL_WARN_ON_USE (getentropy, "getentropy is unportable - " 789 "use gnulib module getentropy for portability"); 790 # endif 791 #endif 792 793 794 #if @GNULIB_GETGROUPS@ 795 /* Return the supplemental groups that the current process belongs to. 796 It is unspecified whether the effective group id is in the list. 797 If N is 0, return the group count; otherwise, N describes how many 798 entries are available in GROUPS. Return -1 and set errno if N is 799 not 0 and not large enough. Fails with ENOSYS on some systems. */ 800 # if @REPLACE_GETGROUPS@ 801 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 802 # undef getgroups 803 # define getgroups rpl_getgroups 804 # endif 805 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); 806 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); 807 # else 808 # if !@HAVE_GETGROUPS@ 809 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); 810 # endif 811 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); 812 # endif 813 _GL_CXXALIASWARN (getgroups); 814 #elif defined GNULIB_POSIXCHECK 815 # undef getgroups 816 # if HAVE_RAW_DECL_GETGROUPS 817 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - " 818 "use gnulib module getgroups for portability"); 819 # endif 820 #endif 821 822 823 #if @GNULIB_GETHOSTNAME@ 824 /* Return the standard host name of the machine. 825 WARNING! The host name may or may not be fully qualified. 826 827 Put up to LEN bytes of the host name into NAME. 828 Null terminate it if the name is shorter than LEN. 829 If the host name is longer than LEN, set errno = EINVAL and return -1. 830 Return 0 if successful, otherwise set errno and return -1. */ 831 # if @UNISTD_H_HAVE_WINSOCK2_H@ 832 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 833 # undef gethostname 834 # define gethostname rpl_gethostname 835 # endif 836 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) 837 _GL_ARG_NONNULL ((1))); 838 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); 839 # else 840 # if !@HAVE_GETHOSTNAME@ 841 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) 842 _GL_ARG_NONNULL ((1))); 843 # endif 844 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second 845 parameter is 846 int len. */ 847 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); 848 # endif 849 _GL_CXXALIASWARN (gethostname); 850 #elif @UNISTD_H_HAVE_WINSOCK2_H@ 851 # undef gethostname 852 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname 853 #elif defined GNULIB_POSIXCHECK 854 # undef gethostname 855 # if HAVE_RAW_DECL_GETHOSTNAME 856 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " 857 "use gnulib module gethostname for portability"); 858 # endif 859 #endif 860 861 862 #if @GNULIB_GETLOGIN@ 863 /* Returns the user's login name, or NULL if it cannot be found. Upon error, 864 returns NULL with errno set. 865 866 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>. 867 868 Most programs don't need to use this function, because the information is 869 available through environment variables: 870 ${LOGNAME-$USER} on Unix platforms, 871 $USERNAME on native Windows platforms. 872 */ 873 # if !@HAVE_DECL_GETLOGIN@ 874 _GL_FUNCDECL_SYS (getlogin, char *, (void)); 875 # endif 876 _GL_CXXALIAS_SYS (getlogin, char *, (void)); 877 _GL_CXXALIASWARN (getlogin); 878 #elif defined GNULIB_POSIXCHECK 879 # undef getlogin 880 # if HAVE_RAW_DECL_GETLOGIN 881 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " 882 "use gnulib module getlogin for portability"); 883 # endif 884 #endif 885 886 887 #if @GNULIB_GETLOGIN_R@ 888 /* Copies the user's login name to NAME. 889 The array pointed to by NAME has room for SIZE bytes. 890 891 Returns 0 if successful. Upon error, an error number is returned, or -1 in 892 the case that the login name cannot be found but no specific error is 893 provided (this case is hopefully rare but is left open by the POSIX spec). 894 895 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>. 896 897 Most programs don't need to use this function, because the information is 898 available through environment variables: 899 ${LOGNAME-$USER} on Unix platforms, 900 $USERNAME on native Windows platforms. 901 */ 902 # if @REPLACE_GETLOGIN_R@ 903 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 904 # define getlogin_r rpl_getlogin_r 905 # endif 906 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) 907 _GL_ARG_NONNULL ((1))); 908 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); 909 # else 910 # if !@HAVE_DECL_GETLOGIN_R@ 911 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) 912 _GL_ARG_NONNULL ((1))); 913 # endif 914 /* Need to cast, because on Solaris 10 systems, the second argument is 915 int size. */ 916 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); 917 # endif 918 _GL_CXXALIASWARN (getlogin_r); 919 #elif defined GNULIB_POSIXCHECK 920 # undef getlogin_r 921 # if HAVE_RAW_DECL_GETLOGIN_R 922 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " 923 "use gnulib module getlogin_r for portability"); 924 # endif 925 #endif 926 927 928 #if @GNULIB_GETPAGESIZE@ 929 # if @REPLACE_GETPAGESIZE@ 930 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 931 # define getpagesize rpl_getpagesize 932 # endif 933 _GL_FUNCDECL_RPL (getpagesize, int, (void)); 934 _GL_CXXALIAS_RPL (getpagesize, int, (void)); 935 # else 936 /* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if 937 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ 938 # if defined __hpux 939 _GL_FUNCDECL_SYS (getpagesize, int, (void)); 940 # endif 941 # if !@HAVE_GETPAGESIZE@ 942 # if !defined getpagesize 943 /* This is for POSIX systems. */ 944 # if !defined _gl_getpagesize && defined _SC_PAGESIZE 945 # if ! (defined __VMS && __VMS_VER < 70000000) 946 # define _gl_getpagesize() sysconf (_SC_PAGESIZE) 947 # endif 948 # endif 949 /* This is for older VMS. */ 950 # if !defined _gl_getpagesize && defined __VMS 951 # ifdef __ALPHA 952 # define _gl_getpagesize() 8192 953 # else 954 # define _gl_getpagesize() 512 955 # endif 956 # endif 957 /* This is for BeOS. */ 958 # if !defined _gl_getpagesize && @HAVE_OS_H@ 959 # include <OS.h> 960 # if defined B_PAGE_SIZE 961 # define _gl_getpagesize() B_PAGE_SIZE 962 # endif 963 # endif 964 /* This is for AmigaOS4.0. */ 965 # if !defined _gl_getpagesize && defined __amigaos4__ 966 # define _gl_getpagesize() 2048 967 # endif 968 /* This is for older Unix systems. */ 969 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@ 970 # include <sys/param.h> 971 # ifdef EXEC_PAGESIZE 972 # define _gl_getpagesize() EXEC_PAGESIZE 973 # else 974 # ifdef NBPG 975 # ifndef CLSIZE 976 # define CLSIZE 1 977 # endif 978 # define _gl_getpagesize() (NBPG * CLSIZE) 979 # else 980 # ifdef NBPC 981 # define _gl_getpagesize() NBPC 982 # endif 983 # endif 984 # endif 985 # endif 986 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 987 # define getpagesize() _gl_getpagesize () 988 # else 989 # if !GNULIB_defined_getpagesize_function 990 _GL_UNISTD_INLINE int 991 getpagesize () 992 { 993 return _gl_getpagesize (); 994 } 995 # define GNULIB_defined_getpagesize_function 1 996 # endif 997 # endif 998 # endif 999 # endif 1000 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ 1001 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); 1002 # endif 1003 # if @HAVE_DECL_GETPAGESIZE@ 1004 _GL_CXXALIASWARN (getpagesize); 1005 # endif 1006 #elif defined GNULIB_POSIXCHECK 1007 # undef getpagesize 1008 # if HAVE_RAW_DECL_GETPAGESIZE 1009 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " 1010 "use gnulib module getpagesize for portability"); 1011 # endif 1012 #endif 1013 1014 1015 #if @GNULIB_GETPASS@ 1016 /* Function getpass() from module 'getpass': 1017 Read a password from /dev/tty or stdin. 1018 Function getpass() from module 'getpass-gnu': 1019 Read a password of arbitrary length from /dev/tty or stdin. */ 1020 # if @REPLACE_GETPASS@ 1021 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1022 # undef getpass 1023 # define getpass rpl_getpass 1024 # endif 1025 _GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) 1026 _GL_ARG_NONNULL ((1))); 1027 _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); 1028 # else 1029 # if !@HAVE_GETPASS@ 1030 _GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) 1031 _GL_ARG_NONNULL ((1))); 1032 # endif 1033 _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); 1034 # endif 1035 _GL_CXXALIASWARN (getpass); 1036 #elif defined GNULIB_POSIXCHECK 1037 # undef getpass 1038 # if HAVE_RAW_DECL_GETPASS 1039 _GL_WARN_ON_USE (getpass, "getpass is unportable - " 1040 "use gnulib module getpass or getpass-gnu for portability"); 1041 # endif 1042 #endif 1043 1044 1045 #if @GNULIB_GETUSERSHELL@ 1046 /* Return the next valid login shell on the system, or NULL when the end of 1047 the list has been reached. */ 1048 # if !@HAVE_DECL_GETUSERSHELL@ 1049 _GL_FUNCDECL_SYS (getusershell, char *, (void)); 1050 # endif 1051 _GL_CXXALIAS_SYS (getusershell, char *, (void)); 1052 _GL_CXXALIASWARN (getusershell); 1053 #elif defined GNULIB_POSIXCHECK 1054 # undef getusershell 1055 # if HAVE_RAW_DECL_GETUSERSHELL 1056 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - " 1057 "use gnulib module getusershell for portability"); 1058 # endif 1059 #endif 1060 1061 #if @GNULIB_GETUSERSHELL@ 1062 /* Rewind to pointer that is advanced at each getusershell() call. */ 1063 # if !@HAVE_DECL_GETUSERSHELL@ 1064 _GL_FUNCDECL_SYS (setusershell, void, (void)); 1065 # endif 1066 _GL_CXXALIAS_SYS (setusershell, void, (void)); 1067 _GL_CXXALIASWARN (setusershell); 1068 #elif defined GNULIB_POSIXCHECK 1069 # undef setusershell 1070 # if HAVE_RAW_DECL_SETUSERSHELL 1071 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - " 1072 "use gnulib module getusershell for portability"); 1073 # endif 1074 #endif 1075 1076 #if @GNULIB_GETUSERSHELL@ 1077 /* Free the pointer that is advanced at each getusershell() call and 1078 associated resources. */ 1079 # if !@HAVE_DECL_GETUSERSHELL@ 1080 _GL_FUNCDECL_SYS (endusershell, void, (void)); 1081 # endif 1082 _GL_CXXALIAS_SYS (endusershell, void, (void)); 1083 _GL_CXXALIASWARN (endusershell); 1084 #elif defined GNULIB_POSIXCHECK 1085 # undef endusershell 1086 # if HAVE_RAW_DECL_ENDUSERSHELL 1087 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " 1088 "use gnulib module getusershell for portability"); 1089 # endif 1090 #endif 1091 1092 1093 #if @GNULIB_GROUP_MEMBER@ 1094 /* Determine whether group id is in calling user's group list. */ 1095 # if !@HAVE_GROUP_MEMBER@ 1096 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); 1097 # endif 1098 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); 1099 _GL_CXXALIASWARN (group_member); 1100 #elif defined GNULIB_POSIXCHECK 1101 # undef group_member 1102 # if HAVE_RAW_DECL_GROUP_MEMBER 1103 _GL_WARN_ON_USE (group_member, "group_member is unportable - " 1104 "use gnulib module group-member for portability"); 1105 # endif 1106 #endif 1107 1108 1109 #if @GNULIB_ISATTY@ 1110 # if @REPLACE_ISATTY@ 1111 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1112 # undef isatty 1113 # define isatty rpl_isatty 1114 # endif 1115 _GL_FUNCDECL_RPL (isatty, int, (int fd)); 1116 _GL_CXXALIAS_RPL (isatty, int, (int fd)); 1117 # else 1118 _GL_CXXALIAS_SYS (isatty, int, (int fd)); 1119 # endif 1120 _GL_CXXALIASWARN (isatty); 1121 #elif defined GNULIB_POSIXCHECK 1122 # undef isatty 1123 # if HAVE_RAW_DECL_ISATTY 1124 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " 1125 "use gnulib module isatty for portability"); 1126 # endif 1127 #endif 1128 1129 1130 #if @GNULIB_LCHOWN@ 1131 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 1132 to GID (if GID is not -1). Do not follow symbolic links. 1133 Return 0 if successful, otherwise -1 and errno set. 1134 See the POSIX:2008 specification 1135 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */ 1136 # if @REPLACE_LCHOWN@ 1137 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1138 # undef lchown 1139 # define lchown rpl_lchown 1140 # endif 1141 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) 1142 _GL_ARG_NONNULL ((1))); 1143 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); 1144 # else 1145 # if !@HAVE_LCHOWN@ 1146 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) 1147 _GL_ARG_NONNULL ((1))); 1148 # endif 1149 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); 1150 # endif 1151 _GL_CXXALIASWARN (lchown); 1152 #elif defined GNULIB_POSIXCHECK 1153 # undef lchown 1154 # if HAVE_RAW_DECL_LCHOWN 1155 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " 1156 "use gnulib module lchown for portability"); 1157 # endif 1158 #endif 1159 1160 1161 #if @GNULIB_LINK@ 1162 /* Create a new hard link for an existing file. 1163 Return 0 if successful, otherwise -1 and errno set. 1164 See POSIX:2008 specification 1165 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */ 1166 # if @REPLACE_LINK@ 1167 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1168 # define link rpl_link 1169 # endif 1170 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) 1171 _GL_ARG_NONNULL ((1, 2))); 1172 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); 1173 # else 1174 # if !@HAVE_LINK@ 1175 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) 1176 _GL_ARG_NONNULL ((1, 2))); 1177 # endif 1178 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); 1179 # endif 1180 _GL_CXXALIASWARN (link); 1181 #elif defined GNULIB_POSIXCHECK 1182 # undef link 1183 # if HAVE_RAW_DECL_LINK 1184 _GL_WARN_ON_USE (link, "link is unportable - " 1185 "use gnulib module link for portability"); 1186 # endif 1187 #endif 1188 1189 1190 #if @GNULIB_LINKAT@ 1191 /* Create a new hard link for an existing file, relative to two 1192 directories. FLAG controls whether symlinks are followed. 1193 Return 0 if successful, otherwise -1 and errno set. */ 1194 # if @REPLACE_LINKAT@ 1195 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1196 # undef linkat 1197 # define linkat rpl_linkat 1198 # endif 1199 _GL_FUNCDECL_RPL (linkat, int, 1200 (int fd1, const char *path1, int fd2, const char *path2, 1201 int flag) 1202 _GL_ARG_NONNULL ((2, 4))); 1203 _GL_CXXALIAS_RPL (linkat, int, 1204 (int fd1, const char *path1, int fd2, const char *path2, 1205 int flag)); 1206 # else 1207 # if !@HAVE_LINKAT@ 1208 _GL_FUNCDECL_SYS (linkat, int, 1209 (int fd1, const char *path1, int fd2, const char *path2, 1210 int flag) 1211 _GL_ARG_NONNULL ((2, 4))); 1212 # endif 1213 _GL_CXXALIAS_SYS (linkat, int, 1214 (int fd1, const char *path1, int fd2, const char *path2, 1215 int flag)); 1216 # endif 1217 _GL_CXXALIASWARN (linkat); 1218 #elif defined GNULIB_POSIXCHECK 1219 # undef linkat 1220 # if HAVE_RAW_DECL_LINKAT 1221 _GL_WARN_ON_USE (linkat, "linkat is unportable - " 1222 "use gnulib module linkat for portability"); 1223 # endif 1224 #endif 1225 1226 1227 #if @GNULIB_LSEEK@ 1228 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. 1229 Return the new offset if successful, otherwise -1 and errno set. 1230 See the POSIX:2008 specification 1231 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */ 1232 # if @REPLACE_LSEEK@ 1233 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1234 # define lseek rpl_lseek 1235 # endif 1236 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1237 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1238 # else 1239 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); 1240 # endif 1241 _GL_CXXALIASWARN (lseek); 1242 #elif defined GNULIB_POSIXCHECK 1243 # undef lseek 1244 # if HAVE_RAW_DECL_LSEEK 1245 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " 1246 "systems - use gnulib module lseek for portability"); 1247 # endif 1248 #endif 1249 1250 1251 #if @GNULIB_PIPE@ 1252 /* Create a pipe, defaulting to O_BINARY mode. 1253 Store the read-end as fd[0] and the write-end as fd[1]. 1254 Return 0 upon success, or -1 with errno set upon failure. */ 1255 # if !@HAVE_PIPE@ 1256 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); 1257 # endif 1258 _GL_CXXALIAS_SYS (pipe, int, (int fd[2])); 1259 _GL_CXXALIASWARN (pipe); 1260 #elif defined GNULIB_POSIXCHECK 1261 # undef pipe 1262 # if HAVE_RAW_DECL_PIPE 1263 _GL_WARN_ON_USE (pipe, "pipe is unportable - " 1264 "use gnulib module pipe-posix for portability"); 1265 # endif 1266 #endif 1267 1268 1269 #if @GNULIB_PIPE2@ 1270 /* Create a pipe, applying the given flags when opening the read-end of the 1271 pipe and the write-end of the pipe. 1272 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 1273 and O_TEXT, O_BINARY (defined in "binary-io.h"). 1274 Store the read-end as fd[0] and the write-end as fd[1]. 1275 Return 0 upon success, or -1 with errno set upon failure. 1276 See also the Linux man page at 1277 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ 1278 # if @HAVE_PIPE2@ 1279 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1280 # define pipe2 rpl_pipe2 1281 # endif 1282 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1283 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); 1284 # else 1285 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1286 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); 1287 # endif 1288 _GL_CXXALIASWARN (pipe2); 1289 #elif defined GNULIB_POSIXCHECK 1290 # undef pipe2 1291 # if HAVE_RAW_DECL_PIPE2 1292 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " 1293 "use gnulib module pipe2 for portability"); 1294 # endif 1295 #endif 1296 1297 1298 #if @GNULIB_PREAD@ 1299 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. 1300 Return the number of bytes placed into BUF if successful, otherwise 1301 set errno and return -1. 0 indicates EOF. 1302 See the POSIX:2008 specification 1303 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */ 1304 # if @REPLACE_PREAD@ 1305 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1306 # undef pread 1307 # define pread rpl_pread 1308 # endif 1309 _GL_FUNCDECL_RPL (pread, ssize_t, 1310 (int fd, void *buf, size_t bufsize, off_t offset) 1311 _GL_ARG_NONNULL ((2))); 1312 _GL_CXXALIAS_RPL (pread, ssize_t, 1313 (int fd, void *buf, size_t bufsize, off_t offset)); 1314 # else 1315 # if !@HAVE_PREAD@ 1316 _GL_FUNCDECL_SYS (pread, ssize_t, 1317 (int fd, void *buf, size_t bufsize, off_t offset) 1318 _GL_ARG_NONNULL ((2))); 1319 # endif 1320 _GL_CXXALIAS_SYS (pread, ssize_t, 1321 (int fd, void *buf, size_t bufsize, off_t offset)); 1322 # endif 1323 _GL_CXXALIASWARN (pread); 1324 #elif defined GNULIB_POSIXCHECK 1325 # undef pread 1326 # if HAVE_RAW_DECL_PREAD 1327 _GL_WARN_ON_USE (pread, "pread is unportable - " 1328 "use gnulib module pread for portability"); 1329 # endif 1330 #endif 1331 1332 1333 #if @GNULIB_PWRITE@ 1334 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. 1335 Return the number of bytes written if successful, otherwise 1336 set errno and return -1. 0 indicates nothing written. See the 1337 POSIX:2008 specification 1338 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */ 1339 # if @REPLACE_PWRITE@ 1340 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1341 # undef pwrite 1342 # define pwrite rpl_pwrite 1343 # endif 1344 _GL_FUNCDECL_RPL (pwrite, ssize_t, 1345 (int fd, const void *buf, size_t bufsize, off_t offset) 1346 _GL_ARG_NONNULL ((2))); 1347 _GL_CXXALIAS_RPL (pwrite, ssize_t, 1348 (int fd, const void *buf, size_t bufsize, off_t offset)); 1349 # else 1350 # if !@HAVE_PWRITE@ 1351 _GL_FUNCDECL_SYS (pwrite, ssize_t, 1352 (int fd, const void *buf, size_t bufsize, off_t offset) 1353 _GL_ARG_NONNULL ((2))); 1354 # endif 1355 _GL_CXXALIAS_SYS (pwrite, ssize_t, 1356 (int fd, const void *buf, size_t bufsize, off_t offset)); 1357 # endif 1358 _GL_CXXALIASWARN (pwrite); 1359 #elif defined GNULIB_POSIXCHECK 1360 # undef pwrite 1361 # if HAVE_RAW_DECL_PWRITE 1362 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " 1363 "use gnulib module pwrite for portability"); 1364 # endif 1365 #endif 1366 1367 1368 #if @GNULIB_READ@ 1369 /* Read up to COUNT bytes from file descriptor FD into the buffer starting 1370 at BUF. See the POSIX:2008 specification 1371 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */ 1372 # if @REPLACE_READ@ 1373 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1374 # undef read 1375 # define read rpl_read 1376 # endif 1377 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 1378 _GL_ARG_NONNULL ((2))); 1379 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); 1380 # else 1381 /* Need to cast, because on mingw, the third parameter is 1382 unsigned int count 1383 and the return type is 'int'. */ 1384 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count)); 1385 # endif 1386 _GL_CXXALIASWARN (read); 1387 #endif 1388 1389 1390 #if @GNULIB_READLINK@ 1391 /* Read the contents of the symbolic link FILE and place the first BUFSIZE 1392 bytes of it into BUF. Return the number of bytes placed into BUF if 1393 successful, otherwise -1 and errno set. 1394 See the POSIX:2008 specification 1395 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ 1396 # if @REPLACE_READLINK@ 1397 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1398 # define readlink rpl_readlink 1399 # endif 1400 _GL_FUNCDECL_RPL (readlink, ssize_t, 1401 (const char *restrict file, 1402 char *restrict buf, size_t bufsize) 1403 _GL_ARG_NONNULL ((1, 2))); 1404 _GL_CXXALIAS_RPL (readlink, ssize_t, 1405 (const char *restrict file, 1406 char *restrict buf, size_t bufsize)); 1407 # else 1408 # if !@HAVE_READLINK@ 1409 _GL_FUNCDECL_SYS (readlink, ssize_t, 1410 (const char *restrict file, 1411 char *restrict buf, size_t bufsize) 1412 _GL_ARG_NONNULL ((1, 2))); 1413 # endif 1414 _GL_CXXALIAS_SYS (readlink, ssize_t, 1415 (const char *restrict file, 1416 char *restrict buf, size_t bufsize)); 1417 # endif 1418 _GL_CXXALIASWARN (readlink); 1419 #elif defined GNULIB_POSIXCHECK 1420 # undef readlink 1421 # if HAVE_RAW_DECL_READLINK 1422 _GL_WARN_ON_USE (readlink, "readlink is unportable - " 1423 "use gnulib module readlink for portability"); 1424 # endif 1425 #endif 1426 1427 1428 #if @GNULIB_READLINKAT@ 1429 # if @REPLACE_READLINKAT@ 1430 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1431 # define readlinkat rpl_readlinkat 1432 # endif 1433 _GL_FUNCDECL_RPL (readlinkat, ssize_t, 1434 (int fd, char const *restrict file, 1435 char *restrict buf, size_t len) 1436 _GL_ARG_NONNULL ((2, 3))); 1437 _GL_CXXALIAS_RPL (readlinkat, ssize_t, 1438 (int fd, char const *restrict file, 1439 char *restrict buf, size_t len)); 1440 # else 1441 # if !@HAVE_READLINKAT@ 1442 _GL_FUNCDECL_SYS (readlinkat, ssize_t, 1443 (int fd, char const *restrict file, 1444 char *restrict buf, size_t len) 1445 _GL_ARG_NONNULL ((2, 3))); 1446 # endif 1447 _GL_CXXALIAS_SYS (readlinkat, ssize_t, 1448 (int fd, char const *restrict file, 1449 char *restrict buf, size_t len)); 1450 # endif 1451 _GL_CXXALIASWARN (readlinkat); 1452 #elif defined GNULIB_POSIXCHECK 1453 # undef readlinkat 1454 # if HAVE_RAW_DECL_READLINKAT 1455 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " 1456 "use gnulib module readlinkat for portability"); 1457 # endif 1458 #endif 1459 1460 1461 #if @GNULIB_RMDIR@ 1462 /* Remove the directory DIR. */ 1463 # if @REPLACE_RMDIR@ 1464 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1465 # define rmdir rpl_rmdir 1466 # endif 1467 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); 1468 _GL_CXXALIAS_RPL (rmdir, int, (char const *name)); 1469 # else 1470 _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); 1471 # endif 1472 _GL_CXXALIASWARN (rmdir); 1473 #elif defined GNULIB_POSIXCHECK 1474 # undef rmdir 1475 # if HAVE_RAW_DECL_RMDIR 1476 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " 1477 "use gnulib module rmdir for portability"); 1478 # endif 1479 #endif 1480 1481 1482 #if @GNULIB_SETHOSTNAME@ 1483 /* Set the host name of the machine. 1484 The host name may or may not be fully qualified. 1485 1486 Put LEN bytes of NAME into the host name. 1487 Return 0 if successful, otherwise, set errno and return -1. 1488 1489 Platforms with no ability to set the hostname return -1 and set 1490 errno = ENOSYS. */ 1491 # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ 1492 _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) 1493 _GL_ARG_NONNULL ((1))); 1494 # endif 1495 /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 1496 and FreeBSD 6.4 the second parameter is int. On Solaris 11 1497 2011-10, the first parameter is not const. */ 1498 _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); 1499 _GL_CXXALIASWARN (sethostname); 1500 #elif defined GNULIB_POSIXCHECK 1501 # undef sethostname 1502 # if HAVE_RAW_DECL_SETHOSTNAME 1503 _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " 1504 "use gnulib module sethostname for portability"); 1505 # endif 1506 #endif 1507 1508 1509 #if @GNULIB_SLEEP@ 1510 /* Pause the execution of the current thread for N seconds. 1511 Returns the number of seconds left to sleep. 1512 See the POSIX:2008 specification 1513 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */ 1514 # if @REPLACE_SLEEP@ 1515 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1516 # undef sleep 1517 # define sleep rpl_sleep 1518 # endif 1519 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); 1520 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); 1521 # else 1522 # if !@HAVE_SLEEP@ 1523 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); 1524 # endif 1525 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); 1526 # endif 1527 _GL_CXXALIASWARN (sleep); 1528 #elif defined GNULIB_POSIXCHECK 1529 # undef sleep 1530 # if HAVE_RAW_DECL_SLEEP 1531 _GL_WARN_ON_USE (sleep, "sleep is unportable - " 1532 "use gnulib module sleep for portability"); 1533 # endif 1534 #endif 1535 1536 1537 #if @GNULIB_SYMLINK@ 1538 # if @REPLACE_SYMLINK@ 1539 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1540 # undef symlink 1541 # define symlink rpl_symlink 1542 # endif 1543 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) 1544 _GL_ARG_NONNULL ((1, 2))); 1545 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); 1546 # else 1547 # if !@HAVE_SYMLINK@ 1548 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) 1549 _GL_ARG_NONNULL ((1, 2))); 1550 # endif 1551 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); 1552 # endif 1553 _GL_CXXALIASWARN (symlink); 1554 #elif defined GNULIB_POSIXCHECK 1555 # undef symlink 1556 # if HAVE_RAW_DECL_SYMLINK 1557 _GL_WARN_ON_USE (symlink, "symlink is not portable - " 1558 "use gnulib module symlink for portability"); 1559 # endif 1560 #endif 1561 1562 1563 #if @GNULIB_SYMLINKAT@ 1564 # if @REPLACE_SYMLINKAT@ 1565 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1566 # undef symlinkat 1567 # define symlinkat rpl_symlinkat 1568 # endif 1569 _GL_FUNCDECL_RPL (symlinkat, int, 1570 (char const *contents, int fd, char const *file) 1571 _GL_ARG_NONNULL ((1, 3))); 1572 _GL_CXXALIAS_RPL (symlinkat, int, 1573 (char const *contents, int fd, char const *file)); 1574 # else 1575 # if !@HAVE_SYMLINKAT@ 1576 _GL_FUNCDECL_SYS (symlinkat, int, 1577 (char const *contents, int fd, char const *file) 1578 _GL_ARG_NONNULL ((1, 3))); 1579 # endif 1580 _GL_CXXALIAS_SYS (symlinkat, int, 1581 (char const *contents, int fd, char const *file)); 1582 # endif 1583 _GL_CXXALIASWARN (symlinkat); 1584 #elif defined GNULIB_POSIXCHECK 1585 # undef symlinkat 1586 # if HAVE_RAW_DECL_SYMLINKAT 1587 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " 1588 "use gnulib module symlinkat for portability"); 1589 # endif 1590 #endif 1591 1592 1593 #if @GNULIB_TRUNCATE@ 1594 /* Change the size of the file designated by FILENAME to become equal to LENGTH. 1595 Return 0 if successful, otherwise -1 and errno set. 1596 See the POSIX:2008 specification 1597 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */ 1598 # if @REPLACE_TRUNCATE@ 1599 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1600 # undef truncate 1601 # define truncate rpl_truncate 1602 # endif 1603 _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) 1604 _GL_ARG_NONNULL ((1))); 1605 _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); 1606 # else 1607 # if !@HAVE_DECL_TRUNCATE@ 1608 _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) 1609 _GL_ARG_NONNULL ((1))); 1610 # endif 1611 _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); 1612 # endif 1613 _GL_CXXALIASWARN (truncate); 1614 #elif defined GNULIB_POSIXCHECK 1615 # undef truncate 1616 # if HAVE_RAW_DECL_TRUNCATE 1617 _GL_WARN_ON_USE (truncate, "truncate is unportable - " 1618 "use gnulib module truncate for portability"); 1619 # endif 1620 #endif 1621 1622 1623 #if @GNULIB_TTYNAME_R@ 1624 /* Store at most BUFLEN characters of the pathname of the terminal FD is 1625 open on in BUF. Return 0 on success, otherwise an error number. */ 1626 # if @REPLACE_TTYNAME_R@ 1627 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1628 # undef ttyname_r 1629 # define ttyname_r rpl_ttyname_r 1630 # endif 1631 _GL_FUNCDECL_RPL (ttyname_r, int, 1632 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 1633 _GL_CXXALIAS_RPL (ttyname_r, int, 1634 (int fd, char *buf, size_t buflen)); 1635 # else 1636 # if !@HAVE_DECL_TTYNAME_R@ 1637 _GL_FUNCDECL_SYS (ttyname_r, int, 1638 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 1639 # endif 1640 _GL_CXXALIAS_SYS (ttyname_r, int, 1641 (int fd, char *buf, size_t buflen)); 1642 # endif 1643 _GL_CXXALIASWARN (ttyname_r); 1644 #elif defined GNULIB_POSIXCHECK 1645 # undef ttyname_r 1646 # if HAVE_RAW_DECL_TTYNAME_R 1647 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " 1648 "use gnulib module ttyname_r for portability"); 1649 # endif 1650 #endif 1651 1652 1653 #if @GNULIB_UNLINK@ 1654 # if @REPLACE_UNLINK@ 1655 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1656 # undef unlink 1657 # define unlink rpl_unlink 1658 # endif 1659 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); 1660 _GL_CXXALIAS_RPL (unlink, int, (char const *file)); 1661 # else 1662 _GL_CXXALIAS_SYS (unlink, int, (char const *file)); 1663 # endif 1664 _GL_CXXALIASWARN (unlink); 1665 #elif defined GNULIB_POSIXCHECK 1666 # undef unlink 1667 # if HAVE_RAW_DECL_UNLINK 1668 _GL_WARN_ON_USE (unlink, "unlink is not portable - " 1669 "use gnulib module unlink for portability"); 1670 # endif 1671 #endif 1672 1673 1674 #if @GNULIB_UNLINKAT@ 1675 # if @REPLACE_UNLINKAT@ 1676 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1677 # undef unlinkat 1678 # define unlinkat rpl_unlinkat 1679 # endif 1680 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) 1681 _GL_ARG_NONNULL ((2))); 1682 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); 1683 # else 1684 # if !@HAVE_UNLINKAT@ 1685 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) 1686 _GL_ARG_NONNULL ((2))); 1687 # endif 1688 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); 1689 # endif 1690 _GL_CXXALIASWARN (unlinkat); 1691 #elif defined GNULIB_POSIXCHECK 1692 # undef unlinkat 1693 # if HAVE_RAW_DECL_UNLINKAT 1694 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " 1695 "use gnulib module openat for portability"); 1696 # endif 1697 #endif 1698 1699 1700 #if @GNULIB_USLEEP@ 1701 /* Pause the execution of the current thread for N microseconds. 1702 Returns 0 on completion, or -1 on range error. 1703 See the POSIX:2001 specification 1704 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ 1705 # if @REPLACE_USLEEP@ 1706 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1707 # undef usleep 1708 # define usleep rpl_usleep 1709 # endif 1710 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); 1711 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); 1712 # else 1713 # if !@HAVE_USLEEP@ 1714 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); 1715 # endif 1716 /* Need to cast, because on Haiku, the first parameter is 1717 unsigned int n. */ 1718 _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n)); 1719 # endif 1720 _GL_CXXALIASWARN (usleep); 1721 #elif defined GNULIB_POSIXCHECK 1722 # undef usleep 1723 # if HAVE_RAW_DECL_USLEEP 1724 _GL_WARN_ON_USE (usleep, "usleep is unportable - " 1725 "use gnulib module usleep for portability"); 1726 # endif 1727 #endif 1728 1729 1730 #if @GNULIB_WRITE@ 1731 /* Write up to COUNT bytes starting at BUF to file descriptor FD. 1732 See the POSIX:2008 specification 1733 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */ 1734 # if @REPLACE_WRITE@ 1735 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1736 # undef write 1737 # define write rpl_write 1738 # endif 1739 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 1740 _GL_ARG_NONNULL ((2))); 1741 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); 1742 # else 1743 /* Need to cast, because on mingw, the third parameter is 1744 unsigned int count 1745 and the return type is 'int'. */ 1746 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); 1747 # endif 1748 _GL_CXXALIASWARN (write); 1749 #endif 1750 1751 _GL_INLINE_HEADER_END 1752 1753 #endif /* _@GUARD_PREFIX@_UNISTD_H */ 1754 #endif /* _GL_INCLUDING_UNISTD_H */ 1755 #endif /* _@GUARD_PREFIX@_UNISTD_H */ 1756