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