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