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