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