1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* Substitute for and wrapper around <unistd.h>. 3 Copyright (C) 2003-2015 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3, or (at your option) 8 any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */ 17 18 #ifndef _GL_UNISTD_H 19 20 #if __GNUC__ >= 3 21 #pragma GCC system_header 22 #endif 23 24 25 #ifdef _GL_INCLUDING_UNISTD_H 26 /* Special invocation convention: 27 - On Mac OS X 10.3.9 we have a sequence of nested includes 28 <unistd.h> -> <signal.h> -> <pthread.h> -> <unistd.h> 29 In this situation, the functions are not yet declared, therefore we cannot 30 provide the C++ aliases. */ 31 32 #include_next <unistd.h> 33 34 #else 35 /* Normal invocation convention. */ 36 37 /* The include_next requires a split double-inclusion guard. */ 38 #if 1 39 # define _GL_INCLUDING_UNISTD_H 40 # include_next <unistd.h> 41 # undef _GL_INCLUDING_UNISTD_H 42 #endif 43 44 /* Get all possible declarations of gethostname(). */ 45 #if 0 && 0 \ 46 && !defined _GL_INCLUDING_WINSOCK2_H 47 # define _GL_INCLUDING_WINSOCK2_H 48 # include <winsock2.h> 49 # undef _GL_INCLUDING_WINSOCK2_H 50 #endif 51 52 #if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H 53 #define _GL_UNISTD_H 54 55 /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ 56 #include <stddef.h> 57 58 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ 59 /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */ 60 /* But avoid namespace pollution on glibc systems. */ 61 #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ 62 || ((0 || defined GNULIB_POSIXCHECK) \ 63 && defined __CYGWIN__)) \ 64 && ! defined __GLIBC__ 65 # include <stdio.h> 66 #endif 67 68 /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */ 69 /* But avoid namespace pollution on glibc systems. */ 70 #if (0 || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \ 71 && ! defined __GLIBC__ 72 # include <fcntl.h> 73 #endif 74 75 /* mingw fails to declare _exit in <unistd.h>. */ 76 /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in 77 <unistd.h>. */ 78 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ 79 /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is 80 included here. */ 81 /* But avoid namespace pollution on glibc systems. */ 82 #if !defined __GLIBC__ && !defined __osf__ 83 # define __need_system_stdlib_h 84 # include <stdlib.h> 85 # undef __need_system_stdlib_h 86 #endif 87 88 /* Native Windows platforms declare chdir, getcwd, rmdir in 89 <io.h> and/or <direct.h>, not in <unistd.h>. 90 They also declare access(), chmod(), close(), dup(), dup2(), isatty(), 91 lseek(), read(), unlink(), write() in <io.h>. */ 92 #if ((1 || 1 || 0 \ 93 || defined GNULIB_POSIXCHECK) \ 94 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) 95 # include <io.h> /* mingw32, mingw64 */ 96 # include <direct.h> /* mingw64, MSVC 9 */ 97 #elif (1 || 1 || 1 || 1 \ 98 || 1 || 1 || 0 || 0 \ 99 || defined GNULIB_POSIXCHECK) \ 100 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) 101 # include <io.h> 102 #endif 103 104 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. 105 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */ 106 /* But avoid namespace pollution on glibc systems. */ 107 #if ((0 && (defined _AIX || defined __osf__)) \ 108 || (0 && defined __TANDEM)) \ 109 && !defined __GLIBC__ 110 # include <netdb.h> 111 #endif 112 113 /* MSVC defines off_t in <sys/types.h>. 114 May also define off_t to a 64-bit type on native Windows. */ 115 #if !1 || 0 116 /* Get off_t. */ 117 # include <sys/types.h> 118 #endif 119 120 #if (1 || 0 \ 121 || 0 || 0 \ 122 || 0 || 0 || defined GNULIB_POSIXCHECK) 123 /* Get ssize_t. */ 124 # include <sys/types.h> 125 #endif 126 127 /* Get getopt(), optarg, optind, opterr, optopt. 128 But avoid namespace pollution on glibc systems. */ 129 #if 01 && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT 130 # define __need_getopt 131 # include <getopt.h> 132 #endif 133 134 #ifndef _GL_INLINE_HEADER_BEGIN 135 #error "Please include config.h first." 136 #endif 137 _GL_INLINE_HEADER_BEGIN 138 #ifndef _GL_UNISTD_INLINE 139 # define _GL_UNISTD_INLINE _GL_INLINE 140 #endif 141 142 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 143 #ifndef _GL_CXXDEFS_H 144 #define _GL_CXXDEFS_H 145 146 /* The three most frequent use cases of these macros are: 147 148 * For providing a substitute for a function that is missing on some 149 platforms, but is declared and works fine on the platforms on which 150 it exists: 151 152 #if @GNULIB_FOO@ 153 # if !@HAVE_FOO@ 154 _GL_FUNCDECL_SYS (foo, ...); 155 # endif 156 _GL_CXXALIAS_SYS (foo, ...); 157 _GL_CXXALIASWARN (foo); 158 #elif defined GNULIB_POSIXCHECK 159 ... 160 #endif 161 162 * For providing a replacement for a function that exists on all platforms, 163 but is broken/insufficient and needs to be replaced on some platforms: 164 165 #if @GNULIB_FOO@ 166 # if @REPLACE_FOO@ 167 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 168 # undef foo 169 # define foo rpl_foo 170 # endif 171 _GL_FUNCDECL_RPL (foo, ...); 172 _GL_CXXALIAS_RPL (foo, ...); 173 # else 174 _GL_CXXALIAS_SYS (foo, ...); 175 # endif 176 _GL_CXXALIASWARN (foo); 177 #elif defined GNULIB_POSIXCHECK 178 ... 179 #endif 180 181 * For providing a replacement for a function that exists on some platforms 182 but is broken/insufficient and needs to be replaced on some of them and 183 is additionally either missing or undeclared on some other platforms: 184 185 #if @GNULIB_FOO@ 186 # if @REPLACE_FOO@ 187 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 188 # undef foo 189 # define foo rpl_foo 190 # endif 191 _GL_FUNCDECL_RPL (foo, ...); 192 _GL_CXXALIAS_RPL (foo, ...); 193 # else 194 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 195 _GL_FUNCDECL_SYS (foo, ...); 196 # endif 197 _GL_CXXALIAS_SYS (foo, ...); 198 # endif 199 _GL_CXXALIASWARN (foo); 200 #elif defined GNULIB_POSIXCHECK 201 ... 202 #endif 203 */ 204 205 /* _GL_EXTERN_C declaration; 206 performs the declaration with C linkage. */ 207 #if defined __cplusplus 208 # define _GL_EXTERN_C extern "C" 209 #else 210 # define _GL_EXTERN_C extern 211 #endif 212 213 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 214 declares a replacement function, named rpl_func, with the given prototype, 215 consisting of return type, parameters, and attributes. 216 Example: 217 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 218 _GL_ARG_NONNULL ((1))); 219 */ 220 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 221 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 222 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 223 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 224 225 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 226 declares the system function, named func, with the given prototype, 227 consisting of return type, parameters, and attributes. 228 Example: 229 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 230 _GL_ARG_NONNULL ((1))); 231 */ 232 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 233 _GL_EXTERN_C rettype func parameters_and_attributes 234 235 /* _GL_CXXALIAS_RPL (func, rettype, parameters); 236 declares a C++ alias called GNULIB_NAMESPACE::func 237 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 238 Example: 239 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 240 */ 241 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 242 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 243 #if defined __cplusplus && defined GNULIB_NAMESPACE 244 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 245 namespace GNULIB_NAMESPACE \ 246 { \ 247 rettype (*const func) parameters = ::rpl_func; \ 248 } \ 249 _GL_EXTERN_C int _gl_cxxalias_dummy 250 #else 251 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 252 _GL_EXTERN_C int _gl_cxxalias_dummy 253 #endif 254 255 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 256 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 257 except that the C function rpl_func may have a slightly different 258 declaration. A cast is used to silence the "invalid conversion" error 259 that would otherwise occur. */ 260 #if defined __cplusplus && defined GNULIB_NAMESPACE 261 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 262 namespace GNULIB_NAMESPACE \ 263 { \ 264 rettype (*const func) parameters = \ 265 reinterpret_cast<rettype(*)parameters>(::rpl_func); \ 266 } \ 267 _GL_EXTERN_C int _gl_cxxalias_dummy 268 #else 269 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 270 _GL_EXTERN_C int _gl_cxxalias_dummy 271 #endif 272 273 /* _GL_CXXALIAS_SYS (func, rettype, parameters); 274 declares a C++ alias called GNULIB_NAMESPACE::func 275 that redirects to the system provided function func, if GNULIB_NAMESPACE 276 is defined. 277 Example: 278 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 279 */ 280 #if defined __cplusplus && defined GNULIB_NAMESPACE 281 /* If we were to write 282 rettype (*const func) parameters = ::func; 283 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls 284 better (remove an indirection through a 'static' pointer variable), 285 but then the _GL_CXXALIASWARN macro below would cause a warning not only 286 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ 287 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 288 namespace GNULIB_NAMESPACE \ 289 { \ 290 static rettype (*func) parameters = ::func; \ 291 } \ 292 _GL_EXTERN_C int _gl_cxxalias_dummy 293 #else 294 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 295 _GL_EXTERN_C int _gl_cxxalias_dummy 296 #endif 297 298 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 299 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 300 except that the C function func may have a slightly different declaration. 301 A cast is used to silence the "invalid conversion" error that would 302 otherwise occur. */ 303 #if defined __cplusplus && defined GNULIB_NAMESPACE 304 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 305 namespace GNULIB_NAMESPACE \ 306 { \ 307 static rettype (*func) parameters = \ 308 reinterpret_cast<rettype(*)parameters>(::func); \ 309 } \ 310 _GL_EXTERN_C int _gl_cxxalias_dummy 311 #else 312 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 313 _GL_EXTERN_C int _gl_cxxalias_dummy 314 #endif 315 316 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 317 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 318 except that the C function is picked among a set of overloaded functions, 319 namely the one with rettype2 and parameters2. Two consecutive casts 320 are used to silence the "cannot find a match" and "invalid conversion" 321 errors that would otherwise occur. */ 322 #if defined __cplusplus && defined GNULIB_NAMESPACE 323 /* The outer cast must be a reinterpret_cast. 324 The inner cast: When the function is defined as a set of overloaded 325 functions, it works as a static_cast<>, choosing the designated variant. 326 When the function is defined as a single variant, it works as a 327 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 328 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 329 namespace GNULIB_NAMESPACE \ 330 { \ 331 static rettype (*func) parameters = \ 332 reinterpret_cast<rettype(*)parameters>( \ 333 (rettype2(*)parameters2)(::func)); \ 334 } \ 335 _GL_EXTERN_C int _gl_cxxalias_dummy 336 #else 337 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 338 _GL_EXTERN_C int _gl_cxxalias_dummy 339 #endif 340 341 /* _GL_CXXALIASWARN (func); 342 causes a warning to be emitted when ::func is used but not when 343 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 344 variants. */ 345 #if defined __cplusplus && defined GNULIB_NAMESPACE 346 # define _GL_CXXALIASWARN(func) \ 347 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 348 # define _GL_CXXALIASWARN_1(func,namespace) \ 349 _GL_CXXALIASWARN_2 (func, namespace) 350 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 351 we enable the warning only when not optimizing. */ 352 # if !__OPTIMIZE__ 353 # define _GL_CXXALIASWARN_2(func,namespace) \ 354 _GL_WARN_ON_USE (func, \ 355 "The symbol ::" #func " refers to the system function. " \ 356 "Use " #namespace "::" #func " instead.") 357 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 358 # define _GL_CXXALIASWARN_2(func,namespace) \ 359 extern __typeof__ (func) func 360 # else 361 # define _GL_CXXALIASWARN_2(func,namespace) \ 362 _GL_EXTERN_C int _gl_cxxalias_dummy 363 # endif 364 #else 365 # define _GL_CXXALIASWARN(func) \ 366 _GL_EXTERN_C int _gl_cxxalias_dummy 367 #endif 368 369 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 370 causes a warning to be emitted when the given overloaded variant of ::func 371 is used but not when GNULIB_NAMESPACE::func is used. */ 372 #if defined __cplusplus && defined GNULIB_NAMESPACE 373 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 374 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 375 GNULIB_NAMESPACE) 376 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 377 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 378 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 379 we enable the warning only when not optimizing. */ 380 # if !__OPTIMIZE__ 381 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 382 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 383 "The symbol ::" #func " refers to the system function. " \ 384 "Use " #namespace "::" #func " instead.") 385 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 386 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 387 extern __typeof__ (func) func 388 # else 389 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 390 _GL_EXTERN_C int _gl_cxxalias_dummy 391 # endif 392 #else 393 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 394 _GL_EXTERN_C int _gl_cxxalias_dummy 395 #endif 396 397 #endif /* _GL_CXXDEFS_H */ 398 399 /* The definition of _GL_ARG_NONNULL is copied here. */ 400 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 401 that the values passed as arguments n, ..., m must be non-NULL pointers. 402 n = 1 stands for the first argument, n = 2 for the second argument etc. */ 403 #ifndef _GL_ARG_NONNULL 404 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 405 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 406 # else 407 # define _GL_ARG_NONNULL(params) 408 # endif 409 #endif 410 411 /* The definition of _GL_WARN_ON_USE is copied here. */ 412 #ifndef _GL_WARN_ON_USE 413 414 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 415 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 416 # define _GL_WARN_ON_USE(function, message) \ 417 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 418 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 419 /* Verify the existence of the function. */ 420 # define _GL_WARN_ON_USE(function, message) \ 421 extern __typeof__ (function) function 422 # else /* Unsupported. */ 423 # define _GL_WARN_ON_USE(function, message) \ 424 _GL_WARN_EXTERN_C int _gl_warn_on_use 425 # endif 426 #endif 427 428 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 429 is like _GL_WARN_ON_USE (function, "string"), except that the function is 430 declared with the given prototype, consisting of return type, parameters, 431 and attributes. 432 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 433 not work in this case. */ 434 #ifndef _GL_WARN_ON_USE_CXX 435 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 436 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 437 extern rettype function parameters_and_attributes \ 438 __attribute__ ((__warning__ (msg))) 439 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 440 /* Verify the existence of the function. */ 441 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 442 extern rettype function parameters_and_attributes 443 # else /* Unsupported. */ 444 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 445 _GL_WARN_EXTERN_C int _gl_warn_on_use 446 # endif 447 #endif 448 449 /* _GL_WARN_EXTERN_C declaration; 450 performs the declaration with C linkage. */ 451 #ifndef _GL_WARN_EXTERN_C 452 # if defined __cplusplus 453 # define _GL_WARN_EXTERN_C extern "C" 454 # else 455 # define _GL_WARN_EXTERN_C extern 456 # endif 457 #endif 458 459 460 /* Hide some function declarations from <winsock2.h>. */ 461 462 #if 0 && 0 463 # if !defined _GL_SYS_SOCKET_H 464 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 465 # undef socket 466 # define socket socket_used_without_including_sys_socket_h 467 # undef connect 468 # define connect connect_used_without_including_sys_socket_h 469 # undef accept 470 # define accept accept_used_without_including_sys_socket_h 471 # undef bind 472 # define bind bind_used_without_including_sys_socket_h 473 # undef getpeername 474 # define getpeername getpeername_used_without_including_sys_socket_h 475 # undef getsockname 476 # define getsockname getsockname_used_without_including_sys_socket_h 477 # undef getsockopt 478 # define getsockopt getsockopt_used_without_including_sys_socket_h 479 # undef listen 480 # define listen listen_used_without_including_sys_socket_h 481 # undef recv 482 # define recv recv_used_without_including_sys_socket_h 483 # undef send 484 # define send send_used_without_including_sys_socket_h 485 # undef recvfrom 486 # define recvfrom recvfrom_used_without_including_sys_socket_h 487 # undef sendto 488 # define sendto sendto_used_without_including_sys_socket_h 489 # undef setsockopt 490 # define setsockopt setsockopt_used_without_including_sys_socket_h 491 # undef shutdown 492 # define shutdown shutdown_used_without_including_sys_socket_h 493 # else 494 _GL_WARN_ON_USE (socket, 495 "socket() used without including <sys/socket.h>"); 496 _GL_WARN_ON_USE (connect, 497 "connect() used without including <sys/socket.h>"); 498 _GL_WARN_ON_USE (accept, 499 "accept() used without including <sys/socket.h>"); 500 _GL_WARN_ON_USE (bind, 501 "bind() used without including <sys/socket.h>"); 502 _GL_WARN_ON_USE (getpeername, 503 "getpeername() used without including <sys/socket.h>"); 504 _GL_WARN_ON_USE (getsockname, 505 "getsockname() used without including <sys/socket.h>"); 506 _GL_WARN_ON_USE (getsockopt, 507 "getsockopt() used without including <sys/socket.h>"); 508 _GL_WARN_ON_USE (listen, 509 "listen() used without including <sys/socket.h>"); 510 _GL_WARN_ON_USE (recv, 511 "recv() used without including <sys/socket.h>"); 512 _GL_WARN_ON_USE (send, 513 "send() used without including <sys/socket.h>"); 514 _GL_WARN_ON_USE (recvfrom, 515 "recvfrom() used without including <sys/socket.h>"); 516 _GL_WARN_ON_USE (sendto, 517 "sendto() used without including <sys/socket.h>"); 518 _GL_WARN_ON_USE (setsockopt, 519 "setsockopt() used without including <sys/socket.h>"); 520 _GL_WARN_ON_USE (shutdown, 521 "shutdown() used without including <sys/socket.h>"); 522 # endif 523 # endif 524 # if !defined _GL_SYS_SELECT_H 525 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 526 # undef select 527 # define select select_used_without_including_sys_select_h 528 # else 529 _GL_WARN_ON_USE (select, 530 "select() used without including <sys/select.h>"); 531 # endif 532 # endif 533 #endif 534 535 536 /* OS/2 EMX lacks these macros. */ 537 #ifndef STDIN_FILENO 538 # define STDIN_FILENO 0 539 #endif 540 #ifndef STDOUT_FILENO 541 # define STDOUT_FILENO 1 542 #endif 543 #ifndef STDERR_FILENO 544 # define STDERR_FILENO 2 545 #endif 546 547 /* Ensure *_OK macros exist. */ 548 #ifndef F_OK 549 # define F_OK 0 550 # define X_OK 1 551 # define W_OK 2 552 # define R_OK 4 553 #endif 554 555 556 /* Declare overridden functions. */ 557 558 559 #if defined GNULIB_POSIXCHECK 560 /* The access() function is a security risk. */ 561 _GL_WARN_ON_USE (access, "the access function is a security risk - " 562 "use the gnulib module faccessat instead"); 563 #endif 564 565 566 #if 1 567 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); 568 _GL_CXXALIASWARN (chdir); 569 #elif defined GNULIB_POSIXCHECK 570 # undef chdir 571 # if HAVE_RAW_DECL_CHDIR 572 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " 573 "use gnulib module chdir for portability"); 574 # endif 575 #endif 576 577 578 #if 0 579 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 580 to GID (if GID is not -1). Follow symbolic links. 581 Return 0 if successful, otherwise -1 and errno set. 582 See the POSIX:2008 specification 583 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */ 584 # if 0 585 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 586 # undef chown 587 # define chown rpl_chown 588 # endif 589 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) 590 _GL_ARG_NONNULL ((1))); 591 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); 592 # else 593 # if !1 594 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) 595 _GL_ARG_NONNULL ((1))); 596 # endif 597 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); 598 # endif 599 _GL_CXXALIASWARN (chown); 600 #elif defined GNULIB_POSIXCHECK 601 # undef chown 602 # if HAVE_RAW_DECL_CHOWN 603 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " 604 "doesn't treat a uid or gid of -1 on some systems - " 605 "use gnulib module chown for portability"); 606 # endif 607 #endif 608 609 610 #if 1 611 # if 0 612 /* Automatically included by modules that need a replacement for close. */ 613 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 614 # undef close 615 # define close rpl_close 616 # endif 617 _GL_FUNCDECL_RPL (close, int, (int fd)); 618 _GL_CXXALIAS_RPL (close, int, (int fd)); 619 # else 620 _GL_CXXALIAS_SYS (close, int, (int fd)); 621 # endif 622 _GL_CXXALIASWARN (close); 623 #elif 0 624 # undef close 625 # define close close_used_without_requesting_gnulib_module_close 626 #elif defined GNULIB_POSIXCHECK 627 # undef close 628 /* Assume close is always declared. */ 629 _GL_WARN_ON_USE (close, "close does not portably work on sockets - " 630 "use gnulib module close for portability"); 631 #endif 632 633 634 #if 1 635 # if 0 636 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 637 # define dup rpl_dup 638 # endif 639 _GL_FUNCDECL_RPL (dup, int, (int oldfd)); 640 _GL_CXXALIAS_RPL (dup, int, (int oldfd)); 641 # else 642 _GL_CXXALIAS_SYS (dup, int, (int oldfd)); 643 # endif 644 _GL_CXXALIASWARN (dup); 645 #elif defined GNULIB_POSIXCHECK 646 # undef dup 647 # if HAVE_RAW_DECL_DUP 648 _GL_WARN_ON_USE (dup, "dup is unportable - " 649 "use gnulib module dup for portability"); 650 # endif 651 #endif 652 653 654 #if 1 655 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if 656 NEWFD = OLDFD, otherwise close NEWFD first if it is open. 657 Return newfd if successful, otherwise -1 and errno set. 658 See the POSIX:2008 specification 659 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */ 660 # if 1 661 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 662 # define dup2 rpl_dup2 663 # endif 664 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); 665 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); 666 # else 667 # if !1 668 _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd)); 669 # endif 670 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); 671 # endif 672 _GL_CXXALIASWARN (dup2); 673 #elif defined GNULIB_POSIXCHECK 674 # undef dup2 675 # if HAVE_RAW_DECL_DUP2 676 _GL_WARN_ON_USE (dup2, "dup2 is unportable - " 677 "use gnulib module dup2 for portability"); 678 # endif 679 #endif 680 681 682 #if 0 683 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the 684 specified flags. 685 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 686 and O_TEXT, O_BINARY (defined in "binary-io.h"). 687 Close NEWFD first if it is open. 688 Return newfd if successful, otherwise -1 and errno set. 689 See the Linux man page at 690 <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ 691 # if 1 692 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 693 # define dup3 rpl_dup3 694 # endif 695 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); 696 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); 697 # else 698 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); 699 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); 700 # endif 701 _GL_CXXALIASWARN (dup3); 702 #elif defined GNULIB_POSIXCHECK 703 # undef dup3 704 # if HAVE_RAW_DECL_DUP3 705 _GL_WARN_ON_USE (dup3, "dup3 is unportable - " 706 "use gnulib module dup3 for portability"); 707 # endif 708 #endif 709 710 711 #if IN_GREP_GNULIB_TESTS 712 # if !0 713 /* Set of environment variables and values. An array of strings of the form 714 "VARIABLE=VALUE", terminated with a NULL. */ 715 # if defined __APPLE__ && defined __MACH__ 716 # include <TargetConditionals.h> 717 # if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR 718 # define _GL_USE_CRT_EXTERNS 719 # endif 720 # endif 721 # ifdef _GL_USE_CRT_EXTERNS 722 # include <crt_externs.h> 723 # define environ (*_NSGetEnviron ()) 724 # else 725 # ifdef __cplusplus 726 extern "C" { 727 # endif 728 extern char **environ; 729 # ifdef __cplusplus 730 } 731 # endif 732 # endif 733 # endif 734 #elif defined GNULIB_POSIXCHECK 735 # if HAVE_RAW_DECL_ENVIRON 736 _GL_UNISTD_INLINE char *** 737 rpl_environ (void) 738 { 739 return &environ; 740 } 741 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - " 742 "use gnulib module environ for portability"); 743 # undef environ 744 # define environ (*rpl_environ ()) 745 # endif 746 #endif 747 748 749 #if 0 750 /* Like access(), except that it uses the effective user id and group id of 751 the current process. */ 752 # if !1 753 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) 754 _GL_ARG_NONNULL ((1))); 755 # endif 756 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); 757 _GL_CXXALIASWARN (euidaccess); 758 # if defined GNULIB_POSIXCHECK 759 /* Like access(), this function is a security risk. */ 760 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " 761 "use the gnulib module faccessat instead"); 762 # endif 763 #elif defined GNULIB_POSIXCHECK 764 # undef euidaccess 765 # if HAVE_RAW_DECL_EUIDACCESS 766 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " 767 "use gnulib module euidaccess for portability"); 768 # endif 769 #endif 770 771 772 #if 0 773 # if !1 774 _GL_FUNCDECL_SYS (faccessat, int, 775 (int fd, char const *file, int mode, int flag) 776 _GL_ARG_NONNULL ((2))); 777 # endif 778 _GL_CXXALIAS_SYS (faccessat, int, 779 (int fd, char const *file, int mode, int flag)); 780 _GL_CXXALIASWARN (faccessat); 781 #elif defined GNULIB_POSIXCHECK 782 # undef faccessat 783 # if HAVE_RAW_DECL_FACCESSAT 784 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - " 785 "use gnulib module faccessat for portability"); 786 # endif 787 #endif 788 789 790 #if 1 791 /* Change the process' current working directory to the directory on which 792 the given file descriptor is open. 793 Return 0 if successful, otherwise -1 and errno set. 794 See the POSIX:2008 specification 795 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ 796 # if ! 1 797 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 798 799 /* Gnulib internal hooks needed to maintain the fchdir metadata. */ 800 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) 801 _GL_ARG_NONNULL ((2)); 802 _GL_EXTERN_C void _gl_unregister_fd (int fd); 803 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); 804 _GL_EXTERN_C const char *_gl_directory_name (int fd); 805 806 # else 807 # if !1 808 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 809 # endif 810 # endif 811 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); 812 _GL_CXXALIASWARN (fchdir); 813 #elif defined GNULIB_POSIXCHECK 814 # undef fchdir 815 # if HAVE_RAW_DECL_FCHDIR 816 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - " 817 "use gnulib module fchdir for portability"); 818 # endif 819 #endif 820 821 822 #if 0 823 # if 0 824 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 825 # undef fchownat 826 # define fchownat rpl_fchownat 827 # endif 828 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, 829 uid_t owner, gid_t group, int flag) 830 _GL_ARG_NONNULL ((2))); 831 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, 832 uid_t owner, gid_t group, int flag)); 833 # else 834 # if !1 835 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, 836 uid_t owner, gid_t group, int flag) 837 _GL_ARG_NONNULL ((2))); 838 # endif 839 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, 840 uid_t owner, gid_t group, int flag)); 841 # endif 842 _GL_CXXALIASWARN (fchownat); 843 #elif defined GNULIB_POSIXCHECK 844 # undef fchownat 845 # if HAVE_RAW_DECL_FCHOWNAT 846 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - " 847 "use gnulib module openat for portability"); 848 # endif 849 #endif 850 851 852 #if 0 853 /* Synchronize changes to a file. 854 Return 0 if successful, otherwise -1 and errno set. 855 See POSIX:2008 specification 856 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ 857 # if !1 || !1 858 _GL_FUNCDECL_SYS (fdatasync, int, (int fd)); 859 # endif 860 _GL_CXXALIAS_SYS (fdatasync, int, (int fd)); 861 _GL_CXXALIASWARN (fdatasync); 862 #elif defined GNULIB_POSIXCHECK 863 # undef fdatasync 864 # if HAVE_RAW_DECL_FDATASYNC 865 _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " 866 "use gnulib module fdatasync for portability"); 867 # endif 868 #endif 869 870 871 #if 0 872 /* Synchronize changes, including metadata, to a file. 873 Return 0 if successful, otherwise -1 and errno set. 874 See POSIX:2008 specification 875 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ 876 # if !1 877 _GL_FUNCDECL_SYS (fsync, int, (int fd)); 878 # endif 879 _GL_CXXALIAS_SYS (fsync, int, (int fd)); 880 _GL_CXXALIASWARN (fsync); 881 #elif defined GNULIB_POSIXCHECK 882 # undef fsync 883 # if HAVE_RAW_DECL_FSYNC 884 _GL_WARN_ON_USE (fsync, "fsync is unportable - " 885 "use gnulib module fsync for portability"); 886 # endif 887 #endif 888 889 890 #if 0 891 /* Change the size of the file to which FD is opened to become equal to LENGTH. 892 Return 0 if successful, otherwise -1 and errno set. 893 See the POSIX:2008 specification 894 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ 895 # if 0 896 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 897 # undef ftruncate 898 # define ftruncate rpl_ftruncate 899 # endif 900 _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); 901 _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); 902 # else 903 # if !1 904 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 905 # endif 906 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 907 # endif 908 _GL_CXXALIASWARN (ftruncate); 909 #elif defined GNULIB_POSIXCHECK 910 # undef ftruncate 911 # if HAVE_RAW_DECL_FTRUNCATE 912 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " 913 "use gnulib module ftruncate for portability"); 914 # endif 915 #endif 916 917 918 #if 1 919 /* Get the name of the current working directory, and put it in SIZE bytes 920 of BUF. 921 Return BUF if successful, or NULL if the directory couldn't be determined 922 or SIZE was too small. 923 See the POSIX:2008 specification 924 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. 925 Additionally, the gnulib module 'getcwd' guarantees the following GNU 926 extension: If BUF is NULL, an array is allocated with 'malloc'; the array 927 is SIZE bytes long, unless SIZE == 0, in which case it is as big as 928 necessary. */ 929 # if 0 930 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 931 # define getcwd rpl_getcwd 932 # endif 933 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); 934 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); 935 # else 936 /* Need to cast, because on mingw, the second parameter is 937 int size. */ 938 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); 939 # endif 940 _GL_CXXALIASWARN (getcwd); 941 #elif defined GNULIB_POSIXCHECK 942 # undef getcwd 943 # if HAVE_RAW_DECL_GETCWD 944 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - " 945 "use gnulib module getcwd for portability"); 946 # endif 947 #endif 948 949 950 #if 0 951 /* Return the NIS domain name of the machine. 952 WARNING! The NIS domain name is unrelated to the fully qualified host name 953 of the machine. It is also unrelated to email addresses. 954 WARNING! The NIS domain name is usually the empty string or "(none)" when 955 not using NIS. 956 957 Put up to LEN bytes of the NIS domain name into NAME. 958 Null terminate it if the name is shorter than LEN. 959 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. 960 Return 0 if successful, otherwise set errno and return -1. */ 961 # if 0 962 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 963 # undef getdomainname 964 # define getdomainname rpl_getdomainname 965 # endif 966 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) 967 _GL_ARG_NONNULL ((1))); 968 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); 969 # else 970 # if !1 971 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) 972 _GL_ARG_NONNULL ((1))); 973 # endif 974 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); 975 # endif 976 _GL_CXXALIASWARN (getdomainname); 977 #elif defined GNULIB_POSIXCHECK 978 # undef getdomainname 979 # if HAVE_RAW_DECL_GETDOMAINNAME 980 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " 981 "use gnulib module getdomainname for portability"); 982 # endif 983 #endif 984 985 986 #if 1 987 /* Return the maximum number of file descriptors in the current process. 988 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ 989 # if 0 990 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 991 # undef getdtablesize 992 # define getdtablesize rpl_getdtablesize 993 # endif 994 _GL_FUNCDECL_RPL (getdtablesize, int, (void)); 995 _GL_CXXALIAS_RPL (getdtablesize, int, (void)); 996 # else 997 # if !1 998 _GL_FUNCDECL_SYS (getdtablesize, int, (void)); 999 # endif 1000 _GL_CXXALIAS_SYS (getdtablesize, int, (void)); 1001 # endif 1002 _GL_CXXALIASWARN (getdtablesize); 1003 #elif defined GNULIB_POSIXCHECK 1004 # undef getdtablesize 1005 # if HAVE_RAW_DECL_GETDTABLESIZE 1006 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " 1007 "use gnulib module getdtablesize for portability"); 1008 # endif 1009 #endif 1010 1011 1012 #if 0 1013 /* Return the supplemental groups that the current process belongs to. 1014 It is unspecified whether the effective group id is in the list. 1015 If N is 0, return the group count; otherwise, N describes how many 1016 entries are available in GROUPS. Return -1 and set errno if N is 1017 not 0 and not large enough. Fails with ENOSYS on some systems. */ 1018 # if 0 1019 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1020 # undef getgroups 1021 # define getgroups rpl_getgroups 1022 # endif 1023 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); 1024 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); 1025 # else 1026 # if !1 1027 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); 1028 # endif 1029 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); 1030 # endif 1031 _GL_CXXALIASWARN (getgroups); 1032 #elif defined GNULIB_POSIXCHECK 1033 # undef getgroups 1034 # if HAVE_RAW_DECL_GETGROUPS 1035 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - " 1036 "use gnulib module getgroups for portability"); 1037 # endif 1038 #endif 1039 1040 1041 #if 0 1042 /* Return the standard host name of the machine. 1043 WARNING! The host name may or may not be fully qualified. 1044 1045 Put up to LEN bytes of the host name into NAME. 1046 Null terminate it if the name is shorter than LEN. 1047 If the host name is longer than LEN, set errno = EINVAL and return -1. 1048 Return 0 if successful, otherwise set errno and return -1. */ 1049 # if 0 1050 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1051 # undef gethostname 1052 # define gethostname rpl_gethostname 1053 # endif 1054 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) 1055 _GL_ARG_NONNULL ((1))); 1056 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); 1057 # else 1058 # if !1 1059 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) 1060 _GL_ARG_NONNULL ((1))); 1061 # endif 1062 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second 1063 parameter is 1064 int len. */ 1065 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); 1066 # endif 1067 _GL_CXXALIASWARN (gethostname); 1068 #elif 0 1069 # undef gethostname 1070 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname 1071 #elif defined GNULIB_POSIXCHECK 1072 # undef gethostname 1073 # if HAVE_RAW_DECL_GETHOSTNAME 1074 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - " 1075 "use gnulib module gethostname for portability"); 1076 # endif 1077 #endif 1078 1079 1080 #if 0 1081 /* Returns the user's login name, or NULL if it cannot be found. Upon error, 1082 returns NULL with errno set. 1083 1084 See <http://www.opengroup.org/susv3xsh/getlogin.html>. 1085 1086 Most programs don't need to use this function, because the information is 1087 available through environment variables: 1088 ${LOGNAME-$USER} on Unix platforms, 1089 $USERNAME on native Windows platforms. 1090 */ 1091 # if !1 1092 _GL_FUNCDECL_SYS (getlogin, char *, (void)); 1093 # endif 1094 _GL_CXXALIAS_SYS (getlogin, char *, (void)); 1095 _GL_CXXALIASWARN (getlogin); 1096 #elif defined GNULIB_POSIXCHECK 1097 # undef getlogin 1098 # if HAVE_RAW_DECL_GETLOGIN 1099 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - " 1100 "use gnulib module getlogin for portability"); 1101 # endif 1102 #endif 1103 1104 1105 #if 0 1106 /* Copies the user's login name to NAME. 1107 The array pointed to by NAME has room for SIZE bytes. 1108 1109 Returns 0 if successful. Upon error, an error number is returned, or -1 in 1110 the case that the login name cannot be found but no specific error is 1111 provided (this case is hopefully rare but is left open by the POSIX spec). 1112 1113 See <http://www.opengroup.org/susv3xsh/getlogin.html>. 1114 1115 Most programs don't need to use this function, because the information is 1116 available through environment variables: 1117 ${LOGNAME-$USER} on Unix platforms, 1118 $USERNAME on native Windows platforms. 1119 */ 1120 # if 0 1121 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1122 # define getlogin_r rpl_getlogin_r 1123 # endif 1124 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) 1125 _GL_ARG_NONNULL ((1))); 1126 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); 1127 # else 1128 # if !1 1129 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) 1130 _GL_ARG_NONNULL ((1))); 1131 # endif 1132 /* Need to cast, because on Solaris 10 systems, the second argument is 1133 int size. */ 1134 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); 1135 # endif 1136 _GL_CXXALIASWARN (getlogin_r); 1137 #elif defined GNULIB_POSIXCHECK 1138 # undef getlogin_r 1139 # if HAVE_RAW_DECL_GETLOGIN_R 1140 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " 1141 "use gnulib module getlogin_r for portability"); 1142 # endif 1143 #endif 1144 1145 1146 #if 1 1147 # if 0 1148 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1149 # define getpagesize rpl_getpagesize 1150 # endif 1151 _GL_FUNCDECL_RPL (getpagesize, int, (void)); 1152 _GL_CXXALIAS_RPL (getpagesize, int, (void)); 1153 # else 1154 # if !1 1155 # if !defined getpagesize 1156 /* This is for POSIX systems. */ 1157 # if !defined _gl_getpagesize && defined _SC_PAGESIZE 1158 # if ! (defined __VMS && __VMS_VER < 70000000) 1159 # define _gl_getpagesize() sysconf (_SC_PAGESIZE) 1160 # endif 1161 # endif 1162 /* This is for older VMS. */ 1163 # if !defined _gl_getpagesize && defined __VMS 1164 # ifdef __ALPHA 1165 # define _gl_getpagesize() 8192 1166 # else 1167 # define _gl_getpagesize() 512 1168 # endif 1169 # endif 1170 /* This is for BeOS. */ 1171 # if !defined _gl_getpagesize && 0 1172 # include <OS.h> 1173 # if defined B_PAGE_SIZE 1174 # define _gl_getpagesize() B_PAGE_SIZE 1175 # endif 1176 # endif 1177 /* This is for AmigaOS4.0. */ 1178 # if !defined _gl_getpagesize && defined __amigaos4__ 1179 # define _gl_getpagesize() 2048 1180 # endif 1181 /* This is for older Unix systems. */ 1182 # if !defined _gl_getpagesize && 0 1183 # include <sys/param.h> 1184 # ifdef EXEC_PAGESIZE 1185 # define _gl_getpagesize() EXEC_PAGESIZE 1186 # else 1187 # ifdef NBPG 1188 # ifndef CLSIZE 1189 # define CLSIZE 1 1190 # endif 1191 # define _gl_getpagesize() (NBPG * CLSIZE) 1192 # else 1193 # ifdef NBPC 1194 # define _gl_getpagesize() NBPC 1195 # endif 1196 # endif 1197 # endif 1198 # endif 1199 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1200 # define getpagesize() _gl_getpagesize () 1201 # else 1202 # if !GNULIB_defined_getpagesize_function 1203 _GL_UNISTD_INLINE int 1204 getpagesize () 1205 { 1206 return _gl_getpagesize (); 1207 } 1208 # define GNULIB_defined_getpagesize_function 1 1209 # endif 1210 # endif 1211 # endif 1212 # endif 1213 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ 1214 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); 1215 # endif 1216 # if 1 1217 _GL_CXXALIASWARN (getpagesize); 1218 # endif 1219 #elif defined GNULIB_POSIXCHECK 1220 # undef getpagesize 1221 # if HAVE_RAW_DECL_GETPAGESIZE 1222 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " 1223 "use gnulib module getpagesize for portability"); 1224 # endif 1225 #endif 1226 1227 1228 #if 0 1229 /* Return the next valid login shell on the system, or NULL when the end of 1230 the list has been reached. */ 1231 # if !1 1232 _GL_FUNCDECL_SYS (getusershell, char *, (void)); 1233 # endif 1234 _GL_CXXALIAS_SYS (getusershell, char *, (void)); 1235 _GL_CXXALIASWARN (getusershell); 1236 #elif defined GNULIB_POSIXCHECK 1237 # undef getusershell 1238 # if HAVE_RAW_DECL_GETUSERSHELL 1239 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - " 1240 "use gnulib module getusershell for portability"); 1241 # endif 1242 #endif 1243 1244 #if 0 1245 /* Rewind to pointer that is advanced at each getusershell() call. */ 1246 # if !1 1247 _GL_FUNCDECL_SYS (setusershell, void, (void)); 1248 # endif 1249 _GL_CXXALIAS_SYS (setusershell, void, (void)); 1250 _GL_CXXALIASWARN (setusershell); 1251 #elif defined GNULIB_POSIXCHECK 1252 # undef setusershell 1253 # if HAVE_RAW_DECL_SETUSERSHELL 1254 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - " 1255 "use gnulib module getusershell for portability"); 1256 # endif 1257 #endif 1258 1259 #if 0 1260 /* Free the pointer that is advanced at each getusershell() call and 1261 associated resources. */ 1262 # if !1 1263 _GL_FUNCDECL_SYS (endusershell, void, (void)); 1264 # endif 1265 _GL_CXXALIAS_SYS (endusershell, void, (void)); 1266 _GL_CXXALIASWARN (endusershell); 1267 #elif defined GNULIB_POSIXCHECK 1268 # undef endusershell 1269 # if HAVE_RAW_DECL_ENDUSERSHELL 1270 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - " 1271 "use gnulib module getusershell for portability"); 1272 # endif 1273 #endif 1274 1275 1276 #if 0 1277 /* Determine whether group id is in calling user's group list. */ 1278 # if !1 1279 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); 1280 # endif 1281 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); 1282 _GL_CXXALIASWARN (group_member); 1283 #elif defined GNULIB_POSIXCHECK 1284 # undef group_member 1285 # if HAVE_RAW_DECL_GROUP_MEMBER 1286 _GL_WARN_ON_USE (group_member, "group_member is unportable - " 1287 "use gnulib module group-member for portability"); 1288 # endif 1289 #endif 1290 1291 1292 #if 1 1293 # if 0 1294 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1295 # undef isatty 1296 # define isatty rpl_isatty 1297 # endif 1298 _GL_FUNCDECL_RPL (isatty, int, (int fd)); 1299 _GL_CXXALIAS_RPL (isatty, int, (int fd)); 1300 # else 1301 _GL_CXXALIAS_SYS (isatty, int, (int fd)); 1302 # endif 1303 _GL_CXXALIASWARN (isatty); 1304 #elif defined GNULIB_POSIXCHECK 1305 # undef isatty 1306 # if HAVE_RAW_DECL_ISATTY 1307 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " 1308 "use gnulib module isatty for portability"); 1309 # endif 1310 #endif 1311 1312 1313 #if 0 1314 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 1315 to GID (if GID is not -1). Do not follow symbolic links. 1316 Return 0 if successful, otherwise -1 and errno set. 1317 See the POSIX:2008 specification 1318 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */ 1319 # if 0 1320 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1321 # undef lchown 1322 # define lchown rpl_lchown 1323 # endif 1324 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) 1325 _GL_ARG_NONNULL ((1))); 1326 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); 1327 # else 1328 # if !1 1329 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) 1330 _GL_ARG_NONNULL ((1))); 1331 # endif 1332 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); 1333 # endif 1334 _GL_CXXALIASWARN (lchown); 1335 #elif defined GNULIB_POSIXCHECK 1336 # undef lchown 1337 # if HAVE_RAW_DECL_LCHOWN 1338 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " 1339 "use gnulib module lchown for portability"); 1340 # endif 1341 #endif 1342 1343 1344 #if 0 1345 /* Create a new hard link for an existing file. 1346 Return 0 if successful, otherwise -1 and errno set. 1347 See POSIX:2008 specification 1348 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */ 1349 # if 0 1350 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1351 # define link rpl_link 1352 # endif 1353 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) 1354 _GL_ARG_NONNULL ((1, 2))); 1355 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); 1356 # else 1357 # if !1 1358 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) 1359 _GL_ARG_NONNULL ((1, 2))); 1360 # endif 1361 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); 1362 # endif 1363 _GL_CXXALIASWARN (link); 1364 #elif defined GNULIB_POSIXCHECK 1365 # undef link 1366 # if HAVE_RAW_DECL_LINK 1367 _GL_WARN_ON_USE (link, "link is unportable - " 1368 "use gnulib module link for portability"); 1369 # endif 1370 #endif 1371 1372 1373 #if 0 1374 /* Create a new hard link for an existing file, relative to two 1375 directories. FLAG controls whether symlinks are followed. 1376 Return 0 if successful, otherwise -1 and errno set. */ 1377 # if 0 1378 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1379 # undef linkat 1380 # define linkat rpl_linkat 1381 # endif 1382 _GL_FUNCDECL_RPL (linkat, int, 1383 (int fd1, const char *path1, int fd2, const char *path2, 1384 int flag) 1385 _GL_ARG_NONNULL ((2, 4))); 1386 _GL_CXXALIAS_RPL (linkat, int, 1387 (int fd1, const char *path1, int fd2, const char *path2, 1388 int flag)); 1389 # else 1390 # if !1 1391 _GL_FUNCDECL_SYS (linkat, int, 1392 (int fd1, const char *path1, int fd2, const char *path2, 1393 int flag) 1394 _GL_ARG_NONNULL ((2, 4))); 1395 # endif 1396 _GL_CXXALIAS_SYS (linkat, int, 1397 (int fd1, const char *path1, int fd2, const char *path2, 1398 int flag)); 1399 # endif 1400 _GL_CXXALIASWARN (linkat); 1401 #elif defined GNULIB_POSIXCHECK 1402 # undef linkat 1403 # if HAVE_RAW_DECL_LINKAT 1404 _GL_WARN_ON_USE (linkat, "linkat is unportable - " 1405 "use gnulib module linkat for portability"); 1406 # endif 1407 #endif 1408 1409 1410 #if 1 1411 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. 1412 Return the new offset if successful, otherwise -1 and errno set. 1413 See the POSIX:2008 specification 1414 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */ 1415 # if 0 1416 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1417 # define lseek rpl_lseek 1418 # endif 1419 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1420 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1421 # else 1422 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); 1423 # endif 1424 _GL_CXXALIASWARN (lseek); 1425 #elif defined GNULIB_POSIXCHECK 1426 # undef lseek 1427 # if HAVE_RAW_DECL_LSEEK 1428 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " 1429 "systems - use gnulib module lseek for portability"); 1430 # endif 1431 #endif 1432 1433 1434 #if IN_GREP_GNULIB_TESTS 1435 /* Create a pipe, defaulting to O_BINARY mode. 1436 Store the read-end as fd[0] and the write-end as fd[1]. 1437 Return 0 upon success, or -1 with errno set upon failure. */ 1438 # if !1 1439 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); 1440 # endif 1441 _GL_CXXALIAS_SYS (pipe, int, (int fd[2])); 1442 _GL_CXXALIASWARN (pipe); 1443 #elif defined GNULIB_POSIXCHECK 1444 # undef pipe 1445 # if HAVE_RAW_DECL_PIPE 1446 _GL_WARN_ON_USE (pipe, "pipe is unportable - " 1447 "use gnulib module pipe-posix for portability"); 1448 # endif 1449 #endif 1450 1451 1452 #if 0 1453 /* Create a pipe, applying the given flags when opening the read-end of the 1454 pipe and the write-end of the pipe. 1455 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 1456 and O_TEXT, O_BINARY (defined in "binary-io.h"). 1457 Store the read-end as fd[0] and the write-end as fd[1]. 1458 Return 0 upon success, or -1 with errno set upon failure. 1459 See also the Linux man page at 1460 <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ 1461 # if 1 1462 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1463 # define pipe2 rpl_pipe2 1464 # endif 1465 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1466 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); 1467 # else 1468 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1469 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); 1470 # endif 1471 _GL_CXXALIASWARN (pipe2); 1472 #elif defined GNULIB_POSIXCHECK 1473 # undef pipe2 1474 # if HAVE_RAW_DECL_PIPE2 1475 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " 1476 "use gnulib module pipe2 for portability"); 1477 # endif 1478 #endif 1479 1480 1481 #if 0 1482 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. 1483 Return the number of bytes placed into BUF if successful, otherwise 1484 set errno and return -1. 0 indicates EOF. 1485 See the POSIX:2008 specification 1486 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */ 1487 # if 0 1488 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1489 # undef pread 1490 # define pread rpl_pread 1491 # endif 1492 _GL_FUNCDECL_RPL (pread, ssize_t, 1493 (int fd, void *buf, size_t bufsize, off_t offset) 1494 _GL_ARG_NONNULL ((2))); 1495 _GL_CXXALIAS_RPL (pread, ssize_t, 1496 (int fd, void *buf, size_t bufsize, off_t offset)); 1497 # else 1498 # if !1 1499 _GL_FUNCDECL_SYS (pread, ssize_t, 1500 (int fd, void *buf, size_t bufsize, off_t offset) 1501 _GL_ARG_NONNULL ((2))); 1502 # endif 1503 _GL_CXXALIAS_SYS (pread, ssize_t, 1504 (int fd, void *buf, size_t bufsize, off_t offset)); 1505 # endif 1506 _GL_CXXALIASWARN (pread); 1507 #elif defined GNULIB_POSIXCHECK 1508 # undef pread 1509 # if HAVE_RAW_DECL_PREAD 1510 _GL_WARN_ON_USE (pread, "pread is unportable - " 1511 "use gnulib module pread for portability"); 1512 # endif 1513 #endif 1514 1515 1516 #if 0 1517 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. 1518 Return the number of bytes written if successful, otherwise 1519 set errno and return -1. 0 indicates nothing written. See the 1520 POSIX:2008 specification 1521 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */ 1522 # if 0 1523 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1524 # undef pwrite 1525 # define pwrite rpl_pwrite 1526 # endif 1527 _GL_FUNCDECL_RPL (pwrite, ssize_t, 1528 (int fd, const void *buf, size_t bufsize, off_t offset) 1529 _GL_ARG_NONNULL ((2))); 1530 _GL_CXXALIAS_RPL (pwrite, ssize_t, 1531 (int fd, const void *buf, size_t bufsize, off_t offset)); 1532 # else 1533 # if !1 1534 _GL_FUNCDECL_SYS (pwrite, ssize_t, 1535 (int fd, const void *buf, size_t bufsize, off_t offset) 1536 _GL_ARG_NONNULL ((2))); 1537 # endif 1538 _GL_CXXALIAS_SYS (pwrite, ssize_t, 1539 (int fd, const void *buf, size_t bufsize, off_t offset)); 1540 # endif 1541 _GL_CXXALIASWARN (pwrite); 1542 #elif defined GNULIB_POSIXCHECK 1543 # undef pwrite 1544 # if HAVE_RAW_DECL_PWRITE 1545 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - " 1546 "use gnulib module pwrite for portability"); 1547 # endif 1548 #endif 1549 1550 1551 #if 1 1552 /* Read up to COUNT bytes from file descriptor FD into the buffer starting 1553 at BUF. See the POSIX:2008 specification 1554 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */ 1555 # if 0 1556 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1557 # undef read 1558 # define read rpl_read 1559 # endif 1560 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 1561 _GL_ARG_NONNULL ((2))); 1562 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); 1563 # else 1564 /* Need to cast, because on mingw, the third parameter is 1565 unsigned int count 1566 and the return type is 'int'. */ 1567 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count)); 1568 # endif 1569 _GL_CXXALIASWARN (read); 1570 #endif 1571 1572 1573 #if 0 1574 /* Read the contents of the symbolic link FILE and place the first BUFSIZE 1575 bytes of it into BUF. Return the number of bytes placed into BUF if 1576 successful, otherwise -1 and errno set. 1577 See the POSIX:2008 specification 1578 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */ 1579 # if 0 1580 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1581 # define readlink rpl_readlink 1582 # endif 1583 _GL_FUNCDECL_RPL (readlink, ssize_t, 1584 (const char *file, char *buf, size_t bufsize) 1585 _GL_ARG_NONNULL ((1, 2))); 1586 _GL_CXXALIAS_RPL (readlink, ssize_t, 1587 (const char *file, char *buf, size_t bufsize)); 1588 # else 1589 # if !1 1590 _GL_FUNCDECL_SYS (readlink, ssize_t, 1591 (const char *file, char *buf, size_t bufsize) 1592 _GL_ARG_NONNULL ((1, 2))); 1593 # endif 1594 _GL_CXXALIAS_SYS (readlink, ssize_t, 1595 (const char *file, char *buf, size_t bufsize)); 1596 # endif 1597 _GL_CXXALIASWARN (readlink); 1598 #elif defined GNULIB_POSIXCHECK 1599 # undef readlink 1600 # if HAVE_RAW_DECL_READLINK 1601 _GL_WARN_ON_USE (readlink, "readlink is unportable - " 1602 "use gnulib module readlink for portability"); 1603 # endif 1604 #endif 1605 1606 1607 #if 0 1608 # if 0 1609 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1610 # define readlinkat rpl_readlinkat 1611 # endif 1612 _GL_FUNCDECL_RPL (readlinkat, ssize_t, 1613 (int fd, char const *file, char *buf, size_t len) 1614 _GL_ARG_NONNULL ((2, 3))); 1615 _GL_CXXALIAS_RPL (readlinkat, ssize_t, 1616 (int fd, char const *file, char *buf, size_t len)); 1617 # else 1618 # if !1 1619 _GL_FUNCDECL_SYS (readlinkat, ssize_t, 1620 (int fd, char const *file, char *buf, size_t len) 1621 _GL_ARG_NONNULL ((2, 3))); 1622 # endif 1623 _GL_CXXALIAS_SYS (readlinkat, ssize_t, 1624 (int fd, char const *file, char *buf, size_t len)); 1625 # endif 1626 _GL_CXXALIASWARN (readlinkat); 1627 #elif defined GNULIB_POSIXCHECK 1628 # undef readlinkat 1629 # if HAVE_RAW_DECL_READLINKAT 1630 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " 1631 "use gnulib module readlinkat for portability"); 1632 # endif 1633 #endif 1634 1635 1636 #if 0 1637 /* Remove the directory DIR. */ 1638 # if 0 1639 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1640 # define rmdir rpl_rmdir 1641 # endif 1642 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); 1643 _GL_CXXALIAS_RPL (rmdir, int, (char const *name)); 1644 # else 1645 _GL_CXXALIAS_SYS (rmdir, int, (char const *name)); 1646 # endif 1647 _GL_CXXALIASWARN (rmdir); 1648 #elif defined GNULIB_POSIXCHECK 1649 # undef rmdir 1650 # if HAVE_RAW_DECL_RMDIR 1651 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - " 1652 "use gnulib module rmdir for portability"); 1653 # endif 1654 #endif 1655 1656 1657 #if 0 1658 /* Set the host name of the machine. 1659 The host name may or may not be fully qualified. 1660 1661 Put LEN bytes of NAME into the host name. 1662 Return 0 if successful, otherwise, set errno and return -1. 1663 1664 Platforms with no ability to set the hostname return -1 and set 1665 errno = ENOSYS. */ 1666 # if !1 || !1 1667 _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) 1668 _GL_ARG_NONNULL ((1))); 1669 # endif 1670 /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 1671 and FreeBSD 6.4 the second parameter is int. On Solaris 11 1672 2011-10, the first parameter is not const. */ 1673 _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); 1674 _GL_CXXALIASWARN (sethostname); 1675 #elif defined GNULIB_POSIXCHECK 1676 # undef sethostname 1677 # if HAVE_RAW_DECL_SETHOSTNAME 1678 _GL_WARN_ON_USE (sethostname, "sethostname is unportable - " 1679 "use gnulib module sethostname for portability"); 1680 # endif 1681 #endif 1682 1683 1684 #if 0 1685 /* Pause the execution of the current thread for N seconds. 1686 Returns the number of seconds left to sleep. 1687 See the POSIX:2008 specification 1688 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */ 1689 # if 0 1690 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1691 # undef sleep 1692 # define sleep rpl_sleep 1693 # endif 1694 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); 1695 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); 1696 # else 1697 # if !1 1698 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); 1699 # endif 1700 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); 1701 # endif 1702 _GL_CXXALIASWARN (sleep); 1703 #elif defined GNULIB_POSIXCHECK 1704 # undef sleep 1705 # if HAVE_RAW_DECL_SLEEP 1706 _GL_WARN_ON_USE (sleep, "sleep is unportable - " 1707 "use gnulib module sleep for portability"); 1708 # endif 1709 #endif 1710 1711 1712 #if IN_GREP_GNULIB_TESTS 1713 # if 0 1714 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1715 # undef symlink 1716 # define symlink rpl_symlink 1717 # endif 1718 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) 1719 _GL_ARG_NONNULL ((1, 2))); 1720 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); 1721 # else 1722 # if !1 1723 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) 1724 _GL_ARG_NONNULL ((1, 2))); 1725 # endif 1726 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); 1727 # endif 1728 _GL_CXXALIASWARN (symlink); 1729 #elif defined GNULIB_POSIXCHECK 1730 # undef symlink 1731 # if HAVE_RAW_DECL_SYMLINK 1732 _GL_WARN_ON_USE (symlink, "symlink is not portable - " 1733 "use gnulib module symlink for portability"); 1734 # endif 1735 #endif 1736 1737 1738 #if 0 1739 # if 0 1740 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1741 # undef symlinkat 1742 # define symlinkat rpl_symlinkat 1743 # endif 1744 _GL_FUNCDECL_RPL (symlinkat, int, 1745 (char const *contents, int fd, char const *file) 1746 _GL_ARG_NONNULL ((1, 3))); 1747 _GL_CXXALIAS_RPL (symlinkat, int, 1748 (char const *contents, int fd, char const *file)); 1749 # else 1750 # if !1 1751 _GL_FUNCDECL_SYS (symlinkat, int, 1752 (char const *contents, int fd, char const *file) 1753 _GL_ARG_NONNULL ((1, 3))); 1754 # endif 1755 _GL_CXXALIAS_SYS (symlinkat, int, 1756 (char const *contents, int fd, char const *file)); 1757 # endif 1758 _GL_CXXALIASWARN (symlinkat); 1759 #elif defined GNULIB_POSIXCHECK 1760 # undef symlinkat 1761 # if HAVE_RAW_DECL_SYMLINKAT 1762 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " 1763 "use gnulib module symlinkat for portability"); 1764 # endif 1765 #endif 1766 1767 1768 #if 0 1769 /* Store at most BUFLEN characters of the pathname of the terminal FD is 1770 open on in BUF. Return 0 on success, otherwise an error number. */ 1771 # if 0 1772 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1773 # undef ttyname_r 1774 # define ttyname_r rpl_ttyname_r 1775 # endif 1776 _GL_FUNCDECL_RPL (ttyname_r, int, 1777 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 1778 _GL_CXXALIAS_RPL (ttyname_r, int, 1779 (int fd, char *buf, size_t buflen)); 1780 # else 1781 # if !1 1782 _GL_FUNCDECL_SYS (ttyname_r, int, 1783 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 1784 # endif 1785 _GL_CXXALIAS_SYS (ttyname_r, int, 1786 (int fd, char *buf, size_t buflen)); 1787 # endif 1788 _GL_CXXALIASWARN (ttyname_r); 1789 #elif defined GNULIB_POSIXCHECK 1790 # undef ttyname_r 1791 # if HAVE_RAW_DECL_TTYNAME_R 1792 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " 1793 "use gnulib module ttyname_r for portability"); 1794 # endif 1795 #endif 1796 1797 1798 #if 0 1799 # if 0 1800 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1801 # undef unlink 1802 # define unlink rpl_unlink 1803 # endif 1804 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); 1805 _GL_CXXALIAS_RPL (unlink, int, (char const *file)); 1806 # else 1807 _GL_CXXALIAS_SYS (unlink, int, (char const *file)); 1808 # endif 1809 _GL_CXXALIASWARN (unlink); 1810 #elif defined GNULIB_POSIXCHECK 1811 # undef unlink 1812 # if HAVE_RAW_DECL_UNLINK 1813 _GL_WARN_ON_USE (unlink, "unlink is not portable - " 1814 "use gnulib module unlink for portability"); 1815 # endif 1816 #endif 1817 1818 1819 #if 0 1820 # if 0 1821 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1822 # undef unlinkat 1823 # define unlinkat rpl_unlinkat 1824 # endif 1825 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) 1826 _GL_ARG_NONNULL ((2))); 1827 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); 1828 # else 1829 # if !1 1830 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) 1831 _GL_ARG_NONNULL ((2))); 1832 # endif 1833 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); 1834 # endif 1835 _GL_CXXALIASWARN (unlinkat); 1836 #elif defined GNULIB_POSIXCHECK 1837 # undef unlinkat 1838 # if HAVE_RAW_DECL_UNLINKAT 1839 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " 1840 "use gnulib module openat for portability"); 1841 # endif 1842 #endif 1843 1844 1845 #if 0 1846 /* Pause the execution of the current thread for N microseconds. 1847 Returns 0 on completion, or -1 on range error. 1848 See the POSIX:2001 specification 1849 <http://www.opengroup.org/susv3xsh/usleep.html>. */ 1850 # if 0 1851 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1852 # undef usleep 1853 # define usleep rpl_usleep 1854 # endif 1855 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); 1856 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); 1857 # else 1858 # if !1 1859 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); 1860 # endif 1861 _GL_CXXALIAS_SYS (usleep, int, (useconds_t n)); 1862 # endif 1863 _GL_CXXALIASWARN (usleep); 1864 #elif defined GNULIB_POSIXCHECK 1865 # undef usleep 1866 # if HAVE_RAW_DECL_USLEEP 1867 _GL_WARN_ON_USE (usleep, "usleep is unportable - " 1868 "use gnulib module usleep for portability"); 1869 # endif 1870 #endif 1871 1872 1873 #if 0 1874 /* Write up to COUNT bytes starting at BUF to file descriptor FD. 1875 See the POSIX:2008 specification 1876 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */ 1877 # if 0 1878 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1879 # undef write 1880 # define write rpl_write 1881 # endif 1882 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 1883 _GL_ARG_NONNULL ((2))); 1884 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); 1885 # else 1886 /* Need to cast, because on mingw, the third parameter is 1887 unsigned int count 1888 and the return type is 'int'. */ 1889 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count)); 1890 # endif 1891 _GL_CXXALIASWARN (write); 1892 #endif 1893 1894 _GL_INLINE_HEADER_END 1895 1896 #endif /* _GL_UNISTD_H */ 1897 #endif /* _GL_INCLUDING_UNISTD_H */ 1898 #endif /* _GL_UNISTD_H */ 1899