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