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