1/* This file is automatically generated. DO NOT EDIT! */ 2/* Generated from: NetBSD: mknative-gdb,v 1.16 2023/07/31 17:09:59 christos Exp */ 3/* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp */ 4 5/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 6/* Substitute for and wrapper around <unistd.h>. 7 Copyright (C) 2003-2022 Free Software Foundation, Inc. 8 9 This file is free software: you can redistribute it and/or modify 10 it under the terms of the GNU Lesser General Public License as 11 published by the Free Software Foundation; either version 2.1 of the 12 License, or (at your option) any later version. 13 14 This file is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public License 20 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 21 22#ifndef _GL_UNISTD_H 23 24#if __GNUC__ >= 3 25#pragma GCC system_header 26#endif 27 28 29#if 1 && defined _GL_INCLUDING_UNISTD_H 30/* Special invocation convention: 31 - On Mac OS X 10.3.9 we have a sequence of nested includes 32 <unistd.h> -> <signal.h> -> <pthread.h> -> <unistd.h> 33 In this situation, the functions are not yet declared, therefore we cannot 34 provide the C++ aliases. */ 35 36#include_next <unistd.h> 37 38#else 39/* Normal invocation convention. */ 40 41/* The include_next requires a split double-inclusion guard. */ 42#if 1 43# define _GL_INCLUDING_UNISTD_H 44# include_next <unistd.h> 45# undef _GL_INCLUDING_UNISTD_H 46#endif 47 48/* Get all possible declarations of gethostname(). */ 49#if 0 && 0 \ 50 && !defined _GL_INCLUDING_WINSOCK2_H 51# define _GL_INCLUDING_WINSOCK2_H 52# include <winsock2.h> 53# undef _GL_INCLUDING_WINSOCK2_H 54#endif 55 56#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H 57#define _GL_UNISTD_H 58 59/* NetBSD 5.0 mis-defines NULL. Also get size_t. */ 60/* But avoid namespace pollution on glibc systems. */ 61#ifndef __GLIBC__ 62# include <stddef.h> 63#endif 64 65/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ 66/* MSVC declares 'unlink' in <stdio.h>, not in <unistd.h>. We must include 67 it before we #define unlink rpl_unlink. */ 68/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ 69/* But avoid namespace pollution on glibc systems. */ 70#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ 71 || ((0 || defined GNULIB_POSIXCHECK) \ 72 && (defined _WIN32 && ! defined __CYGWIN__)) \ 73 || ((0 || defined GNULIB_POSIXCHECK) \ 74 && defined __CYGWIN__)) \ 75 && ! defined __GLIBC__ 76# include <stdio.h> 77#endif 78 79/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in 80 <unistd.h>. */ 81/* But avoid namespace pollution on glibc systems. */ 82#if (0 || defined GNULIB_POSIXCHECK) \ 83 && (defined __CYGWIN__ || defined __ANDROID__) \ 84 && ! defined __GLIBC__ 85# include <fcntl.h> 86#endif 87 88/* mingw fails to declare _exit in <unistd.h>. */ 89/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in 90 <unistd.h>. */ 91/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ 92/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is 93 included here. */ 94/* But avoid namespace pollution on glibc systems. */ 95#if !defined __GLIBC__ && !defined __osf__ 96# define __need_system_stdlib_h 97# include <stdlib.h> 98# undef __need_system_stdlib_h 99#endif 100 101/* Native Windows platforms declare _chdir, _getcwd, _rmdir in 102 <io.h> and/or <direct.h>, not in <unistd.h>. 103 They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(), 104 _lseek(), _read(), _unlink(), _write() in <io.h>. */ 105#if defined _WIN32 && !defined __CYGWIN__ 106# include <io.h> 107# include <direct.h> 108#endif 109 110/* Native Windows platforms declare _execl*, _execv* in <process.h>. */ 111#if defined _WIN32 && !defined __CYGWIN__ 112# include <process.h> 113#endif 114 115/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. 116 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */ 117/* But avoid namespace pollution on glibc systems. */ 118#if ((0 && (defined _AIX || defined __osf__)) \ 119 || (0 && defined __TANDEM)) \ 120 && !defined __GLIBC__ 121# include <netdb.h> 122#endif 123 124/* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in 125 <sys/random.h>, not in <unistd.h>. */ 126/* But avoid namespace pollution on glibc systems. */ 127#if (0 || defined GNULIB_POSIXCHECK) \ 128 && ((defined __APPLE__ && defined __MACH__) || defined __sun \ 129 || defined __ANDROID__) \ 130 && 1 \ 131 && !defined __GLIBC__ 132# include <sys/random.h> 133#endif 134 135/* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */ 136/* But avoid namespace pollution on glibc systems. */ 137#if (0 || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ 138 && !defined __GLIBC__ 139# include <sys/stat.h> 140#endif 141 142/* MSVC defines off_t in <sys/types.h>. 143 May also define off_t to a 64-bit type on native Windows. */ 144/* Get off_t, ssize_t, mode_t. */ 145#include <sys/types.h> 146 147/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 148/* C++ compatible function declaration macros. 149 Copyright (C) 2010-2022 Free Software Foundation, Inc. 150 151 This program is free software: you can redistribute it and/or modify it 152 under the terms of the GNU Lesser General Public License as published 153 by the Free Software Foundation; either version 2 of the License, or 154 (at your option) any later version. 155 156 This program is distributed in the hope that it will be useful, 157 but WITHOUT ANY WARRANTY; without even the implied warranty of 158 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 159 Lesser General Public License for more details. 160 161 You should have received a copy of the GNU Lesser General Public License 162 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 163 164#ifndef _GL_CXXDEFS_H 165#define _GL_CXXDEFS_H 166 167/* Begin/end the GNULIB_NAMESPACE namespace. */ 168#if defined __cplusplus && defined GNULIB_NAMESPACE 169# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 170# define _GL_END_NAMESPACE } 171#else 172# define _GL_BEGIN_NAMESPACE 173# define _GL_END_NAMESPACE 174#endif 175 176/* The three most frequent use cases of these macros are: 177 178 * For providing a substitute for a function that is missing on some 179 platforms, but is declared and works fine on the platforms on which 180 it exists: 181 182 #if @GNULIB_FOO@ 183 # if !@HAVE_FOO@ 184 _GL_FUNCDECL_SYS (foo, ...); 185 # endif 186 _GL_CXXALIAS_SYS (foo, ...); 187 _GL_CXXALIASWARN (foo); 188 #elif defined GNULIB_POSIXCHECK 189 ... 190 #endif 191 192 * For providing a replacement for a function that exists on all platforms, 193 but is broken/insufficient and needs to be replaced on some platforms: 194 195 #if @GNULIB_FOO@ 196 # if @REPLACE_FOO@ 197 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 198 # undef foo 199 # define foo rpl_foo 200 # endif 201 _GL_FUNCDECL_RPL (foo, ...); 202 _GL_CXXALIAS_RPL (foo, ...); 203 # else 204 _GL_CXXALIAS_SYS (foo, ...); 205 # endif 206 _GL_CXXALIASWARN (foo); 207 #elif defined GNULIB_POSIXCHECK 208 ... 209 #endif 210 211 * For providing a replacement for a function that exists on some platforms 212 but is broken/insufficient and needs to be replaced on some of them and 213 is additionally either missing or undeclared on some other platforms: 214 215 #if @GNULIB_FOO@ 216 # if @REPLACE_FOO@ 217 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 218 # undef foo 219 # define foo rpl_foo 220 # endif 221 _GL_FUNCDECL_RPL (foo, ...); 222 _GL_CXXALIAS_RPL (foo, ...); 223 # else 224 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 225 _GL_FUNCDECL_SYS (foo, ...); 226 # endif 227 _GL_CXXALIAS_SYS (foo, ...); 228 # endif 229 _GL_CXXALIASWARN (foo); 230 #elif defined GNULIB_POSIXCHECK 231 ... 232 #endif 233*/ 234 235/* _GL_EXTERN_C declaration; 236 performs the declaration with C linkage. */ 237#if defined __cplusplus 238# define _GL_EXTERN_C extern "C" 239#else 240# define _GL_EXTERN_C extern 241#endif 242 243/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 244 declares a replacement function, named rpl_func, with the given prototype, 245 consisting of return type, parameters, and attributes. 246 Example: 247 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 248 _GL_ARG_NONNULL ((1))); 249 */ 250#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 251 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 252#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 253 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 254 255/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 256 declares the system function, named func, with the given prototype, 257 consisting of return type, parameters, and attributes. 258 Example: 259 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 260 _GL_ARG_NONNULL ((1))); 261 */ 262#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 263 _GL_EXTERN_C rettype func parameters_and_attributes 264 265/* _GL_CXXALIAS_RPL (func, rettype, parameters); 266 declares a C++ alias called GNULIB_NAMESPACE::func 267 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 268 Example: 269 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 270 271 Wrapping rpl_func in an object with an inline conversion operator 272 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 273 actually used in the program. */ 274#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 275 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 276#if defined __cplusplus && defined GNULIB_NAMESPACE 277# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 278 namespace GNULIB_NAMESPACE \ 279 { \ 280 static const struct _gl_ ## func ## _wrapper \ 281 { \ 282 typedef rettype (*type) parameters; \ 283 \ 284 inline operator type () const \ 285 { \ 286 return ::rpl_func; \ 287 } \ 288 } func = {}; \ 289 } \ 290 _GL_EXTERN_C int _gl_cxxalias_dummy 291#else 292# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 293 _GL_EXTERN_C int _gl_cxxalias_dummy 294#endif 295 296/* _GL_CXXALIAS_MDA (func, rettype, parameters); 297 is to be used when func is a Microsoft deprecated alias, on native Windows. 298 It declares a C++ alias called GNULIB_NAMESPACE::func 299 that redirects to _func, if GNULIB_NAMESPACE is defined. 300 Example: 301 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); 302 */ 303#define _GL_CXXALIAS_MDA(func,rettype,parameters) \ 304 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) 305 306/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 307 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 308 except that the C function rpl_func may have a slightly different 309 declaration. A cast is used to silence the "invalid conversion" error 310 that would otherwise occur. */ 311#if defined __cplusplus && defined GNULIB_NAMESPACE 312# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 313 namespace GNULIB_NAMESPACE \ 314 { \ 315 static const struct _gl_ ## func ## _wrapper \ 316 { \ 317 typedef rettype (*type) parameters; \ 318 \ 319 inline operator type () const \ 320 { \ 321 return reinterpret_cast<type>(::rpl_func); \ 322 } \ 323 } func = {}; \ 324 } \ 325 _GL_EXTERN_C int _gl_cxxalias_dummy 326#else 327# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 328 _GL_EXTERN_C int _gl_cxxalias_dummy 329#endif 330 331/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); 332 is like _GL_CXXALIAS_MDA (func, rettype, parameters); 333 except that the C function func may have a slightly different declaration. 334 A cast is used to silence the "invalid conversion" error that would 335 otherwise occur. */ 336#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ 337 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) 338 339/* _GL_CXXALIAS_SYS (func, rettype, parameters); 340 declares a C++ alias called GNULIB_NAMESPACE::func 341 that redirects to the system provided function func, if GNULIB_NAMESPACE 342 is defined. 343 Example: 344 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 345 346 Wrapping func in an object with an inline conversion operator 347 avoids a reference to func unless GNULIB_NAMESPACE::func is 348 actually used in the program. */ 349#if defined __cplusplus && defined GNULIB_NAMESPACE 350# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 351 namespace GNULIB_NAMESPACE \ 352 { \ 353 static const struct _gl_ ## func ## _wrapper \ 354 { \ 355 typedef rettype (*type) parameters; \ 356 \ 357 inline operator type () const \ 358 { \ 359 return ::func; \ 360 } \ 361 } func = {}; \ 362 } \ 363 _GL_EXTERN_C int _gl_cxxalias_dummy 364#else 365# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 366 _GL_EXTERN_C int _gl_cxxalias_dummy 367#endif 368 369/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 370 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 371 except that the C function func may have a slightly different declaration. 372 A cast is used to silence the "invalid conversion" error that would 373 otherwise occur. */ 374#if defined __cplusplus && defined GNULIB_NAMESPACE 375# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 376 namespace GNULIB_NAMESPACE \ 377 { \ 378 static const struct _gl_ ## func ## _wrapper \ 379 { \ 380 typedef rettype (*type) parameters; \ 381 \ 382 inline operator type () const \ 383 { \ 384 return reinterpret_cast<type>(::func); \ 385 } \ 386 } func = {}; \ 387 } \ 388 _GL_EXTERN_C int _gl_cxxalias_dummy 389#else 390# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 391 _GL_EXTERN_C int _gl_cxxalias_dummy 392#endif 393 394/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 395 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 396 except that the C function is picked among a set of overloaded functions, 397 namely the one with rettype2 and parameters2. Two consecutive casts 398 are used to silence the "cannot find a match" and "invalid conversion" 399 errors that would otherwise occur. */ 400#if defined __cplusplus && defined GNULIB_NAMESPACE 401 /* The outer cast must be a reinterpret_cast. 402 The inner cast: When the function is defined as a set of overloaded 403 functions, it works as a static_cast<>, choosing the designated variant. 404 When the function is defined as a single variant, it works as a 405 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 406# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 407 namespace GNULIB_NAMESPACE \ 408 { \ 409 static const struct _gl_ ## func ## _wrapper \ 410 { \ 411 typedef rettype (*type) parameters; \ 412 \ 413 inline operator type () const \ 414 { \ 415 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 416 } \ 417 } func = {}; \ 418 } \ 419 _GL_EXTERN_C int _gl_cxxalias_dummy 420#else 421# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 422 _GL_EXTERN_C int _gl_cxxalias_dummy 423#endif 424 425/* _GL_CXXALIASWARN (func); 426 causes a warning to be emitted when ::func is used but not when 427 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 428 variants. */ 429#if defined __cplusplus && defined GNULIB_NAMESPACE 430# define _GL_CXXALIASWARN(func) \ 431 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 432# define _GL_CXXALIASWARN_1(func,namespace) \ 433 _GL_CXXALIASWARN_2 (func, namespace) 434/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 435 we enable the warning only when not optimizing. */ 436# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) 437# define _GL_CXXALIASWARN_2(func,namespace) \ 438 _GL_WARN_ON_USE (func, \ 439 "The symbol ::" #func " refers to the system function. " \ 440 "Use " #namespace "::" #func " instead.") 441# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 442# define _GL_CXXALIASWARN_2(func,namespace) \ 443 extern __typeof__ (func) func 444# else 445# define _GL_CXXALIASWARN_2(func,namespace) \ 446 _GL_EXTERN_C int _gl_cxxalias_dummy 447# endif 448#else 449# define _GL_CXXALIASWARN(func) \ 450 _GL_EXTERN_C int _gl_cxxalias_dummy 451#endif 452 453/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 454 causes a warning to be emitted when the given overloaded variant of ::func 455 is used but not when GNULIB_NAMESPACE::func is used. */ 456#if defined __cplusplus && defined GNULIB_NAMESPACE 457# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 458 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 459 GNULIB_NAMESPACE) 460# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 461 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 462/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 463 we enable the warning only when not optimizing. */ 464# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) 465# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 466 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ 467 "The symbol ::" #func " refers to the system function. " \ 468 "Use " #namespace "::" #func " instead.") 469# else 470# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 471 _GL_EXTERN_C int _gl_cxxalias_dummy 472# endif 473#else 474# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 475 _GL_EXTERN_C int _gl_cxxalias_dummy 476#endif 477 478#endif /* _GL_CXXDEFS_H */ 479 480/* The definition of _GL_ARG_NONNULL is copied here. */ 481/* A C macro for declaring that specific arguments must not be NULL. 482 Copyright (C) 2009-2022 Free Software Foundation, Inc. 483 484 This program is free software: you can redistribute it and/or modify it 485 under the terms of the GNU Lesser General Public License as published 486 by the Free Software Foundation; either version 2 of the License, or 487 (at your option) any later version. 488 489 This program is distributed in the hope that it will be useful, 490 but WITHOUT ANY WARRANTY; without even the implied warranty of 491 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 492 Lesser General Public License for more details. 493 494 You should have received a copy of the GNU Lesser General Public License 495 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 496 497/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 498 that the values passed as arguments n, ..., m must be non-NULL pointers. 499 n = 1 stands for the first argument, n = 2 for the second argument etc. */ 500#ifndef _GL_ARG_NONNULL 501# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ 502# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 503# else 504# define _GL_ARG_NONNULL(params) 505# endif 506#endif 507 508/* The definition of _GL_WARN_ON_USE is copied here. */ 509/* A C macro for emitting warnings if a function is used. 510 Copyright (C) 2010-2022 Free Software Foundation, Inc. 511 512 This program is free software: you can redistribute it and/or modify it 513 under the terms of the GNU Lesser General Public License as published 514 by the Free Software Foundation; either version 2 of the License, or 515 (at your option) any later version. 516 517 This program is distributed in the hope that it will be useful, 518 but WITHOUT ANY WARRANTY; without even the implied warranty of 519 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 520 Lesser General Public License for more details. 521 522 You should have received a copy of the GNU Lesser General Public License 523 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 524 525/* _GL_WARN_ON_USE (function, "literal string") issues a declaration 526 for FUNCTION which will then trigger a compiler warning containing 527 the text of "literal string" anywhere that function is called, if 528 supported by the compiler. If the compiler does not support this 529 feature, the macro expands to an unused extern declaration. 530 531 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 532 attribute used in _GL_WARN_ON_USE. If the compiler does not support 533 this feature, it expands to empty. 534 535 These macros are useful for marking a function as a potential 536 portability trap, with the intent that "literal string" include 537 instructions on the replacement function that should be used 538 instead. 539 _GL_WARN_ON_USE is for functions with 'extern' linkage. 540 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 541 linkage. 542 543 However, one of the reasons that a function is a portability trap is 544 if it has the wrong signature. Declaring FUNCTION with a different 545 signature in C is a compilation error, so this macro must use the 546 same type as any existing declaration so that programs that avoid 547 the problematic FUNCTION do not fail to compile merely because they 548 included a header that poisoned the function. But this implies that 549 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 550 have a declaration. Use of this macro implies that there must not 551 be any other macro hiding the declaration of FUNCTION; but 552 undefining FUNCTION first is part of the poisoning process anyway 553 (although for symbols that are provided only via a macro, the result 554 is a compilation error rather than a warning containing 555 "literal string"). Also note that in C++, it is only safe to use if 556 FUNCTION has no overloads. 557 558 For an example, it is possible to poison 'getline' by: 559 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 560 [getline]) in configure.ac, which potentially defines 561 HAVE_RAW_DECL_GETLINE 562 - adding this code to a header that wraps the system <stdio.h>: 563 #undef getline 564 #if HAVE_RAW_DECL_GETLINE 565 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 566 "not universally present; use the gnulib module getline"); 567 #endif 568 569 It is not possible to directly poison global variables. But it is 570 possible to write a wrapper accessor function, and poison that 571 (less common usage, like &environ, will cause a compilation error 572 rather than issue the nice warning, but the end result of informing 573 the developer about their portability problem is still achieved): 574 #if HAVE_RAW_DECL_ENVIRON 575 static char *** 576 rpl_environ (void) { return &environ; } 577 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 578 # undef environ 579 # define environ (*rpl_environ ()) 580 #endif 581 or better (avoiding contradictory use of 'static' and 'extern'): 582 #if HAVE_RAW_DECL_ENVIRON 583 static char *** 584 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 585 rpl_environ (void) { return &environ; } 586 # undef environ 587 # define environ (*rpl_environ ()) 588 #endif 589 */ 590#ifndef _GL_WARN_ON_USE 591 592# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 593/* A compiler attribute is available in gcc versions 4.3.0 and later. */ 594# define _GL_WARN_ON_USE(function, message) \ 595_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) 596# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 597 __attribute__ ((__warning__ (message))) 598# elif __clang_major__ >= 4 599/* Another compiler attribute is available in clang. */ 600# define _GL_WARN_ON_USE(function, message) \ 601_GL_WARN_EXTERN_C __typeof__ (function) function \ 602 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 603# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 604 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 605# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 606/* Verify the existence of the function. */ 607# define _GL_WARN_ON_USE(function, message) \ 608_GL_WARN_EXTERN_C __typeof__ (function) function 609# define _GL_WARN_ON_USE_ATTRIBUTE(message) 610# else /* Unsupported. */ 611# define _GL_WARN_ON_USE(function, message) \ 612_GL_WARN_EXTERN_C int _gl_warn_on_use 613# define _GL_WARN_ON_USE_ATTRIBUTE(message) 614# endif 615#endif 616 617/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") 618 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the 619 function is declared with the given prototype, consisting of return type, 620 parameters, and attributes. 621 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 622 not work in this case. */ 623#ifndef _GL_WARN_ON_USE_CXX 624# if !defined __cplusplus 625# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 626 _GL_WARN_ON_USE (function, msg) 627# else 628# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 629/* A compiler attribute is available in gcc versions 4.3.0 and later. */ 630# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 631extern rettype_gcc function parameters_and_attributes \ 632 __attribute__ ((__warning__ (msg))) 633# elif __clang_major__ >= 4 634/* Another compiler attribute is available in clang. */ 635# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 636extern rettype_clang function parameters_and_attributes \ 637 __attribute__ ((__diagnose_if__ (1, msg, "warning"))) 638# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 639/* Verify the existence of the function. */ 640# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 641extern rettype_gcc function parameters_and_attributes 642# else /* Unsupported. */ 643# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 644_GL_WARN_EXTERN_C int _gl_warn_on_use 645# endif 646# endif 647#endif 648 649/* _GL_WARN_EXTERN_C declaration; 650 performs the declaration with C linkage. */ 651#ifndef _GL_WARN_EXTERN_C 652# if defined __cplusplus 653# define _GL_WARN_EXTERN_C extern "C" 654# else 655# define _GL_WARN_EXTERN_C extern 656# endif 657#endif 658 659 660/* Get getopt(), optarg, optind, opterr, optopt. */ 661#if 0 && 00 && !defined _GL_SYSTEM_GETOPT 662# include <getopt-cdefs.h> 663# include <getopt-pfx-core.h> 664#endif 665 666#ifndef _GL_INLINE_HEADER_BEGIN 667 #error "Please include config.h first." 668#endif 669_GL_INLINE_HEADER_BEGIN 670#ifndef _GL_UNISTD_INLINE 671# define _GL_UNISTD_INLINE _GL_INLINE 672#endif 673 674/* Hide some function declarations from <winsock2.h>. */ 675 676#if 0 && 0 677# if !defined _GL_SYS_SOCKET_H 678# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 679# undef socket 680# define socket socket_used_without_including_sys_socket_h 681# undef connect 682# define connect connect_used_without_including_sys_socket_h 683# undef accept 684# define accept accept_used_without_including_sys_socket_h 685# undef bind 686# define bind bind_used_without_including_sys_socket_h 687# undef getpeername 688# define getpeername getpeername_used_without_including_sys_socket_h 689# undef getsockname 690# define getsockname getsockname_used_without_including_sys_socket_h 691# undef getsockopt 692# define getsockopt getsockopt_used_without_including_sys_socket_h 693# undef listen 694# define listen listen_used_without_including_sys_socket_h 695# undef recv 696# define recv recv_used_without_including_sys_socket_h 697# undef send 698# define send send_used_without_including_sys_socket_h 699# undef recvfrom 700# define recvfrom recvfrom_used_without_including_sys_socket_h 701# undef sendto 702# define sendto sendto_used_without_including_sys_socket_h 703# undef setsockopt 704# define setsockopt setsockopt_used_without_including_sys_socket_h 705# undef shutdown 706# define shutdown shutdown_used_without_including_sys_socket_h 707# else 708 _GL_WARN_ON_USE (socket, 709 "socket() used without including <sys/socket.h>"); 710 _GL_WARN_ON_USE (connect, 711 "connect() used without including <sys/socket.h>"); 712 _GL_WARN_ON_USE (accept, 713 "accept() used without including <sys/socket.h>"); 714 _GL_WARN_ON_USE (bind, 715 "bind() used without including <sys/socket.h>"); 716 _GL_WARN_ON_USE (getpeername, 717 "getpeername() used without including <sys/socket.h>"); 718 _GL_WARN_ON_USE (getsockname, 719 "getsockname() used without including <sys/socket.h>"); 720 _GL_WARN_ON_USE (getsockopt, 721 "getsockopt() used without including <sys/socket.h>"); 722 _GL_WARN_ON_USE (listen, 723 "listen() used without including <sys/socket.h>"); 724 _GL_WARN_ON_USE (recv, 725 "recv() used without including <sys/socket.h>"); 726 _GL_WARN_ON_USE (send, 727 "send() used without including <sys/socket.h>"); 728 _GL_WARN_ON_USE (recvfrom, 729 "recvfrom() used without including <sys/socket.h>"); 730 _GL_WARN_ON_USE (sendto, 731 "sendto() used without including <sys/socket.h>"); 732 _GL_WARN_ON_USE (setsockopt, 733 "setsockopt() used without including <sys/socket.h>"); 734 _GL_WARN_ON_USE (shutdown, 735 "shutdown() used without including <sys/socket.h>"); 736# endif 737# endif 738# if !defined _GL_SYS_SELECT_H 739# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 740# undef select 741# define select select_used_without_including_sys_select_h 742# else 743 _GL_WARN_ON_USE (select, 744 "select() used without including <sys/select.h>"); 745# endif 746# endif 747#endif 748 749 750/* OS/2 EMX lacks these macros. */ 751#ifndef STDIN_FILENO 752# define STDIN_FILENO 0 753#endif 754#ifndef STDOUT_FILENO 755# define STDOUT_FILENO 1 756#endif 757#ifndef STDERR_FILENO 758# define STDERR_FILENO 2 759#endif 760 761/* Ensure *_OK macros exist. */ 762#ifndef F_OK 763# define F_OK 0 764# define X_OK 1 765# define W_OK 2 766# define R_OK 4 767#endif 768 769 770/* Declare overridden functions. */ 771 772 773#if 0 774# if 0 775# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 776# undef access 777# define access rpl_access 778# endif 779_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) 780 _GL_ARG_NONNULL ((1))); 781_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); 782# elif defined _WIN32 && !defined __CYGWIN__ 783# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 784# undef access 785# define access _access 786# endif 787_GL_CXXALIAS_MDA (access, int, (const char *file, int mode)); 788# else 789_GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); 790# endif 791_GL_CXXALIASWARN (access); 792#elif defined GNULIB_POSIXCHECK 793# undef access 794# if HAVE_RAW_DECL_ACCESS 795/* The access() function is a security risk. */ 796_GL_WARN_ON_USE (access, "access does not always support X_OK - " 797 "use gnulib module access for portability; " 798 "also, this function is a security risk - " 799 "use the gnulib module faccessat instead"); 800# endif 801#elif 1 802/* On native Windows, map 'access' to '_access', so that -loldnames is not 803 required. In C++ with GNULIB_NAMESPACE, avoid differences between 804 platforms by defining GNULIB_NAMESPACE::access always. */ 805# if defined _WIN32 && !defined __CYGWIN__ 806# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 807# undef access 808# define access _access 809# endif 810_GL_CXXALIAS_MDA (access, int, (const char *file, int mode)); 811# else 812_GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); 813# endif 814_GL_CXXALIASWARN (access); 815#endif 816 817 818#if 1 819# if defined _WIN32 && !defined __CYGWIN__ 820# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 821# undef chdir 822# define chdir _chdir 823# endif 824_GL_CXXALIAS_MDA (chdir, int, (const char *file)); 825# else 826_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); 827# endif 828_GL_CXXALIASWARN (chdir); 829#elif defined GNULIB_POSIXCHECK 830# undef chdir 831# if HAVE_RAW_DECL_CHDIR 832_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " 833 "use gnulib module chdir for portability"); 834# endif 835#elif 1 836/* On native Windows, map 'chdir' to '_chdir', so that -loldnames is not 837 required. In C++ with GNULIB_NAMESPACE, avoid differences between 838 platforms by defining GNULIB_NAMESPACE::chdir always. */ 839# if defined _WIN32 && !defined __CYGWIN__ 840# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 841# undef chdir 842# define chdir _chdir 843# endif 844_GL_CXXALIAS_MDA (chdir, int, (const char *file)); 845# else 846_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); 847# endif 848_GL_CXXALIASWARN (chdir); 849#endif 850 851 852#if 1 853/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 854 to GID (if GID is not -1). Follow symbolic links. 855 Return 0 if successful, otherwise -1 and errno set. 856 See the POSIX:2008 specification 857 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */ 858# if 1 859# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 860# undef chown 861# define chown rpl_chown 862# endif 863_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) 864 _GL_ARG_NONNULL ((1))); 865_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); 866# else 867# if !1 868_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) 869 _GL_ARG_NONNULL ((1))); 870# endif 871_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); 872# endif 873_GL_CXXALIASWARN (chown); 874#elif defined GNULIB_POSIXCHECK 875# undef chown 876# if HAVE_RAW_DECL_CHOWN 877_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " 878 "doesn't treat a uid or gid of -1 on some systems - " 879 "use gnulib module chown for portability"); 880# endif 881#endif 882 883 884#if 1 885# if 0 886/* Automatically included by modules that need a replacement for close. */ 887# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 888# undef close 889# define close rpl_close 890# endif 891_GL_FUNCDECL_RPL (close, int, (int fd)); 892_GL_CXXALIAS_RPL (close, int, (int fd)); 893# elif defined _WIN32 && !defined __CYGWIN__ 894# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 895# undef close 896# define close _close 897# endif 898_GL_CXXALIAS_MDA (close, int, (int fd)); 899# else 900_GL_CXXALIAS_SYS (close, int, (int fd)); 901# endif 902_GL_CXXALIASWARN (close); 903#elif 0 904# undef close 905# define close close_used_without_requesting_gnulib_module_close 906#elif defined GNULIB_POSIXCHECK 907# undef close 908/* Assume close is always declared. */ 909_GL_WARN_ON_USE (close, "close does not portably work on sockets - " 910 "use gnulib module close for portability"); 911#elif 1 912/* On native Windows, map 'close' to '_close', so that -loldnames is not 913 required. In C++ with GNULIB_NAMESPACE, avoid differences between 914 platforms by defining GNULIB_NAMESPACE::close always. */ 915# if defined _WIN32 && !defined __CYGWIN__ 916# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 917# undef close 918# define close _close 919# endif 920_GL_CXXALIAS_MDA (close, int, (int fd)); 921# else 922_GL_CXXALIAS_SYS (close, int, (int fd)); 923# endif 924_GL_CXXALIASWARN (close); 925#endif 926 927 928#if 0 929# if 0 930# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 931# undef copy_file_range 932# define copy_file_range rpl_copy_file_range 933# endif 934_GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, 935 int ofd, off_t *opos, 936 size_t len, unsigned flags)); 937_GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, 938 int ofd, off_t *opos, 939 size_t len, unsigned flags)); 940# else 941# if !1 942_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 943 int ofd, off_t *opos, 944 size_t len, unsigned flags)); 945# endif 946_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 947 int ofd, off_t *opos, 948 size_t len, unsigned flags)); 949# endif 950_GL_CXXALIASWARN (copy_file_range); 951#elif defined GNULIB_POSIXCHECK 952# undef copy_file_range 953# if HAVE_RAW_DECL_COPY_FILE_RANGE 954_GL_WARN_ON_USE (copy_file_range, 955 "copy_file_range is unportable - " 956 "use gnulib module copy_file_range for portability"); 957# endif 958#endif 959 960 961#if 1 962# if 0 963# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 964# define dup rpl_dup 965# endif 966_GL_FUNCDECL_RPL (dup, int, (int oldfd)); 967_GL_CXXALIAS_RPL (dup, int, (int oldfd)); 968# elif defined _WIN32 && !defined __CYGWIN__ 969# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 970# undef dup 971# define dup _dup 972# endif 973_GL_CXXALIAS_MDA (dup, int, (int oldfd)); 974# else 975_GL_CXXALIAS_SYS (dup, int, (int oldfd)); 976# endif 977_GL_CXXALIASWARN (dup); 978#elif defined GNULIB_POSIXCHECK 979# undef dup 980# if HAVE_RAW_DECL_DUP 981_GL_WARN_ON_USE (dup, "dup is unportable - " 982 "use gnulib module dup for portability"); 983# endif 984#elif 1 985/* On native Windows, map 'dup' to '_dup', so that -loldnames is not 986 required. In C++ with GNULIB_NAMESPACE, avoid differences between 987 platforms by defining GNULIB_NAMESPACE::dup always. */ 988# if defined _WIN32 && !defined __CYGWIN__ 989# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 990# undef dup 991# define dup _dup 992# endif 993_GL_CXXALIAS_MDA (dup, int, (int oldfd)); 994# else 995_GL_CXXALIAS_SYS (dup, int, (int oldfd)); 996# endif 997_GL_CXXALIASWARN (dup); 998#endif 999 1000 1001#if 1 1002/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if 1003 NEWFD = OLDFD, otherwise close NEWFD first if it is open. 1004 Return newfd if successful, otherwise -1 and errno set. 1005 See the POSIX:2008 specification 1006 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */ 1007# if 0 1008# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1009# define dup2 rpl_dup2 1010# endif 1011_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); 1012_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); 1013# elif defined _WIN32 && !defined __CYGWIN__ 1014# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1015# undef dup2 1016# define dup2 _dup2 1017# endif 1018_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd)); 1019# else 1020_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); 1021# endif 1022_GL_CXXALIASWARN (dup2); 1023#elif defined GNULIB_POSIXCHECK 1024# undef dup2 1025# if HAVE_RAW_DECL_DUP2 1026_GL_WARN_ON_USE (dup2, "dup2 is unportable - " 1027 "use gnulib module dup2 for portability"); 1028# endif 1029#elif 1 1030/* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not 1031 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1032 platforms by defining GNULIB_NAMESPACE::dup2 always. */ 1033# if defined _WIN32 && !defined __CYGWIN__ 1034# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1035# undef dup2 1036# define dup2 _dup2 1037# endif 1038_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd)); 1039# else 1040_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); 1041# endif 1042_GL_CXXALIASWARN (dup2); 1043#endif 1044 1045 1046#if 0 1047/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the 1048 specified flags. 1049 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 1050 and O_TEXT, O_BINARY (defined in "binary-io.h"). 1051 Close NEWFD first if it is open. 1052 Return newfd if successful, otherwise -1 and errno set. 1053 See the Linux man page at 1054 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ 1055# if 1 1056# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1057# define dup3 rpl_dup3 1058# endif 1059_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); 1060_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); 1061# else 1062_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); 1063_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); 1064# endif 1065_GL_CXXALIASWARN (dup3); 1066#elif defined GNULIB_POSIXCHECK 1067# undef dup3 1068# if HAVE_RAW_DECL_DUP3 1069_GL_WARN_ON_USE (dup3, "dup3 is unportable - " 1070 "use gnulib module dup3 for portability"); 1071# endif 1072#endif 1073 1074 1075#if 1 1076# if defined __CYGWIN__ && !defined __i386__ 1077/* The 'environ' variable is defined in a DLL. Therefore its declaration needs 1078 the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it. 1079 This leads to a link error on 64-bit Cygwin when the option 1080 -Wl,--disable-auto-import is in use. */ 1081_GL_EXTERN_C __declspec(dllimport) char **environ; 1082# endif 1083# if !0 1084/* Set of environment variables and values. An array of strings of the form 1085 "VARIABLE=VALUE", terminated with a NULL. */ 1086# if defined __APPLE__ && defined __MACH__ 1087# include <TargetConditionals.h> 1088# if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR 1089# define _GL_USE_CRT_EXTERNS 1090# endif 1091# endif 1092# ifdef _GL_USE_CRT_EXTERNS 1093# include <crt_externs.h> 1094# define environ (*_NSGetEnviron ()) 1095# else 1096# ifdef __cplusplus 1097extern "C" { 1098# endif 1099extern char **environ; 1100# ifdef __cplusplus 1101} 1102# endif 1103# endif 1104# endif 1105#elif defined GNULIB_POSIXCHECK 1106# if HAVE_RAW_DECL_ENVIRON 1107_GL_UNISTD_INLINE char *** 1108_GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - " 1109 "use gnulib module environ for portability") 1110rpl_environ (void) 1111{ 1112 return &environ; 1113} 1114# undef environ 1115# define environ (*rpl_environ ()) 1116# endif 1117#endif 1118 1119 1120#if 0 1121/* Like access(), except that it uses the effective user id and group id of 1122 the current process. */ 1123# if !1 1124_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) 1125 _GL_ARG_NONNULL ((1))); 1126# endif 1127_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); 1128_GL_CXXALIASWARN (euidaccess); 1129# if defined GNULIB_POSIXCHECK 1130/* Like access(), this function is a security risk. */ 1131_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " 1132 "use the gnulib module faccessat instead"); 1133# endif 1134#elif defined GNULIB_POSIXCHECK 1135# undef euidaccess 1136# if HAVE_RAW_DECL_EUIDACCESS 1137_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " 1138 "use gnulib module euidaccess for portability"); 1139# endif 1140#endif 1141 1142 1143#if 0 1144# if 0 1145# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1146# undef execl 1147# define execl rpl_execl 1148# endif 1149_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) 1150 _GL_ARG_NONNULL ((1))); 1151_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); 1152# else 1153_GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...)); 1154# endif 1155_GL_CXXALIASWARN (execl); 1156#elif defined GNULIB_POSIXCHECK 1157# undef execl 1158# if HAVE_RAW_DECL_EXECL 1159_GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - " 1160 "use gnulib module execl for portability"); 1161# endif 1162#elif 1 1163/* On native Windows, map 'execl' to '_execl', so that -loldnames is not 1164 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1165 platforms by defining GNULIB_NAMESPACE::execl always. */ 1166# if defined _WIN32 && !defined __CYGWIN__ 1167# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1168# undef execl 1169# define execl _execl 1170# endif 1171_GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, ...)); 1172# else 1173_GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...)); 1174# endif 1175_GL_CXXALIASWARN (execl); 1176#endif 1177 1178#if 0 1179# if 0 1180# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1181# undef execle 1182# define execle rpl_execle 1183# endif 1184_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) 1185 _GL_ARG_NONNULL ((1))); 1186_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); 1187# else 1188_GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...)); 1189# endif 1190_GL_CXXALIASWARN (execle); 1191#elif defined GNULIB_POSIXCHECK 1192# undef execle 1193# if HAVE_RAW_DECL_EXECLE 1194_GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - " 1195 "use gnulib module execle for portability"); 1196# endif 1197#elif 1 1198/* On native Windows, map 'execle' to '_execle', so that -loldnames is not 1199 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1200 platforms by defining GNULIB_NAMESPACE::execle always. */ 1201# if defined _WIN32 && !defined __CYGWIN__ 1202# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1203# undef execle 1204# define execle _execle 1205# endif 1206_GL_CXXALIAS_MDA (execle, intptr_t, 1207 (const char *program, const char *arg, ...)); 1208# else 1209_GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...)); 1210# endif 1211_GL_CXXALIASWARN (execle); 1212#endif 1213 1214#if 0 1215# if 0 1216# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1217# undef execlp 1218# define execlp rpl_execlp 1219# endif 1220_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) 1221 _GL_ARG_NONNULL ((1))); 1222_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); 1223# else 1224_GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...)); 1225# endif 1226_GL_CXXALIASWARN (execlp); 1227#elif defined GNULIB_POSIXCHECK 1228# undef execlp 1229# if HAVE_RAW_DECL_EXECLP 1230_GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - " 1231 "use gnulib module execlp for portability"); 1232# endif 1233#elif 1 1234/* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not 1235 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1236 platforms by defining GNULIB_NAMESPACE::execlp always. */ 1237# if defined _WIN32 && !defined __CYGWIN__ 1238# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1239# undef execlp 1240# define execlp _execlp 1241# endif 1242_GL_CXXALIAS_MDA (execlp, intptr_t, 1243 (const char *program, const char *arg, ...)); 1244# else 1245_GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...)); 1246# endif 1247_GL_CXXALIASWARN (execlp); 1248#endif 1249 1250 1251#if 0 1252# if 0 1253# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1254# undef execv 1255# define execv rpl_execv 1256# endif 1257_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) 1258 _GL_ARG_NONNULL ((1, 2))); 1259_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); 1260# else 1261_GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv)); 1262# endif 1263_GL_CXXALIASWARN (execv); 1264#elif defined GNULIB_POSIXCHECK 1265# undef execv 1266# if HAVE_RAW_DECL_EXECV 1267_GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - " 1268 "use gnulib module execv for portability"); 1269# endif 1270#elif 1 1271/* On native Windows, map 'execv' to '_execv', so that -loldnames is not 1272 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1273 platforms by defining GNULIB_NAMESPACE::execv always. */ 1274# if defined _WIN32 && !defined __CYGWIN__ 1275# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1276# undef execv 1277# define execv _execv 1278# endif 1279_GL_CXXALIAS_MDA_CAST (execv, intptr_t, 1280 (const char *program, char * const *argv)); 1281# else 1282_GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv)); 1283# endif 1284_GL_CXXALIASWARN (execv); 1285#endif 1286 1287#if 0 1288# if 0 1289# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1290# undef execve 1291# define execve rpl_execve 1292# endif 1293_GL_FUNCDECL_RPL (execve, int, 1294 (const char *program, char * const *argv, char * const *env) 1295 _GL_ARG_NONNULL ((1, 2))); 1296_GL_CXXALIAS_RPL (execve, int, 1297 (const char *program, char * const *argv, char * const *env)); 1298# else 1299_GL_CXXALIAS_SYS (execve, int, 1300 (const char *program, char * const *argv, char * const *env)); 1301# endif 1302_GL_CXXALIASWARN (execve); 1303#elif defined GNULIB_POSIXCHECK 1304# undef execve 1305# if HAVE_RAW_DECL_EXECVE 1306_GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - " 1307 "use gnulib module execve for portability"); 1308# endif 1309#elif 1 1310/* On native Windows, map 'execve' to '_execve', so that -loldnames is not 1311 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1312 platforms by defining GNULIB_NAMESPACE::execve always. */ 1313# if defined _WIN32 && !defined __CYGWIN__ 1314# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1315# undef execve 1316# define execve _execve 1317# endif 1318_GL_CXXALIAS_MDA_CAST (execve, intptr_t, 1319 (const char *program, char * const *argv, 1320 char * const *env)); 1321# else 1322_GL_CXXALIAS_SYS (execve, int, 1323 (const char *program, char * const *argv, char * const *env)); 1324# endif 1325_GL_CXXALIASWARN (execve); 1326#endif 1327 1328#if 0 1329# if 0 1330# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1331# undef execvp 1332# define execvp rpl_execvp 1333# endif 1334_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) 1335 _GL_ARG_NONNULL ((1, 2))); 1336_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); 1337# else 1338_GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv)); 1339# endif 1340_GL_CXXALIASWARN (execvp); 1341#elif defined GNULIB_POSIXCHECK 1342# undef execvp 1343# if HAVE_RAW_DECL_EXECVP 1344_GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - " 1345 "use gnulib module execvp for portability"); 1346# endif 1347#elif 1 1348/* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not 1349 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1350 platforms by defining GNULIB_NAMESPACE::execvp always. */ 1351# if defined _WIN32 && !defined __CYGWIN__ 1352# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1353# undef execvp 1354# define execvp _execvp 1355# endif 1356_GL_CXXALIAS_MDA_CAST (execvp, intptr_t, 1357 (const char *program, char * const *argv)); 1358# else 1359_GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv)); 1360# endif 1361_GL_CXXALIASWARN (execvp); 1362#endif 1363 1364#if 0 1365# if 0 1366# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1367# undef execvpe 1368# define execvpe rpl_execvpe 1369# endif 1370_GL_FUNCDECL_RPL (execvpe, int, 1371 (const char *program, char * const *argv, char * const *env) 1372 _GL_ARG_NONNULL ((1, 2))); 1373_GL_CXXALIAS_RPL (execvpe, int, 1374 (const char *program, char * const *argv, char * const *env)); 1375# else 1376# if !1 1377_GL_FUNCDECL_SYS (execvpe, int, 1378 (const char *program, char * const *argv, char * const *env) 1379 _GL_ARG_NONNULL ((1, 2))); 1380# endif 1381_GL_CXXALIAS_SYS (execvpe, int, 1382 (const char *program, char * const *argv, char * const *env)); 1383# endif 1384_GL_CXXALIASWARN (execvpe); 1385#elif defined GNULIB_POSIXCHECK 1386# undef execvpe 1387# if HAVE_RAW_DECL_EXECVPE 1388_GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - " 1389 "use gnulib module execvpe for portability"); 1390# endif 1391#elif 1 1392/* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not 1393 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1394 platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have 1395 it. */ 1396# if defined _WIN32 && !defined __CYGWIN__ 1397# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1398# undef execvpe 1399# define execvpe _execvpe 1400# endif 1401_GL_CXXALIAS_MDA_CAST (execvpe, intptr_t, 1402 (const char *program, char * const *argv, 1403 char * const *env)); 1404# elif 1 1405# if !1 1406_GL_FUNCDECL_SYS (execvpe, int, 1407 (const char *program, char * const *argv, char * const *env) 1408 _GL_ARG_NONNULL ((1, 2))); 1409# endif 1410_GL_CXXALIAS_SYS (execvpe, int, 1411 (const char *program, char * const *argv, char * const *env)); 1412# endif 1413# if (defined _WIN32 && !defined __CYGWIN__) || 1 1414_GL_CXXALIASWARN (execvpe); 1415# endif 1416#endif 1417 1418 1419#if 0 1420# if 0 1421# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1422# undef faccessat 1423# define faccessat rpl_faccessat 1424# endif 1425_GL_FUNCDECL_RPL (faccessat, int, 1426 (int fd, char const *name, int mode, int flag) 1427 _GL_ARG_NONNULL ((2))); 1428_GL_CXXALIAS_RPL (faccessat, int, 1429 (int fd, char const *name, int mode, int flag)); 1430# else 1431# if !1 1432_GL_FUNCDECL_SYS (faccessat, int, 1433 (int fd, char const *file, int mode, int flag) 1434 _GL_ARG_NONNULL ((2))); 1435# endif 1436_GL_CXXALIAS_SYS (faccessat, int, 1437 (int fd, char const *file, int mode, int flag)); 1438# endif 1439_GL_CXXALIASWARN (faccessat); 1440#elif defined GNULIB_POSIXCHECK 1441# undef faccessat 1442# if HAVE_RAW_DECL_FACCESSAT 1443_GL_WARN_ON_USE (faccessat, "faccessat is not portable - " 1444 "use gnulib module faccessat for portability"); 1445# endif 1446#endif 1447 1448 1449#if 1 1450/* Change the process' current working directory to the directory on which 1451 the given file descriptor is open. 1452 Return 0 if successful, otherwise -1 and errno set. 1453 See the POSIX:2008 specification 1454 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ 1455# if ! 1 1456_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 1457 1458/* Gnulib internal hooks needed to maintain the fchdir metadata. */ 1459_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) 1460 _GL_ARG_NONNULL ((2)); 1461_GL_EXTERN_C void _gl_unregister_fd (int fd); 1462_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); 1463_GL_EXTERN_C const char *_gl_directory_name (int fd); 1464 1465# else 1466# if !1 1467_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 1468# endif 1469# endif 1470_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); 1471_GL_CXXALIASWARN (fchdir); 1472#elif defined GNULIB_POSIXCHECK 1473# undef fchdir 1474# if HAVE_RAW_DECL_FCHDIR 1475_GL_WARN_ON_USE (fchdir, "fchdir is unportable - " 1476 "use gnulib module fchdir for portability"); 1477# endif 1478#endif 1479 1480 1481#if 0 1482# if 0 1483# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1484# undef fchownat 1485# define fchownat rpl_fchownat 1486# endif 1487_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, 1488 uid_t owner, gid_t group, int flag) 1489 _GL_ARG_NONNULL ((2))); 1490_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, 1491 uid_t owner, gid_t group, int flag)); 1492# else 1493# if !1 1494_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, 1495 uid_t owner, gid_t group, int flag) 1496 _GL_ARG_NONNULL ((2))); 1497# endif 1498_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, 1499 uid_t owner, gid_t group, int flag)); 1500# endif 1501_GL_CXXALIASWARN (fchownat); 1502#elif defined GNULIB_POSIXCHECK 1503# undef fchownat 1504# if HAVE_RAW_DECL_FCHOWNAT 1505_GL_WARN_ON_USE (fchownat, "fchownat is not portable - " 1506 "use gnulib module fchownat for portability"); 1507# endif 1508#endif 1509 1510 1511#if 0 1512/* Synchronize changes to a file. 1513 Return 0 if successful, otherwise -1 and errno set. 1514 See POSIX:2008 specification 1515 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ 1516# if !1 || !1 1517_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); 1518# endif 1519_GL_CXXALIAS_SYS (fdatasync, int, (int fd)); 1520_GL_CXXALIASWARN (fdatasync); 1521#elif defined GNULIB_POSIXCHECK 1522# undef fdatasync 1523# if HAVE_RAW_DECL_FDATASYNC 1524_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " 1525 "use gnulib module fdatasync for portability"); 1526# endif 1527#endif 1528 1529 1530#if 0 1531/* Synchronize changes, including metadata, to a file. 1532 Return 0 if successful, otherwise -1 and errno set. 1533 See POSIX:2008 specification 1534 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ 1535# if !1 1536_GL_FUNCDECL_SYS (fsync, int, (int fd)); 1537# endif 1538_GL_CXXALIAS_SYS (fsync, int, (int fd)); 1539_GL_CXXALIASWARN (fsync); 1540#elif defined GNULIB_POSIXCHECK 1541# undef fsync 1542# if HAVE_RAW_DECL_FSYNC 1543_GL_WARN_ON_USE (fsync, "fsync is unportable - " 1544 "use gnulib module fsync for portability"); 1545# endif 1546#endif 1547 1548 1549#if 0 1550/* Change the size of the file to which FD is opened to become equal to LENGTH. 1551 Return 0 if successful, otherwise -1 and errno set. 1552 See the POSIX:2008 specification 1553 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ 1554# if 0 1555# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1556# undef ftruncate 1557# define ftruncate rpl_ftruncate 1558# endif 1559_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); 1560_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); 1561# else 1562# if !1 1563_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 1564# endif 1565_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 1566# endif 1567_GL_CXXALIASWARN (ftruncate); 1568#elif defined GNULIB_POSIXCHECK 1569# undef ftruncate 1570# if HAVE_RAW_DECL_FTRUNCATE 1571_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " 1572 "use gnulib module ftruncate for portability"); 1573# endif 1574#endif 1575 1576 1577#if 1 1578/* Get the name of the current working directory, and put it in SIZE bytes 1579 of BUF. 1580 Return BUF if successful, or NULL if the directory couldn't be determined 1581 or SIZE was too small. 1582 See the POSIX:2008 specification 1583 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. 1584 Additionally, the gnulib module 'getcwd' guarantees the following GNU 1585 extension: If BUF is NULL, an array is allocated with 'malloc'; the array 1586 is SIZE bytes long, unless SIZE == 0, in which case it is as big as 1587 necessary. */ 1588# if 1 1589# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1590# define getcwd rpl_getcwd 1591# endif 1592_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); 1593_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); 1594# elif defined _WIN32 && !defined __CYGWIN__ 1595# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1596# undef getcwd 1597# define getcwd _getcwd 1598# endif 1599_GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size)); 1600# else 1601/* Need to cast, because on mingw, the second parameter is 1602 int size. */ 1603_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); 1604# endif 1605_GL_CXXALIASWARN (getcwd); 1606#elif defined GNULIB_POSIXCHECK 1607# undef getcwd 1608# if HAVE_RAW_DECL_GETCWD 1609_GL_WARN_ON_USE (getcwd, "getcwd is unportable - " 1610 "use gnulib module getcwd for portability"); 1611# endif 1612#elif 1 1613/* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not 1614 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1615 platforms by defining GNULIB_NAMESPACE::getcwd always. */ 1616# if defined _WIN32 && !defined __CYGWIN__ 1617# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1618# undef getcwd 1619# define getcwd _getcwd 1620# endif 1621/* Need to cast, because on mingw, the second parameter is either 1622 'int size' or 'size_t size'. */ 1623_GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size)); 1624# else 1625_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); 1626# endif 1627_GL_CXXALIASWARN (getcwd); 1628#endif 1629 1630 1631#if 0 1632/* Return the NIS domain name of the machine. 1633 WARNING! The NIS domain name is unrelated to the fully qualified host name 1634 of the machine. It is also unrelated to email addresses. 1635 WARNING! The NIS domain name is usually the empty string or "(none)" when 1636 not using NIS. 1637 1638 Put up to LEN bytes of the NIS domain name into NAME. 1639 Null terminate it if the name is shorter than LEN. 1640 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. 1641 Return 0 if successful, otherwise set errno and return -1. */ 1642# if 0 1643# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1644# undef getdomainname 1645# define getdomainname rpl_getdomainname 1646# endif 1647_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) 1648 _GL_ARG_NONNULL ((1))); 1649_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); 1650# else 1651# if !1 1652_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) 1653 _GL_ARG_NONNULL ((1))); 1654# endif 1655_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); 1656# endif 1657_GL_CXXALIASWARN (getdomainname); 1658#elif defined GNULIB_POSIXCHECK 1659# undef getdomainname 1660# if HAVE_RAW_DECL_GETDOMAINNAME 1661_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " 1662 "use gnulib module getdomainname for portability"); 1663# endif 1664#endif 1665 1666 1667#if 1 1668/* Return the maximum number of file descriptors in the current process. 1669 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ 1670# if 0 1671# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1672# undef getdtablesize 1673# define getdtablesize rpl_getdtablesize 1674# endif 1675_GL_FUNCDECL_RPL (getdtablesize, int, (void)); 1676_GL_CXXALIAS_RPL (getdtablesize, int, (void)); 1677# else 1678# if !1 1679_GL_FUNCDECL_SYS (getdtablesize, int, (void)); 1680# endif 1681/* Need to cast, because on AIX, the parameter list is 1682 (...). */ 1683_GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void)); 1684# endif 1685_GL_CXXALIASWARN (getdtablesize); 1686#elif defined GNULIB_POSIXCHECK 1687# undef getdtablesize 1688# if HAVE_RAW_DECL_GETDTABLESIZE 1689_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " 1690 "use gnulib module getdtablesize for portability"); 1691# endif 1692#endif 1693 1694 1695#if 0 1696/* Fill a buffer with random bytes. */ 1697# if !1 1698_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); 1699# endif 1700_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); 1701_GL_CXXALIASWARN (getentropy); 1702#elif defined GNULIB_POSIXCHECK 1703# undef getentropy 1704# if HAVE_RAW_DECL_GETENTROPY 1705_GL_WARN_ON_USE (getentropy, "getentropy is unportable - " 1706 "use gnulib module getentropy for portability"); 1707# endif 1708#endif 1709 1710 1711#if 0 1712/* Return the supplemental groups that the current process belongs to. 1713 It is unspecified whether the effective group id is in the list. 1714 If N is 0, return the group count; otherwise, N describes how many 1715 entries are available in GROUPS. Return -1 and set errno if N is 1716 not 0 and not large enough. Fails with ENOSYS on some systems. */ 1717# if 0 1718# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1719# undef getgroups 1720# define getgroups rpl_getgroups 1721# endif 1722_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); 1723_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); 1724# else 1725# if !1 1726_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); 1727# endif 1728_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); 1729# endif 1730_GL_CXXALIASWARN (getgroups); 1731#elif defined GNULIB_POSIXCHECK 1732# undef getgroups 1733# if HAVE_RAW_DECL_GETGROUPS 1734_GL_WARN_ON_USE (getgroups, "getgroups is unportable - " 1735 "use gnulib module getgroups for portability"); 1736# endif 1737#endif 1738 1739 1740#if 0 1741/* Return the standard host name of the machine. 1742 WARNING! The host name may or may not be fully qualified. 1743 1744 Put up to LEN bytes of the host name into NAME. 1745 Null terminate it if the name is shorter than LEN. 1746 If the host name is longer than LEN, set errno = EINVAL and return -1. 1747 Return 0 if successful, otherwise set errno and return -1. */ 1748# if 0 1749# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1750# undef gethostname 1751# define gethostname rpl_gethostname 1752# endif 1753_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) 1754 _GL_ARG_NONNULL ((1))); 1755_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); 1756# else 1757# if !1 1758_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) 1759 _GL_ARG_NONNULL ((1))); 1760# endif 1761/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second 1762 parameter is 1763 int len. */ 1764_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); 1765# endif 1766_GL_CXXALIASWARN (gethostname); 1767#elif 0 1768# undef gethostname 1769# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname 1770#elif defined GNULIB_POSIXCHECK 1771# undef gethostname 1772# if HAVE_RAW_DECL_GETHOSTNAME 1773_GL_WARN_ON_USE (gethostname, "gethostname is unportable - " 1774 "use gnulib module gethostname for portability"); 1775# endif 1776#endif 1777 1778 1779#if 0 1780/* Returns the user's login name, or NULL if it cannot be found. Upon error, 1781 returns NULL with errno set. 1782 1783 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>. 1784 1785 Most programs don't need to use this function, because the information is 1786 available through environment variables: 1787 ${LOGNAME-$USER} on Unix platforms, 1788 $USERNAME on native Windows platforms. 1789 */ 1790# if !1 1791_GL_FUNCDECL_SYS (getlogin, char *, (void)); 1792# endif 1793_GL_CXXALIAS_SYS (getlogin, char *, (void)); 1794_GL_CXXALIASWARN (getlogin); 1795#elif defined GNULIB_POSIXCHECK 1796# undef getlogin 1797# if HAVE_RAW_DECL_GETLOGIN 1798_GL_WARN_ON_USE (getlogin, "getlogin is unportable - " 1799 "use gnulib module getlogin for portability"); 1800# endif 1801#endif 1802 1803 1804#if 1 1805/* Copies the user's login name to NAME. 1806 The array pointed to by NAME has room for SIZE bytes. 1807 1808 Returns 0 if successful. Upon error, an error number is returned, or -1 in 1809 the case that the login name cannot be found but no specific error is 1810 provided (this case is hopefully rare but is left open by the POSIX spec). 1811 1812 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>. 1813 1814 Most programs don't need to use this function, because the information is 1815 available through environment variables: 1816 ${LOGNAME-$USER} on Unix platforms, 1817 $USERNAME on native Windows platforms. 1818 */ 1819# if 0 1820# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1821# define getlogin_r rpl_getlogin_r 1822# endif 1823_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) 1824 _GL_ARG_NONNULL ((1))); 1825_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); 1826# else 1827# if !1 1828_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) 1829 _GL_ARG_NONNULL ((1))); 1830# endif 1831/* Need to cast, because on Solaris 10 systems, the second argument is 1832 int size. */ 1833_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); 1834# endif 1835_GL_CXXALIASWARN (getlogin_r); 1836#elif defined GNULIB_POSIXCHECK 1837# undef getlogin_r 1838# if HAVE_RAW_DECL_GETLOGIN_R 1839_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " 1840 "use gnulib module getlogin_r for portability"); 1841# endif 1842#endif 1843 1844 1845#if 0 1846# if 0 1847# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1848# define getpagesize rpl_getpagesize 1849# endif 1850_GL_FUNCDECL_RPL (getpagesize, int, (void)); 1851_GL_CXXALIAS_RPL (getpagesize, int, (void)); 1852# else 1853/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if 1854 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ 1855# if defined __hpux 1856_GL_FUNCDECL_SYS (getpagesize, int, (void)); 1857# endif 1858# if !1 1859# if !defined getpagesize 1860/* This is for POSIX systems. */ 1861# if !defined _gl_getpagesize && defined _SC_PAGESIZE 1862# if ! (defined __VMS && __VMS_VER < 70000000) 1863# define _gl_getpagesize() sysconf (_SC_PAGESIZE) 1864# endif 1865# endif 1866/* This is for older VMS. */ 1867# if !defined _gl_getpagesize && defined __VMS 1868# ifdef __ALPHA 1869# define _gl_getpagesize() 8192 1870# else 1871# define _gl_getpagesize() 512 1872# endif 1873# endif 1874/* This is for BeOS. */ 1875# if !defined _gl_getpagesize && 0 1876# include <OS.h> 1877# if defined B_PAGE_SIZE 1878# define _gl_getpagesize() B_PAGE_SIZE 1879# endif 1880# endif 1881/* This is for AmigaOS4.0. */ 1882# if !defined _gl_getpagesize && defined __amigaos4__ 1883# define _gl_getpagesize() 2048 1884# endif 1885/* This is for older Unix systems. */ 1886# if !defined _gl_getpagesize && 0 1887# include <sys/param.h> 1888# ifdef EXEC_PAGESIZE 1889# define _gl_getpagesize() EXEC_PAGESIZE 1890# else 1891# ifdef NBPG 1892# ifndef CLSIZE 1893# define CLSIZE 1 1894# endif 1895# define _gl_getpagesize() (NBPG * CLSIZE) 1896# else 1897# ifdef NBPC 1898# define _gl_getpagesize() NBPC 1899# endif 1900# endif 1901# endif 1902# endif 1903# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1904# define getpagesize() _gl_getpagesize () 1905# else 1906# if !GNULIB_defined_getpagesize_function 1907_GL_UNISTD_INLINE int 1908getpagesize () 1909{ 1910 return _gl_getpagesize (); 1911} 1912# define GNULIB_defined_getpagesize_function 1 1913# endif 1914# endif 1915# endif 1916# endif 1917/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ 1918_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); 1919# endif 1920# if 1 1921_GL_CXXALIASWARN (getpagesize); 1922# endif 1923#elif defined GNULIB_POSIXCHECK 1924# undef getpagesize 1925# if HAVE_RAW_DECL_GETPAGESIZE 1926_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " 1927 "use gnulib module getpagesize for portability"); 1928# endif 1929#endif 1930 1931 1932#if 0 1933/* Function getpass() from module 'getpass': 1934 Read a password from /dev/tty or stdin. 1935 Function getpass() from module 'getpass-gnu': 1936 Read a password of arbitrary length from /dev/tty or stdin. */ 1937# if (0 && 0) \ 1938 || (0 && 0) 1939# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1940# undef getpass 1941# define getpass rpl_getpass 1942# endif 1943_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) 1944 _GL_ARG_NONNULL ((1))); 1945_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); 1946# else 1947# if !1 1948_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) 1949 _GL_ARG_NONNULL ((1))); 1950# endif 1951_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); 1952# endif 1953_GL_CXXALIASWARN (getpass); 1954#elif defined GNULIB_POSIXCHECK 1955# undef getpass 1956# if HAVE_RAW_DECL_GETPASS 1957_GL_WARN_ON_USE (getpass, "getpass is unportable - " 1958 "use gnulib module getpass or getpass-gnu for portability"); 1959# endif 1960#endif 1961 1962 1963#if 1 1964/* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not 1965 required. In C++ with GNULIB_NAMESPACE, avoid differences between 1966 platforms by defining GNULIB_NAMESPACE::getpid always. */ 1967# if defined _WIN32 && !defined __CYGWIN__ 1968# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1969# undef getpid 1970# define getpid _getpid 1971# endif 1972_GL_CXXALIAS_MDA (getpid, int, (void)); 1973# else 1974_GL_CXXALIAS_SYS (getpid, pid_t, (void)); 1975# endif 1976_GL_CXXALIASWARN (getpid); 1977#endif 1978 1979 1980#if 0 1981/* Return the next valid login shell on the system, or NULL when the end of 1982 the list has been reached. */ 1983# if !1 1984_GL_FUNCDECL_SYS (getusershell, char *, (void)); 1985# endif 1986_GL_CXXALIAS_SYS (getusershell, char *, (void)); 1987_GL_CXXALIASWARN (getusershell); 1988#elif defined GNULIB_POSIXCHECK 1989# undef getusershell 1990# if HAVE_RAW_DECL_GETUSERSHELL 1991_GL_WARN_ON_USE (getusershell, "getusershell is unportable - " 1992 "use gnulib module getusershell for portability"); 1993# endif 1994#endif 1995 1996#if 0 1997/* Rewind to pointer that is advanced at each getusershell() call. */ 1998# if !1 1999_GL_FUNCDECL_SYS (setusershell, void, (void)); 2000# endif 2001_GL_CXXALIAS_SYS (setusershell, void, (void)); 2002_GL_CXXALIASWARN (setusershell); 2003#elif defined GNULIB_POSIXCHECK 2004# undef setusershell 2005# if HAVE_RAW_DECL_SETUSERSHELL 2006_GL_WARN_ON_USE (setusershell, "setusershell is unportable - " 2007 "use gnulib module getusershell for portability"); 2008# endif 2009#endif 2010 2011#if 0 2012/* Free the pointer that is advanced at each getusershell() call and 2013 associated resources. */ 2014# if !1 2015_GL_FUNCDECL_SYS (endusershell, void, (void)); 2016# endif 2017_GL_CXXALIAS_SYS (endusershell, void, (void)); 2018_GL_CXXALIASWARN (endusershell); 2019#elif defined GNULIB_POSIXCHECK 2020# undef endusershell 2021# if HAVE_RAW_DECL_ENDUSERSHELL 2022_GL_WARN_ON_USE (endusershell, "endusershell is unportable - " 2023 "use gnulib module getusershell for portability"); 2024# endif 2025#endif 2026 2027 2028#if 0 2029/* Determine whether group id is in calling user's group list. */ 2030# if !1 2031_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); 2032# endif 2033_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); 2034_GL_CXXALIASWARN (group_member); 2035#elif defined GNULIB_POSIXCHECK 2036# undef group_member 2037# if HAVE_RAW_DECL_GROUP_MEMBER 2038_GL_WARN_ON_USE (group_member, "group_member is unportable - " 2039 "use gnulib module group-member for portability"); 2040# endif 2041#endif 2042 2043 2044#if 0 2045# if 0 2046# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2047# undef isatty 2048# define isatty rpl_isatty 2049# endif 2050# define GNULIB_defined_isatty 1 2051_GL_FUNCDECL_RPL (isatty, int, (int fd)); 2052_GL_CXXALIAS_RPL (isatty, int, (int fd)); 2053# elif defined _WIN32 && !defined __CYGWIN__ 2054# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2055# undef isatty 2056# define isatty _isatty 2057# endif 2058_GL_CXXALIAS_MDA (isatty, int, (int fd)); 2059# else 2060_GL_CXXALIAS_SYS (isatty, int, (int fd)); 2061# endif 2062_GL_CXXALIASWARN (isatty); 2063#elif defined GNULIB_POSIXCHECK 2064# undef isatty 2065# if HAVE_RAW_DECL_ISATTY 2066_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " 2067 "use gnulib module isatty for portability"); 2068# endif 2069#elif 1 2070/* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not 2071 required. In C++ with GNULIB_NAMESPACE, avoid differences between 2072 platforms by defining GNULIB_NAMESPACE::isatty always. */ 2073# if defined _WIN32 && !defined __CYGWIN__ 2074# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2075# undef isatty 2076# define isatty _isatty 2077# endif 2078_GL_CXXALIAS_MDA (isatty, int, (int fd)); 2079# else 2080_GL_CXXALIAS_SYS (isatty, int, (int fd)); 2081# endif 2082_GL_CXXALIASWARN (isatty); 2083#endif 2084 2085 2086#if 0 2087/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 2088 to GID (if GID is not -1). Do not follow symbolic links. 2089 Return 0 if successful, otherwise -1 and errno set. 2090 See the POSIX:2008 specification 2091 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */ 2092# if 0 2093# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2094# undef lchown 2095# define lchown rpl_lchown 2096# endif 2097_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) 2098 _GL_ARG_NONNULL ((1))); 2099_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); 2100# else 2101# if !1 2102_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) 2103 _GL_ARG_NONNULL ((1))); 2104# endif 2105_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); 2106# endif 2107_GL_CXXALIASWARN (lchown); 2108#elif defined GNULIB_POSIXCHECK 2109# undef lchown 2110# if HAVE_RAW_DECL_LCHOWN 2111_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " 2112 "use gnulib module lchown for portability"); 2113# endif 2114#endif 2115 2116 2117#if 0 2118/* Create a new hard link for an existing file. 2119 Return 0 if successful, otherwise -1 and errno set. 2120 See POSIX:2008 specification 2121 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */ 2122# if 0 2123# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2124# define link rpl_link 2125# endif 2126_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) 2127 _GL_ARG_NONNULL ((1, 2))); 2128_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); 2129# else 2130# if !1 2131_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) 2132 _GL_ARG_NONNULL ((1, 2))); 2133# endif 2134_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); 2135# endif 2136_GL_CXXALIASWARN (link); 2137#elif defined GNULIB_POSIXCHECK 2138# undef link 2139# if HAVE_RAW_DECL_LINK 2140_GL_WARN_ON_USE (link, "link is unportable - " 2141 "use gnulib module link for portability"); 2142# endif 2143#endif 2144 2145 2146#if 0 2147/* Create a new hard link for an existing file, relative to two 2148 directories. FLAG controls whether symlinks are followed. 2149 Return 0 if successful, otherwise -1 and errno set. */ 2150# if 0 2151# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2152# undef linkat 2153# define linkat rpl_linkat 2154# endif 2155_GL_FUNCDECL_RPL (linkat, int, 2156 (int fd1, const char *path1, int fd2, const char *path2, 2157 int flag) 2158 _GL_ARG_NONNULL ((2, 4))); 2159_GL_CXXALIAS_RPL (linkat, int, 2160 (int fd1, const char *path1, int fd2, const char *path2, 2161 int flag)); 2162# else 2163# if !1 2164_GL_FUNCDECL_SYS (linkat, int, 2165 (int fd1, const char *path1, int fd2, const char *path2, 2166 int flag) 2167 _GL_ARG_NONNULL ((2, 4))); 2168# endif 2169_GL_CXXALIAS_SYS (linkat, int, 2170 (int fd1, const char *path1, int fd2, const char *path2, 2171 int flag)); 2172# endif 2173_GL_CXXALIASWARN (linkat); 2174#elif defined GNULIB_POSIXCHECK 2175# undef linkat 2176# if HAVE_RAW_DECL_LINKAT 2177_GL_WARN_ON_USE (linkat, "linkat is unportable - " 2178 "use gnulib module linkat for portability"); 2179# endif 2180#endif 2181 2182 2183#if 0 2184/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. 2185 Return the new offset if successful, otherwise -1 and errno set. 2186 See the POSIX:2008 specification 2187 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */ 2188# if 0 2189# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2190# define lseek rpl_lseek 2191# endif 2192_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 2193_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 2194# elif defined _WIN32 && !defined __CYGWIN__ 2195# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2196# undef lseek 2197# define lseek _lseek 2198# endif 2199_GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence)); 2200# else 2201_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); 2202# endif 2203_GL_CXXALIASWARN (lseek); 2204#elif defined GNULIB_POSIXCHECK 2205# undef lseek 2206# if HAVE_RAW_DECL_LSEEK 2207_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " 2208 "systems - use gnulib module lseek for portability"); 2209# endif 2210#elif 1 2211/* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not 2212 required. In C++ with GNULIB_NAMESPACE, avoid differences between 2213 platforms by defining GNULIB_NAMESPACE::lseek always. */ 2214# if defined _WIN32 && !defined __CYGWIN__ 2215# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2216# undef lseek 2217# define lseek _lseek 2218# endif 2219_GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence)); 2220# else 2221_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); 2222# endif 2223_GL_CXXALIASWARN (lseek); 2224#endif 2225 2226 2227#if 1 2228/* Create a pipe, defaulting to O_BINARY mode. 2229 Store the read-end as fd[0] and the write-end as fd[1]. 2230 Return 0 upon success, or -1 with errno set upon failure. */ 2231# if !1 2232_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); 2233# endif 2234_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); 2235_GL_CXXALIASWARN (pipe); 2236#elif defined GNULIB_POSIXCHECK 2237# undef pipe 2238# if HAVE_RAW_DECL_PIPE 2239_GL_WARN_ON_USE (pipe, "pipe is unportable - " 2240 "use gnulib module pipe-posix for portability"); 2241# endif 2242#endif 2243 2244 2245#if 0 2246/* Create a pipe, applying the given flags when opening the read-end of the 2247 pipe and the write-end of the pipe. 2248 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 2249 and O_TEXT, O_BINARY (defined in "binary-io.h"). 2250 Store the read-end as fd[0] and the write-end as fd[1]. 2251 Return 0 upon success, or -1 with errno set upon failure. 2252 See also the Linux man page at 2253 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ 2254# if 1 2255# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2256# define pipe2 rpl_pipe2 2257# endif 2258_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 2259_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); 2260# else 2261_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 2262_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); 2263# endif 2264_GL_CXXALIASWARN (pipe2); 2265#elif defined GNULIB_POSIXCHECK 2266# undef pipe2 2267# if HAVE_RAW_DECL_PIPE2 2268_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " 2269 "use gnulib module pipe2 for portability"); 2270# endif 2271#endif 2272 2273 2274#if 0 2275/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. 2276 Return the number of bytes placed into BUF if successful, otherwise 2277 set errno and return -1. 0 indicates EOF. 2278 See the POSIX:2008 specification 2279 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */ 2280# if 0 2281# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2282# undef pread 2283# define pread rpl_pread 2284# endif 2285_GL_FUNCDECL_RPL (pread, ssize_t, 2286 (int fd, void *buf, size_t bufsize, off_t offset) 2287 _GL_ARG_NONNULL ((2))); 2288_GL_CXXALIAS_RPL (pread, ssize_t, 2289 (int fd, void *buf, size_t bufsize, off_t offset)); 2290# else 2291# if !1 2292_GL_FUNCDECL_SYS (pread, ssize_t, 2293 (int fd, void *buf, size_t bufsize, off_t offset) 2294 _GL_ARG_NONNULL ((2))); 2295# endif 2296_GL_CXXALIAS_SYS (pread, ssize_t, 2297 (int fd, void *buf, size_t bufsize, off_t offset)); 2298# endif 2299_GL_CXXALIASWARN (pread); 2300#elif defined GNULIB_POSIXCHECK 2301# undef pread 2302# if HAVE_RAW_DECL_PREAD 2303_GL_WARN_ON_USE (pread, "pread is unportable - " 2304 "use gnulib module pread for portability"); 2305# endif 2306#endif 2307 2308 2309#if 0 2310/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. 2311 Return the number of bytes written if successful, otherwise 2312 set errno and return -1. 0 indicates nothing written. See the 2313 POSIX:2008 specification 2314 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */ 2315# if 0 2316# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2317# undef pwrite 2318# define pwrite rpl_pwrite 2319# endif 2320_GL_FUNCDECL_RPL (pwrite, ssize_t, 2321 (int fd, const void *buf, size_t bufsize, off_t offset) 2322 _GL_ARG_NONNULL ((2))); 2323_GL_CXXALIAS_RPL (pwrite, ssize_t, 2324 (int fd, const void *buf, size_t bufsize, off_t offset)); 2325# else 2326# if !1 2327_GL_FUNCDECL_SYS (pwrite, ssize_t, 2328 (int fd, const void *buf, size_t bufsize, off_t offset) 2329 _GL_ARG_NONNULL ((2))); 2330# endif 2331_GL_CXXALIAS_SYS (pwrite, ssize_t, 2332 (int fd, const void *buf, size_t bufsize, off_t offset)); 2333# endif 2334_GL_CXXALIASWARN (pwrite); 2335#elif defined GNULIB_POSIXCHECK 2336# undef pwrite 2337# if HAVE_RAW_DECL_PWRITE 2338_GL_WARN_ON_USE (pwrite, "pwrite is unportable - " 2339 "use gnulib module pwrite for portability"); 2340# endif 2341#endif 2342 2343 2344#if 0 2345/* Read up to COUNT bytes from file descriptor FD into the buffer starting 2346 at BUF. See the POSIX:2008 specification 2347 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */ 2348# if 0 2349# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2350# undef read 2351# define read rpl_read 2352# endif 2353_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 2354 _GL_ARG_NONNULL ((2))); 2355_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); 2356# elif defined _WIN32 && !defined __CYGWIN__ 2357# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2358# undef read 2359# define read _read 2360# endif 2361_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count)); 2362# else 2363_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); 2364# endif 2365_GL_CXXALIASWARN (read); 2366#elif 1 2367/* On native Windows, map 'read' to '_read', so that -loldnames is not 2368 required. In C++ with GNULIB_NAMESPACE, avoid differences between 2369 platforms by defining GNULIB_NAMESPACE::read always. */ 2370# if defined _WIN32 && !defined __CYGWIN__ 2371# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2372# undef read 2373# define read _read 2374# endif 2375# ifdef __MINGW32__ 2376_GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count)); 2377# else 2378_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count)); 2379# endif 2380# else 2381_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); 2382# endif 2383_GL_CXXALIASWARN (read); 2384#endif 2385 2386 2387#if 1 2388/* Read the contents of the symbolic link FILE and place the first BUFSIZE 2389 bytes of it into BUF. Return the number of bytes placed into BUF if 2390 successful, otherwise -1 and errno set. 2391 See the POSIX:2008 specification 2392 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ 2393# if 1 2394# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2395# define readlink rpl_readlink 2396# endif 2397_GL_FUNCDECL_RPL (readlink, ssize_t, 2398 (const char *restrict file, 2399 char *restrict buf, size_t bufsize) 2400 _GL_ARG_NONNULL ((1, 2))); 2401_GL_CXXALIAS_RPL (readlink, ssize_t, 2402 (const char *restrict file, 2403 char *restrict buf, size_t bufsize)); 2404# else 2405# if !1 2406_GL_FUNCDECL_SYS (readlink, ssize_t, 2407 (const char *restrict file, 2408 char *restrict buf, size_t bufsize) 2409 _GL_ARG_NONNULL ((1, 2))); 2410# endif 2411_GL_CXXALIAS_SYS (readlink, ssize_t, 2412 (const char *restrict file, 2413 char *restrict buf, size_t bufsize)); 2414# endif 2415_GL_CXXALIASWARN (readlink); 2416#elif defined GNULIB_POSIXCHECK 2417# undef readlink 2418# if HAVE_RAW_DECL_READLINK 2419_GL_WARN_ON_USE (readlink, "readlink is unportable - " 2420 "use gnulib module readlink for portability"); 2421# endif 2422#endif 2423 2424 2425#if 0 2426# if 0 2427# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2428# define readlinkat rpl_readlinkat 2429# endif 2430_GL_FUNCDECL_RPL (readlinkat, ssize_t, 2431 (int fd, char const *restrict file, 2432 char *restrict buf, size_t len) 2433 _GL_ARG_NONNULL ((2, 3))); 2434_GL_CXXALIAS_RPL (readlinkat, ssize_t, 2435 (int fd, char const *restrict file, 2436 char *restrict buf, size_t len)); 2437# else 2438# if !1 2439_GL_FUNCDECL_SYS (readlinkat, ssize_t, 2440 (int fd, char const *restrict file, 2441 char *restrict buf, size_t len) 2442 _GL_ARG_NONNULL ((2, 3))); 2443# endif 2444_GL_CXXALIAS_SYS (readlinkat, ssize_t, 2445 (int fd, char const *restrict file, 2446 char *restrict buf, size_t len)); 2447# endif 2448_GL_CXXALIASWARN (readlinkat); 2449#elif defined GNULIB_POSIXCHECK 2450# undef readlinkat 2451# if HAVE_RAW_DECL_READLINKAT 2452_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " 2453 "use gnulib module readlinkat for portability"); 2454# endif 2455#endif 2456 2457 2458#if 1 2459/* Remove the directory DIR. */ 2460# if 1 2461# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2462# define rmdir rpl_rmdir 2463# endif 2464_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); 2465_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); 2466# elif defined _WIN32 && !defined __CYGWIN__ 2467# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2468# undef rmdir 2469# define rmdir _rmdir 2470# endif 2471_GL_CXXALIAS_MDA (rmdir, int, (char const *name)); 2472# else 2473_GL_CXXALIAS_SYS (rmdir, int, (char const *name)); 2474# endif 2475_GL_CXXALIASWARN (rmdir); 2476#elif defined GNULIB_POSIXCHECK 2477# undef rmdir 2478# if HAVE_RAW_DECL_RMDIR 2479_GL_WARN_ON_USE (rmdir, "rmdir is unportable - " 2480 "use gnulib module rmdir for portability"); 2481# endif 2482#elif 1 2483/* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not 2484 required. In C++ with GNULIB_NAMESPACE, avoid differences between 2485 platforms by defining GNULIB_NAMESPACE::rmdir always. */ 2486# if defined _WIN32 && !defined __CYGWIN__ 2487# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2488# undef rmdir 2489# define rmdir _rmdir 2490# endif 2491_GL_CXXALIAS_MDA (rmdir, int, (char const *name)); 2492# else 2493_GL_CXXALIAS_SYS (rmdir, int, (char const *name)); 2494# endif 2495_GL_CXXALIASWARN (rmdir); 2496#endif 2497 2498 2499#if 0 2500/* Set the host name of the machine. 2501 The host name may or may not be fully qualified. 2502 2503 Put LEN bytes of NAME into the host name. 2504 Return 0 if successful, otherwise, set errno and return -1. 2505 2506 Platforms with no ability to set the hostname return -1 and set 2507 errno = ENOSYS. */ 2508# if !1 || !1 2509_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) 2510 _GL_ARG_NONNULL ((1))); 2511# endif 2512/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 2513 and FreeBSD 6.4 the second parameter is int. On Solaris 11 2514 2011-10, the first parameter is not const. */ 2515_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); 2516_GL_CXXALIASWARN (sethostname); 2517#elif defined GNULIB_POSIXCHECK 2518# undef sethostname 2519# if HAVE_RAW_DECL_SETHOSTNAME 2520_GL_WARN_ON_USE (sethostname, "sethostname is unportable - " 2521 "use gnulib module sethostname for portability"); 2522# endif 2523#endif 2524 2525 2526#if 0 2527/* Pause the execution of the current thread for N seconds. 2528 Returns the number of seconds left to sleep. 2529 See the POSIX:2008 specification 2530 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */ 2531# if 0 2532# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2533# undef sleep 2534# define sleep rpl_sleep 2535# endif 2536_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); 2537_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); 2538# else 2539# if !1 2540_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); 2541# endif 2542_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); 2543# endif 2544_GL_CXXALIASWARN (sleep); 2545#elif defined GNULIB_POSIXCHECK 2546# undef sleep 2547# if HAVE_RAW_DECL_SLEEP 2548_GL_WARN_ON_USE (sleep, "sleep is unportable - " 2549 "use gnulib module sleep for portability"); 2550# endif 2551#endif 2552 2553 2554#if 1 2555/* On native Windows, map 'swab' to '_swab', so that -loldnames is not 2556 required. In C++ with GNULIB_NAMESPACE, avoid differences between 2557 platforms by defining GNULIB_NAMESPACE::swab always. */ 2558# if defined _WIN32 && !defined __CYGWIN__ 2559# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2560# undef swab 2561# define swab _swab 2562# endif 2563/* Need to cast, because in old mingw the arguments are 2564 (const char *from, char *to, size_t n). */ 2565_GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n)); 2566# else 2567# if defined __hpux /* HP-UX */ 2568_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n)); 2569# elif defined __sun && !defined _XPG4 /* Solaris */ 2570_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n)); 2571# else 2572_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n)); 2573# endif 2574# endif 2575_GL_CXXALIASWARN (swab); 2576#endif 2577 2578 2579#if 0 2580# if 0 2581# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2582# undef symlink 2583# define symlink rpl_symlink 2584# endif 2585_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) 2586 _GL_ARG_NONNULL ((1, 2))); 2587_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); 2588# else 2589# if !1 2590_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) 2591 _GL_ARG_NONNULL ((1, 2))); 2592# endif 2593_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); 2594# endif 2595_GL_CXXALIASWARN (symlink); 2596#elif defined GNULIB_POSIXCHECK 2597# undef symlink 2598# if HAVE_RAW_DECL_SYMLINK 2599_GL_WARN_ON_USE (symlink, "symlink is not portable - " 2600 "use gnulib module symlink for portability"); 2601# endif 2602#endif 2603 2604 2605#if 0 2606# if 0 2607# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2608# undef symlinkat 2609# define symlinkat rpl_symlinkat 2610# endif 2611_GL_FUNCDECL_RPL (symlinkat, int, 2612 (char const *contents, int fd, char const *file) 2613 _GL_ARG_NONNULL ((1, 3))); 2614_GL_CXXALIAS_RPL (symlinkat, int, 2615 (char const *contents, int fd, char const *file)); 2616# else 2617# if !1 2618_GL_FUNCDECL_SYS (symlinkat, int, 2619 (char const *contents, int fd, char const *file) 2620 _GL_ARG_NONNULL ((1, 3))); 2621# endif 2622_GL_CXXALIAS_SYS (symlinkat, int, 2623 (char const *contents, int fd, char const *file)); 2624# endif 2625_GL_CXXALIASWARN (symlinkat); 2626#elif defined GNULIB_POSIXCHECK 2627# undef symlinkat 2628# if HAVE_RAW_DECL_SYMLINKAT 2629_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " 2630 "use gnulib module symlinkat for portability"); 2631# endif 2632#endif 2633 2634 2635#if 0 2636/* Change the size of the file designated by FILENAME to become equal to LENGTH. 2637 Return 0 if successful, otherwise -1 and errno set. 2638 See the POSIX:2008 specification 2639 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */ 2640# if 0 2641# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2642# undef truncate 2643# define truncate rpl_truncate 2644# endif 2645_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) 2646 _GL_ARG_NONNULL ((1))); 2647_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); 2648# else 2649# if !1 2650_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) 2651 _GL_ARG_NONNULL ((1))); 2652# endif 2653_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); 2654# endif 2655_GL_CXXALIASWARN (truncate); 2656#elif defined GNULIB_POSIXCHECK 2657# undef truncate 2658# if HAVE_RAW_DECL_TRUNCATE 2659_GL_WARN_ON_USE (truncate, "truncate is unportable - " 2660 "use gnulib module truncate for portability"); 2661# endif 2662#endif 2663 2664 2665#if 0 2666/* Store at most BUFLEN characters of the pathname of the terminal FD is 2667 open on in BUF. Return 0 on success, otherwise an error number. */ 2668# if 0 2669# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2670# undef ttyname_r 2671# define ttyname_r rpl_ttyname_r 2672# endif 2673_GL_FUNCDECL_RPL (ttyname_r, int, 2674 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2675_GL_CXXALIAS_RPL (ttyname_r, int, 2676 (int fd, char *buf, size_t buflen)); 2677# else 2678# if !1 2679_GL_FUNCDECL_SYS (ttyname_r, int, 2680 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2681# endif 2682_GL_CXXALIAS_SYS (ttyname_r, int, 2683 (int fd, char *buf, size_t buflen)); 2684# endif 2685_GL_CXXALIASWARN (ttyname_r); 2686#elif defined GNULIB_POSIXCHECK 2687# undef ttyname_r 2688# if HAVE_RAW_DECL_TTYNAME_R 2689_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " 2690 "use gnulib module ttyname_r for portability"); 2691# endif 2692#endif 2693 2694 2695#if 0 2696# if 0 2697# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2698# undef unlink 2699# define unlink rpl_unlink 2700# endif 2701_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); 2702_GL_CXXALIAS_RPL (unlink, int, (char const *file)); 2703# elif defined _WIN32 && !defined __CYGWIN__ 2704# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2705# undef unlink 2706# define unlink _unlink 2707# endif 2708_GL_CXXALIAS_MDA (unlink, int, (char const *file)); 2709# else 2710_GL_CXXALIAS_SYS (unlink, int, (char const *file)); 2711# endif 2712_GL_CXXALIASWARN (unlink); 2713#elif defined GNULIB_POSIXCHECK 2714# undef unlink 2715# if HAVE_RAW_DECL_UNLINK 2716_GL_WARN_ON_USE (unlink, "unlink is not portable - " 2717 "use gnulib module unlink for portability"); 2718# endif 2719#elif 1 2720/* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not 2721 required. In C++ with GNULIB_NAMESPACE, avoid differences between 2722 platforms by defining GNULIB_NAMESPACE::unlink always. */ 2723# if defined _WIN32 && !defined __CYGWIN__ 2724# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2725# undef unlink 2726# define unlink _unlink 2727# endif 2728_GL_CXXALIAS_MDA (unlink, int, (char const *file)); 2729# else 2730_GL_CXXALIAS_SYS (unlink, int, (char const *file)); 2731# endif 2732_GL_CXXALIASWARN (unlink); 2733#endif 2734 2735 2736#if 0 2737# if 0 2738# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2739# undef unlinkat 2740# define unlinkat rpl_unlinkat 2741# endif 2742_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) 2743 _GL_ARG_NONNULL ((2))); 2744_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); 2745# else 2746# if !1 2747_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) 2748 _GL_ARG_NONNULL ((2))); 2749# endif 2750_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); 2751# endif 2752_GL_CXXALIASWARN (unlinkat); 2753#elif defined GNULIB_POSIXCHECK 2754# undef unlinkat 2755# if HAVE_RAW_DECL_UNLINKAT 2756_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " 2757 "use gnulib module unlinkat for portability"); 2758# endif 2759#endif 2760 2761 2762#if 0 2763/* Pause the execution of the current thread for N microseconds. 2764 Returns 0 on completion, or -1 on range error. 2765 See the POSIX:2001 specification 2766 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ 2767# if 0 2768# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2769# undef usleep 2770# define usleep rpl_usleep 2771# endif 2772_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); 2773_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); 2774# else 2775# if !1 2776_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); 2777# endif 2778/* Need to cast, because on Haiku, the first parameter is 2779 unsigned int n. */ 2780_GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n)); 2781# endif 2782_GL_CXXALIASWARN (usleep); 2783#elif defined GNULIB_POSIXCHECK 2784# undef usleep 2785# if HAVE_RAW_DECL_USLEEP 2786_GL_WARN_ON_USE (usleep, "usleep is unportable - " 2787 "use gnulib module usleep for portability"); 2788# endif 2789#endif 2790 2791 2792#if 0 2793/* Write up to COUNT bytes starting at BUF to file descriptor FD. 2794 See the POSIX:2008 specification 2795 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */ 2796# if 0 2797# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2798# undef write 2799# define write rpl_write 2800# endif 2801_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 2802 _GL_ARG_NONNULL ((2))); 2803_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); 2804# elif defined _WIN32 && !defined __CYGWIN__ 2805# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2806# undef write 2807# define write _write 2808# endif 2809_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count)); 2810# else 2811_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2812# endif 2813_GL_CXXALIASWARN (write); 2814#elif 1 2815/* On native Windows, map 'write' to '_write', so that -loldnames is not 2816 required. In C++ with GNULIB_NAMESPACE, avoid differences between 2817 platforms by defining GNULIB_NAMESPACE::write always. */ 2818# if defined _WIN32 && !defined __CYGWIN__ 2819# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2820# undef write 2821# define write _write 2822# endif 2823# ifdef __MINGW32__ 2824_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count)); 2825# else 2826_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count)); 2827# endif 2828# else 2829_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2830# endif 2831_GL_CXXALIASWARN (write); 2832#endif 2833 2834_GL_INLINE_HEADER_END 2835 2836#endif /* _GL_UNISTD_H */ 2837#endif /* _GL_INCLUDING_UNISTD_H */ 2838#endif /* _GL_UNISTD_H */ 2839