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