15
17
along with this program; if not, write to the Free Software Foundation,
16
18
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
21
21
@PRAGMA_SYSTEM_HEADER@
25
/* Special invocation convention:
26
- On mingw, several headers, including <winsock2.h>, include <unistd.h>,
27
but we need to ensure that both the system <unistd.h> and <winsock2.h>
28
are completely included before we replace gethostname. */
29
#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
30
&& !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H
31
/* <unistd.h> is being indirectly included for the first time from
32
<winsock2.h>; avoid declaring any overrides. */
34
# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
36
# error unexpected; report this to bug-gnulib@gnu.org
38
# define _GL_WINSOCK2_H_WITNESS
40
/* Normal invocation. */
41
#elif !defined _@GUARD_PREFIX@_UNISTD_H
24
43
/* The include_next requires a split double-inclusion guard. */
25
44
#if @HAVE_UNISTD_H@
26
45
# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
48
/* Get all possible declarations of gethostname(). */
49
#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
50
&& !defined _GL_INCLUDING_WINSOCK2_H
51
# define _GL_INCLUDING_WINSOCK2_H
52
# include <winsock2.h>
53
# undef _GL_INCLUDING_WINSOCK2_H
56
#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
57
#define _@GUARD_PREFIX@_UNISTD_H
32
59
/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
33
60
#include <stddef.h>
35
62
/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
36
#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
63
/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
64
/* But avoid namespace pollution on glibc systems. */
65
#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
66
|| ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
67
&& defined __CYGWIN__)) \
68
&& ! defined __GLIBC__
37
69
# include <stdio.h>
72
/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
73
/* But avoid namespace pollution on glibc systems. */
74
#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
75
&& ! defined __GLIBC__
40
79
/* mingw fails to declare _exit in <unistd.h>. */
41
80
/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
44
#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
81
/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
82
/* But avoid namespace pollution on glibc systems. */
87
/* mingw declares getcwd in <io.h>, not in <unistd.h>. */
88
#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
89
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
93
/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
94
NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
95
/* But avoid namespace pollution on glibc systems. */
96
#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
97
|| (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
102
#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
103
|| @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
104
|| @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
45
105
/* Get ssize_t. */
46
106
# include <sys/types.h>
49
/* Get getopt(), optarg, optind, opterr, optopt. */
50
#if @GNULIB_UNISTD_H_GETOPT@
109
/* Get getopt(), optarg, optind, opterr, optopt.
110
But avoid namespace pollution on glibc systems. */
111
#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
51
112
# include <getopt.h>
54
#if @GNULIB_GETHOSTNAME@
55
/* Get all possible declarations of gethostname(). */
56
# if @UNISTD_H_HAVE_WINSOCK2_H@
57
# include <winsock2.h>
58
# if !defined _GL_SYS_SOCKET_H
115
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
117
/* The definition of _GL_ARG_NONNULL is copied here. */
119
/* The definition of _GL_WARN_ON_USE is copied here. */
122
/* Hide some function declarations from <winsock2.h>. */
124
#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
125
# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
126
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
60
# define socket socket_used_without_including_sys_socket_h
128
# define socket socket_used_without_including_sys_socket_h
62
# define connect connect_used_without_including_sys_socket_h
130
# define connect connect_used_without_including_sys_socket_h
64
# define accept accept_used_without_including_sys_socket_h
132
# define accept accept_used_without_including_sys_socket_h
66
# define bind bind_used_without_including_sys_socket_h
134
# define bind bind_used_without_including_sys_socket_h
67
135
# undef getpeername
68
# define getpeername getpeername_used_without_including_sys_socket_h
136
# define getpeername getpeername_used_without_including_sys_socket_h
69
137
# undef getsockname
70
# define getsockname getsockname_used_without_including_sys_socket_h
138
# define getsockname getsockname_used_without_including_sys_socket_h
71
139
# undef getsockopt
72
# define getsockopt getsockopt_used_without_including_sys_socket_h
140
# define getsockopt getsockopt_used_without_including_sys_socket_h
74
# define listen listen_used_without_including_sys_socket_h
142
# define listen listen_used_without_including_sys_socket_h
76
# define recv recv_used_without_including_sys_socket_h
144
# define recv recv_used_without_including_sys_socket_h
78
# define send send_used_without_including_sys_socket_h
146
# define send send_used_without_including_sys_socket_h
80
# define recvfrom recvfrom_used_without_including_sys_socket_h
148
# define recvfrom recvfrom_used_without_including_sys_socket_h
82
# define sendto sendto_used_without_including_sys_socket_h
150
# define sendto sendto_used_without_including_sys_socket_h
83
151
# undef setsockopt
84
# define setsockopt setsockopt_used_without_including_sys_socket_h
152
# define setsockopt setsockopt_used_without_including_sys_socket_h
86
# define shutdown shutdown_used_without_including_sys_socket_h
154
# define shutdown shutdown_used_without_including_sys_socket_h
156
_GL_WARN_ON_USE (socket,
157
"socket() used without including <sys/socket.h>");
158
_GL_WARN_ON_USE (connect,
159
"connect() used without including <sys/socket.h>");
160
_GL_WARN_ON_USE (accept,
161
"accept() used without including <sys/socket.h>");
162
_GL_WARN_ON_USE (bind,
163
"bind() used without including <sys/socket.h>");
164
_GL_WARN_ON_USE (getpeername,
165
"getpeername() used without including <sys/socket.h>");
166
_GL_WARN_ON_USE (getsockname,
167
"getsockname() used without including <sys/socket.h>");
168
_GL_WARN_ON_USE (getsockopt,
169
"getsockopt() used without including <sys/socket.h>");
170
_GL_WARN_ON_USE (listen,
171
"listen() used without including <sys/socket.h>");
172
_GL_WARN_ON_USE (recv,
173
"recv() used without including <sys/socket.h>");
174
_GL_WARN_ON_USE (send,
175
"send() used without including <sys/socket.h>");
176
_GL_WARN_ON_USE (recvfrom,
177
"recvfrom() used without including <sys/socket.h>");
178
_GL_WARN_ON_USE (sendto,
179
"sendto() used without including <sys/socket.h>");
180
_GL_WARN_ON_USE (setsockopt,
181
"setsockopt() used without including <sys/socket.h>");
182
_GL_WARN_ON_USE (shutdown,
183
"shutdown() used without including <sys/socket.h>");
88
# if !defined _GL_SYS_SELECT_H
186
# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
187
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
90
# define select select_used_without_including_sys_select_h
189
# define select select_used_without_including_sys_select_h
191
_GL_WARN_ON_USE (select,
192
"select() used without including <sys/select.h>");
95
/* The definition of GL_LINK_WARNING is copied here. */
98
198
/* OS/2 EMX lacks these macros. */
99
199
#ifndef STDIN_FILENO
106
206
# define STDERR_FILENO 2
209
/* Ensure *_OK macros exist. */
109
218
/* Declare overridden functions. */
221
#if defined GNULIB_POSIXCHECK
222
/* The access() function is a security risk. */
223
_GL_WARN_ON_USE (access, "the access function is a security risk - "
224
"use the gnulib module faccessat instead");
116
228
#if @GNULIB_CHOWN@
118
# ifndef REPLACE_CHOWN
119
# define REPLACE_CHOWN 1
122
229
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
123
230
to GID (if GID is not -1). Follow symbolic links.
124
231
Return 0 if successful, otherwise -1 and errno set.
125
232
See the POSIX:2001 specification
126
233
<http://www.opengroup.org/susv3xsh/chown.html>. */
235
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
127
237
# define chown rpl_chown
128
extern int chown (const char *file, uid_t uid, gid_t gid);
239
_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
240
_GL_ARG_NONNULL ((1)));
241
_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
244
_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
245
_GL_ARG_NONNULL ((1)));
247
_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
249
_GL_CXXALIASWARN (chown);
131
250
#elif defined GNULIB_POSIXCHECK
133
# define chown(f,u,g) \
134
(GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
135
"doesn't treat a uid or gid of -1 on some systems - " \
136
"use gnulib module chown for portability"), \
252
# if HAVE_RAW_DECL_CHOWN
253
_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
254
"doesn't treat a uid or gid of -1 on some systems - "
255
"use gnulib module chown for portability");
141
260
#if @GNULIB_CLOSE@
142
261
# if @REPLACE_CLOSE@
143
262
/* Automatically included by modules that need a replacement for close. */
145
# define close rpl_close
146
extern int close (int);
263
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
265
# define close rpl_close
267
_GL_FUNCDECL_RPL (close, int, (int fd));
268
_GL_CXXALIAS_RPL (close, int, (int fd));
270
_GL_CXXALIAS_SYS (close, int, (int fd));
272
_GL_CXXALIASWARN (close);
148
273
#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
150
275
# define close close_used_without_requesting_gnulib_module_close
151
276
#elif defined GNULIB_POSIXCHECK
154
(GL_LINK_WARNING ("close does not portably work on sockets - " \
155
"use gnulib module close for portability"), \
278
/* Assume close is always declared. */
279
_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
280
"use gnulib module close for portability");
285
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
288
_GL_FUNCDECL_RPL (dup, int, (int oldfd));
289
_GL_CXXALIAS_RPL (dup, int, (int oldfd));
291
_GL_CXXALIAS_SYS (dup, int, (int oldfd));
293
_GL_CXXALIASWARN (dup);
160
296
#if @GNULIB_DUP2@
162
# define dup2 rpl_dup2
164
# if !@HAVE_DUP2@ || @REPLACE_DUP2@
165
297
/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
166
298
NEWFD = OLDFD, otherwise close NEWFD first if it is open.
167
299
Return newfd if successful, otherwise -1 and errno set.
168
300
See the POSIX:2001 specification
169
301
<http://www.opengroup.org/susv3xsh/dup2.html>. */
170
extern int dup2 (int oldfd, int newfd);
303
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
304
# define dup2 rpl_dup2
306
_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
307
_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
310
_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
312
_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
314
_GL_CXXALIASWARN (dup2);
172
315
#elif defined GNULIB_POSIXCHECK
175
(GL_LINK_WARNING ("dup2 is unportable - " \
176
"use gnulib module dup2 for portability"), \
317
# if HAVE_RAW_DECL_DUP2
318
_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
319
"use gnulib module dup2 for portability");
208
358
# include <crt_externs.h>
209
359
# define environ (*_NSGetEnviron ())
211
364
extern char **environ;
214
370
#elif defined GNULIB_POSIXCHECK
217
(GL_LINK_WARNING ("environ is unportable - " \
218
"use gnulib module environ for portability"), \
371
# if HAVE_RAW_DECL_ENVIRON
372
static inline char ***
377
_GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
378
"use gnulib module environ for portability");
380
# define environ (*rpl_environ ())
223
385
#if @GNULIB_EUIDACCESS@
386
/* Like access(), except that it uses the effective user id and group id of
387
the current process. */
224
388
# if !@HAVE_EUIDACCESS@
225
/* Like access(), except that is uses the effective user id and group id of
226
the current process. */
227
extern int euidaccess (const char *filename, int mode);
389
_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
390
_GL_ARG_NONNULL ((1)));
392
_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
393
_GL_CXXALIASWARN (euidaccess);
394
# if defined GNULIB_POSIXCHECK
395
/* Like access(), this function is a security risk. */
396
_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
397
"use the gnulib module faccessat instead");
229
399
#elif defined GNULIB_POSIXCHECK
230
400
# undef euidaccess
231
# define euidaccess(f,m) \
232
(GL_LINK_WARNING ("euidaccess is unportable - " \
233
"use gnulib module euidaccess for portability"), \
401
# if HAVE_RAW_DECL_EUIDACCESS
402
_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
403
"use gnulib module euidaccess for portability");
408
#if @GNULIB_FACCESSAT@
409
# if !@HAVE_FACCESSAT@
410
_GL_FUNCDECL_SYS (faccessat, int,
411
(int fd, char const *file, int mode, int flag)
412
_GL_ARG_NONNULL ((2)));
414
_GL_CXXALIAS_SYS (faccessat, int,
415
(int fd, char const *file, int mode, int flag));
416
_GL_CXXALIASWARN (faccessat);
417
#elif defined GNULIB_POSIXCHECK
419
# if HAVE_RAW_DECL_FACCESSAT
420
_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
421
"use gnulib module faccessat for portability");
238
426
#if @GNULIB_FCHDIR@
239
# if @REPLACE_FCHDIR@
241
427
/* Change the process' current working directory to the directory on which
242
428
the given file descriptor is open.
243
429
Return 0 if successful, otherwise -1 and errno set.
244
430
See the POSIX:2001 specification
245
431
<http://www.opengroup.org/susv3xsh/fchdir.html>. */
246
extern int fchdir (int /*fd*/);
249
extern int dup (int);
433
_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
251
435
/* Gnulib internal hooks needed to maintain the fchdir metadata. */
252
extern int _gl_register_fd (int fd, const char *filename);
253
extern void _gl_unregister_fd (int fd);
254
extern int _gl_register_dup (int oldfd, int newfd);
255
extern const char *_gl_directory_name (int fd);
436
_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
437
_GL_ARG_NONNULL ((2));
438
_GL_EXTERN_C void _gl_unregister_fd (int fd);
439
_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
440
_GL_EXTERN_C const char *_gl_directory_name (int fd);
443
# if !@HAVE_DECL_FCHDIR@
444
_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
447
_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
448
_GL_CXXALIASWARN (fchdir);
258
449
#elif defined GNULIB_POSIXCHECK
261
(GL_LINK_WARNING ("fchdir is unportable - " \
262
"use gnulib module fchdir for portability"), \
451
# if HAVE_RAW_DECL_FCHDIR
452
_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
453
"use gnulib module fchdir for portability");
458
#if @GNULIB_FCHOWNAT@
459
# if @REPLACE_FCHOWNAT@
460
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
462
# define fchownat rpl_fchownat
464
_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
465
uid_t owner, gid_t group, int flag)
466
_GL_ARG_NONNULL ((2)));
467
_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
468
uid_t owner, gid_t group, int flag));
470
# if !@HAVE_FCHOWNAT@
471
_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
472
uid_t owner, gid_t group, int flag)
473
_GL_ARG_NONNULL ((2)));
475
_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
476
uid_t owner, gid_t group, int flag));
478
_GL_CXXALIASWARN (fchownat);
479
#elif defined GNULIB_POSIXCHECK
481
# if HAVE_RAW_DECL_FCHOWNAT
482
_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
483
"use gnulib module openat for portability");
270
491
See POSIX:2001 specification
271
492
<http://www.opengroup.org/susv3xsh/fsync.html>. */
272
493
# if !@HAVE_FSYNC@
273
extern int fsync (int fd);
494
_GL_FUNCDECL_SYS (fsync, int, (int fd));
496
_GL_CXXALIAS_SYS (fsync, int, (int fd));
497
_GL_CXXALIASWARN (fsync);
275
498
#elif defined GNULIB_POSIXCHECK
278
(GL_LINK_WARNING ("fsync is unportable - " \
279
"use gnulib module fsync for portability"), \
500
# if HAVE_RAW_DECL_FSYNC
501
_GL_WARN_ON_USE (fsync, "fsync is unportable - "
502
"use gnulib module fsync for portability");
284
507
#if @GNULIB_FTRUNCATE@
285
# if !@HAVE_FTRUNCATE@
286
508
/* Change the size of the file to which FD is opened to become equal to LENGTH.
287
509
Return 0 if successful, otherwise -1 and errno set.
288
510
See the POSIX:2001 specification
289
511
<http://www.opengroup.org/susv3xsh/ftruncate.html>. */
290
extern int ftruncate (int fd, off_t length);
512
# if !@HAVE_FTRUNCATE@
513
_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
515
_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
516
_GL_CXXALIASWARN (ftruncate);
292
517
#elif defined GNULIB_POSIXCHECK
293
518
# undef ftruncate
294
# define ftruncate(f,l) \
295
(GL_LINK_WARNING ("ftruncate is unportable - " \
296
"use gnulib module ftruncate for portability"), \
519
# if HAVE_RAW_DECL_FTRUNCATE
520
_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
521
"use gnulib module ftruncate for portability");
301
526
#if @GNULIB_GETCWD@
302
/* Include the headers that might declare getcwd so that they will not
303
cause confusion if included after this file. */
305
# if @REPLACE_GETCWD@
306
527
/* Get the name of the current working directory, and put it in SIZE bytes
308
529
Return BUF if successful, or NULL if the directory couldn't be determined
336
566
Null terminate it if the name is shorter than LEN.
337
567
If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
338
568
Return 0 if successful, otherwise set errno and return -1. */
339
# if !@HAVE_GETDOMAINNAME@
340
extern int getdomainname(char *name, size_t len);
569
# if @REPLACE_GETDOMAINNAME@
570
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
571
# undef getdomainname
572
# define getdomainname rpl_getdomainname
574
_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
575
_GL_ARG_NONNULL ((1)));
576
_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
578
# if !@HAVE_DECL_GETDOMAINNAME@
579
_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
580
_GL_ARG_NONNULL ((1)));
582
_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
584
_GL_CXXALIASWARN (getdomainname);
342
585
#elif defined GNULIB_POSIXCHECK
343
586
# undef getdomainname
344
# define getdomainname(n,l) \
345
(GL_LINK_WARNING ("getdomainname is unportable - " \
346
"use gnulib module getdomainname for portability"), \
347
getdomainname (n, l))
587
# if HAVE_RAW_DECL_GETDOMAINNAME
588
_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
589
"use gnulib module getdomainname for portability");
351
594
#if @GNULIB_GETDTABLESIZE@
352
# if !@HAVE_GETDTABLESIZE@
353
595
/* Return the maximum number of file descriptors in the current process.
354
596
In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
355
extern int getdtablesize (void);
597
# if !@HAVE_GETDTABLESIZE@
598
_GL_FUNCDECL_SYS (getdtablesize, int, (void));
600
_GL_CXXALIAS_SYS (getdtablesize, int, (void));
601
_GL_CXXALIASWARN (getdtablesize);
357
602
#elif defined GNULIB_POSIXCHECK
358
603
# undef getdtablesize
359
# define getdtablesize() \
360
(GL_LINK_WARNING ("getdtablesize is unportable - " \
361
"use gnulib module getdtablesize for portability"), \
604
# if HAVE_RAW_DECL_GETDTABLESIZE
605
_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
606
"use gnulib module getdtablesize for portability");
611
#if @GNULIB_GETGROUPS@
612
/* Return the supplemental groups that the current process belongs to.
613
It is unspecified whether the effective group id is in the list.
614
If N is 0, return the group count; otherwise, N describes how many
615
entries are available in GROUPS. Return -1 and set errno if N is
616
not 0 and not large enough. Fails with ENOSYS on some systems. */
617
# if @REPLACE_GETGROUPS@
618
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
620
# define getgroups rpl_getgroups
622
_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
623
_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
625
# if !@HAVE_GETGROUPS@
626
_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
628
_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
630
_GL_CXXALIASWARN (getgroups);
631
#elif defined GNULIB_POSIXCHECK
633
# if HAVE_RAW_DECL_GETGROUPS
634
_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
635
"use gnulib module getgroups for portability");
372
646
If the host name is longer than LEN, set errno = EINVAL and return -1.
373
647
Return 0 if successful, otherwise set errno and return -1. */
374
648
# if @UNISTD_H_HAVE_WINSOCK2_H@
376
# define gethostname rpl_gethostname
378
# if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
379
extern int gethostname(char *name, size_t len);
649
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
651
# define gethostname rpl_gethostname
653
_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
654
_GL_ARG_NONNULL ((1)));
655
_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
657
# if !@HAVE_GETHOSTNAME@
658
_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
659
_GL_ARG_NONNULL ((1)));
661
/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
664
_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
666
_GL_CXXALIASWARN (gethostname);
381
667
#elif @UNISTD_H_HAVE_WINSOCK2_H@
382
668
# undef gethostname
383
669
# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
384
670
#elif defined GNULIB_POSIXCHECK
385
671
# undef gethostname
386
# define gethostname(n,l) \
387
(GL_LINK_WARNING ("gethostname is unportable - " \
388
"use gnulib module gethostname for portability"), \
672
# if HAVE_RAW_DECL_GETHOSTNAME
673
_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
674
"use gnulib module gethostname for portability");
679
#if @GNULIB_GETLOGIN@
680
/* Returns the user's login name, or NULL if it cannot be found. Upon error,
681
returns NULL with errno set.
683
See <http://www.opengroup.org/susv3xsh/getlogin.html>.
685
Most programs don't need to use this function, because the information is
686
available through environment variables:
687
${LOGNAME-$USER} on Unix platforms,
688
$USERNAME on native Windows platforms.
690
# if !@HAVE_GETLOGIN@
691
_GL_FUNCDECL_SYS (getlogin, char *, (void));
693
_GL_CXXALIAS_SYS (getlogin, char *, (void));
694
_GL_CXXALIASWARN (getlogin);
695
#elif defined GNULIB_POSIXCHECK
697
# if HAVE_RAW_DECL_GETLOGIN
698
_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
699
"use gnulib module getlogin for portability");
399
710
provided (this case is hopefully rare but is left open by the POSIX spec).
401
712
See <http://www.opengroup.org/susv3xsh/getlogin.html>.
714
Most programs don't need to use this function, because the information is
715
available through environment variables:
716
${LOGNAME-$USER} on Unix platforms,
717
$USERNAME on native Windows platforms.
403
# if !@HAVE_DECL_GETLOGIN_R@
404
extern int getlogin_r (char *name, size_t size);
719
# if @REPLACE_GETLOGIN_R@
720
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
721
# define getlogin_r rpl_getlogin_r
723
_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
724
_GL_ARG_NONNULL ((1)));
725
_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
727
# if !@HAVE_DECL_GETLOGIN_R@
728
_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
729
_GL_ARG_NONNULL ((1)));
731
/* Need to cast, because on Solaris 10 systems, the second argument is
733
_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
735
_GL_CXXALIASWARN (getlogin_r);
406
736
#elif defined GNULIB_POSIXCHECK
407
737
# undef getlogin_r
408
# define getlogin_r(n,s) \
409
(GL_LINK_WARNING ("getlogin_r is unportable - " \
410
"use gnulib module getlogin_r for portability"), \
738
# if HAVE_RAW_DECL_GETLOGIN_R
739
_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
740
"use gnulib module getlogin_r for portability");
415
745
#if @GNULIB_GETPAGESIZE@
416
746
# if @REPLACE_GETPAGESIZE@
417
# define getpagesize rpl_getpagesize
418
extern int getpagesize (void);
419
# elif !@HAVE_GETPAGESIZE@
747
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
748
# define getpagesize rpl_getpagesize
750
_GL_FUNCDECL_RPL (getpagesize, int, (void));
751
_GL_CXXALIAS_RPL (getpagesize, int, (void));
753
# if !@HAVE_GETPAGESIZE@
754
# if !defined getpagesize
420
755
/* This is for POSIX systems. */
421
# if !defined getpagesize && defined _SC_PAGESIZE
422
# if ! (defined __VMS && __VMS_VER < 70000000)
423
# define getpagesize() sysconf (_SC_PAGESIZE)
756
# if !defined _gl_getpagesize && defined _SC_PAGESIZE
757
# if ! (defined __VMS && __VMS_VER < 70000000)
758
# define _gl_getpagesize() sysconf (_SC_PAGESIZE)
426
761
/* This is for older VMS. */
427
# if !defined getpagesize && defined __VMS
429
# define getpagesize() 8192
431
# define getpagesize() 512
762
# if !defined _gl_getpagesize && defined __VMS
764
# define _gl_getpagesize() 8192
766
# define _gl_getpagesize() 512
434
769
/* This is for BeOS. */
435
# if !defined getpagesize && @HAVE_OS_H@
437
# if defined B_PAGE_SIZE
438
# define getpagesize() B_PAGE_SIZE
770
# if !defined _gl_getpagesize && @HAVE_OS_H@
772
# if defined B_PAGE_SIZE
773
# define _gl_getpagesize() B_PAGE_SIZE
441
776
/* This is for AmigaOS4.0. */
442
# if !defined getpagesize && defined __amigaos4__
443
# define getpagesize() 2048
777
# if !defined _gl_getpagesize && defined __amigaos4__
778
# define _gl_getpagesize() 2048
445
780
/* This is for older Unix systems. */
446
# if !defined getpagesize && @HAVE_SYS_PARAM_H@
447
# include <sys/param.h>
448
# ifdef EXEC_PAGESIZE
449
# define getpagesize() EXEC_PAGESIZE
781
# if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
782
# include <sys/param.h>
783
# ifdef EXEC_PAGESIZE
784
# define _gl_getpagesize() EXEC_PAGESIZE
790
# define _gl_getpagesize() (NBPG * CLSIZE)
793
# define _gl_getpagesize() NBPC
455
# define getpagesize() (NBPG * CLSIZE)
798
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
799
# define getpagesize() _gl_getpagesize ()
458
# define getpagesize() NBPC
801
# if !GNULIB_defined_getpagesize_function
805
return _gl_getpagesize ();
807
# define GNULIB_defined_getpagesize_function 1
812
/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
813
_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
815
# if @HAVE_DECL_GETPAGESIZE@
816
_GL_CXXALIASWARN (getpagesize);
464
818
#elif defined GNULIB_POSIXCHECK
465
819
# undef getpagesize
466
# define getpagesize() \
467
(GL_LINK_WARNING ("getpagesize is unportable - " \
468
"use gnulib module getpagesize for portability"), \
820
# if HAVE_RAW_DECL_GETPAGESIZE
821
_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
822
"use gnulib module getpagesize for portability");
473
827
#if @GNULIB_GETUSERSHELL@
474
# if !@HAVE_GETUSERSHELL@
475
828
/* Return the next valid login shell on the system, or NULL when the end of
476
829
the list has been reached. */
477
extern char *getusershell (void);
830
# if !@HAVE_DECL_GETUSERSHELL@
831
_GL_FUNCDECL_SYS (getusershell, char *, (void));
833
_GL_CXXALIAS_SYS (getusershell, char *, (void));
834
_GL_CXXALIASWARN (getusershell);
835
#elif defined GNULIB_POSIXCHECK
837
# if HAVE_RAW_DECL_GETUSERSHELL
838
_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
839
"use gnulib module getusershell for portability");
843
#if @GNULIB_GETUSERSHELL@
478
844
/* Rewind to pointer that is advanced at each getusershell() call. */
479
extern void setusershell (void);
845
# if !@HAVE_DECL_GETUSERSHELL@
846
_GL_FUNCDECL_SYS (setusershell, void, (void));
848
_GL_CXXALIAS_SYS (setusershell, void, (void));
849
_GL_CXXALIASWARN (setusershell);
850
#elif defined GNULIB_POSIXCHECK
852
# if HAVE_RAW_DECL_SETUSERSHELL
853
_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
854
"use gnulib module getusershell for portability");
858
#if @GNULIB_GETUSERSHELL@
480
859
/* Free the pointer that is advanced at each getusershell() call and
481
860
associated resources. */
482
extern void endusershell (void);
861
# if !@HAVE_DECL_GETUSERSHELL@
862
_GL_FUNCDECL_SYS (endusershell, void, (void));
864
_GL_CXXALIAS_SYS (endusershell, void, (void));
865
_GL_CXXALIASWARN (endusershell);
484
866
#elif defined GNULIB_POSIXCHECK
486
# define getusershell() \
487
(GL_LINK_WARNING ("getusershell is unportable - " \
488
"use gnulib module getusershell for portability"), \
491
# define setusershell() \
492
(GL_LINK_WARNING ("setusershell is unportable - " \
493
"use gnulib module getusershell for portability"), \
495
867
# undef endusershell
496
# define endusershell() \
497
(GL_LINK_WARNING ("endusershell is unportable - " \
498
"use gnulib module getusershell for portability"), \
868
# if HAVE_RAW_DECL_ENDUSERSHELL
869
_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
870
"use gnulib module getusershell for portability");
875
#if @GNULIB_GROUP_MEMBER@
876
/* Determine whether group id is in calling user's group list. */
877
# if !@HAVE_GROUP_MEMBER@
878
_GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
880
_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
881
_GL_CXXALIASWARN (group_member);
882
#elif defined GNULIB_POSIXCHECK
884
# if HAVE_RAW_DECL_GROUP_MEMBER
885
_GL_WARN_ON_USE (group_member, "group_member is unportable - "
886
"use gnulib module group-member for portability");
503
891
#if @GNULIB_LCHOWN@
504
# if @REPLACE_LCHOWN@
505
892
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
506
893
to GID (if GID is not -1). Do not follow symbolic links.
507
894
Return 0 if successful, otherwise -1 and errno set.
508
895
See the POSIX:2001 specification
509
896
<http://www.opengroup.org/susv3xsh/lchown.html>. */
510
# define lchown rpl_lchown
511
extern int lchown (char const *file, uid_t owner, gid_t group);
897
# if @REPLACE_LCHOWN@
898
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
900
# define lchown rpl_lchown
902
_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
903
_GL_ARG_NONNULL ((1)));
904
_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
907
_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
908
_GL_ARG_NONNULL ((1)));
910
_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
912
_GL_CXXALIASWARN (lchown);
513
913
#elif defined GNULIB_POSIXCHECK
515
# define lchown(f,u,g) \
516
(GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
517
"systems - use gnulib module lchown for portability"), \
915
# if HAVE_RAW_DECL_LCHOWN
916
_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
917
"use gnulib module lchown for portability");
524
924
Return 0 if successful, otherwise -1 and errno set.
525
925
See POSIX:2001 specification
526
926
<http://www.opengroup.org/susv3xsh/link.html>. */
528
extern int link (const char *path1, const char *path2);
928
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
929
# define link rpl_link
931
_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
932
_GL_ARG_NONNULL ((1, 2)));
933
_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
936
_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
937
_GL_ARG_NONNULL ((1, 2)));
939
_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
941
_GL_CXXALIASWARN (link);
530
942
#elif defined GNULIB_POSIXCHECK
532
# define link(path1,path2) \
533
(GL_LINK_WARNING ("link is unportable - " \
534
"use gnulib module link for portability"), \
944
# if HAVE_RAW_DECL_LINK
945
_GL_WARN_ON_USE (link, "link is unportable - "
946
"use gnulib module link for portability");
952
/* Create a new hard link for an existing file, relative to two
953
directories. FLAG controls whether symlinks are followed.
954
Return 0 if successful, otherwise -1 and errno set. */
955
# if @REPLACE_LINKAT@
956
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
958
# define linkat rpl_linkat
960
_GL_FUNCDECL_RPL (linkat, int,
961
(int fd1, const char *path1, int fd2, const char *path2,
963
_GL_ARG_NONNULL ((2, 4)));
964
_GL_CXXALIAS_RPL (linkat, int,
965
(int fd1, const char *path1, int fd2, const char *path2,
969
_GL_FUNCDECL_SYS (linkat, int,
970
(int fd1, const char *path1, int fd2, const char *path2,
972
_GL_ARG_NONNULL ((2, 4)));
974
_GL_CXXALIAS_SYS (linkat, int,
975
(int fd1, const char *path1, int fd2, const char *path2,
978
_GL_CXXALIASWARN (linkat);
979
#elif defined GNULIB_POSIXCHECK
981
# if HAVE_RAW_DECL_LINKAT
982
_GL_WARN_ON_USE (linkat, "linkat is unportable - "
983
"use gnulib module linkat for portability");
539
988
#if @GNULIB_LSEEK@
541
989
/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
542
990
Return the new offset if successful, otherwise -1 and errno set.
543
991
See the POSIX:2001 specification
544
992
<http://www.opengroup.org/susv3xsh/lseek.html>. */
545
# define lseek rpl_lseek
546
extern off_t lseek (int fd, off_t offset, int whence);
994
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
995
# define lseek rpl_lseek
997
_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
998
_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1000
_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1002
_GL_CXXALIASWARN (lseek);
548
1003
#elif defined GNULIB_POSIXCHECK
550
# define lseek(f,o,w) \
551
(GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
552
"systems - use gnulib module lseek for portability"), \
1005
# if HAVE_RAW_DECL_LSEEK
1006
_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1007
"systems - use gnulib module lseek for portability");
1013
/* Create a pipe, defaulting to O_BINARY mode.
1014
Store the read-end as fd[0] and the write-end as fd[1].
1015
Return 0 upon success, or -1 with errno set upon failure. */
1017
_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1019
_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1020
_GL_CXXALIASWARN (pipe);
1021
#elif defined GNULIB_POSIXCHECK
1023
# if HAVE_RAW_DECL_PIPE
1024
_GL_WARN_ON_USE (pipe, "pipe is unportable - "
1025
"use gnulib module pipe-posix for portability");
564
1037
See also the Linux man page at
565
1038
<http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
566
1039
# if @HAVE_PIPE2@
567
# define pipe2 rpl_pipe2
1040
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1041
# define pipe2 rpl_pipe2
1043
_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1044
_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1046
_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1047
_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
569
extern int pipe2 (int fd[2], int flags);
1049
_GL_CXXALIASWARN (pipe2);
570
1050
#elif defined GNULIB_POSIXCHECK
572
# define pipe2(f,o) \
573
(GL_LINK_WARNING ("pipe2 is unportable - " \
574
"use gnulib module pipe2 for portability"), \
1052
# if HAVE_RAW_DECL_PIPE2
1053
_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1054
"use gnulib module pipe2 for portability");
1060
/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1061
Return the number of bytes placed into BUF if successful, otherwise
1062
set errno and return -1. 0 indicates EOF. See the POSIX:2001
1063
specification <http://www.opengroup.org/susv3xsh/pread.html>. */
1064
# if @REPLACE_PREAD@
1065
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1067
# define pread rpl_pread
1069
_GL_FUNCDECL_RPL (pread, ssize_t,
1070
(int fd, void *buf, size_t bufsize, off_t offset)
1071
_GL_ARG_NONNULL ((2)));
1072
_GL_CXXALIAS_RPL (pread, ssize_t,
1073
(int fd, void *buf, size_t bufsize, off_t offset));
1076
_GL_FUNCDECL_SYS (pread, ssize_t,
1077
(int fd, void *buf, size_t bufsize, off_t offset)
1078
_GL_ARG_NONNULL ((2)));
1080
_GL_CXXALIAS_SYS (pread, ssize_t,
1081
(int fd, void *buf, size_t bufsize, off_t offset));
1083
_GL_CXXALIASWARN (pread);
1084
#elif defined GNULIB_POSIXCHECK
1086
# if HAVE_RAW_DECL_PREAD
1087
_GL_WARN_ON_USE (pread, "pread is unportable - "
1088
"use gnulib module pread for portability");
1094
/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1095
Return the number of bytes written if successful, otherwise
1096
set errno and return -1. 0 indicates nothing written. See the
1097
POSIX:2001 specification
1098
<http://www.opengroup.org/susv3xsh/pwrite.html>. */
1099
# if @REPLACE_PWRITE@
1100
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1102
# define pwrite rpl_pwrite
1104
_GL_FUNCDECL_RPL (pwrite, ssize_t,
1105
(int fd, const void *buf, size_t bufsize, off_t offset)
1106
_GL_ARG_NONNULL ((2)));
1107
_GL_CXXALIAS_RPL (pwrite, ssize_t,
1108
(int fd, const void *buf, size_t bufsize, off_t offset));
1111
_GL_FUNCDECL_SYS (pwrite, ssize_t,
1112
(int fd, const void *buf, size_t bufsize, off_t offset)
1113
_GL_ARG_NONNULL ((2)));
1115
_GL_CXXALIAS_SYS (pwrite, ssize_t,
1116
(int fd, const void *buf, size_t bufsize, off_t offset));
1118
_GL_CXXALIASWARN (pwrite);
1119
#elif defined GNULIB_POSIXCHECK
1121
# if HAVE_RAW_DECL_PWRITE
1122
_GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1123
"use gnulib module pwrite for portability");
1129
/* Read up to COUNT bytes from file descriptor FD into the buffer starting
1130
at BUF. See the POSIX:2001 specification
1131
<http://www.opengroup.org/susv3xsh/read.html>. */
1132
# if @REPLACE_READ@ && @GNULIB_UNISTD_H_NONBLOCKING@
1133
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1135
# define read rpl_read
1137
_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1138
_GL_ARG_NONNULL ((2)));
1139
_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1141
/* Need to cast, because on mingw, the third parameter is
1143
and the return type is 'int'. */
1144
_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1146
_GL_CXXALIASWARN (read);
582
1153
successful, otherwise -1 and errno set.
583
1154
See the POSIX:2001 specification
584
1155
<http://www.opengroup.org/susv3xsh/readlink.html>. */
585
# if !@HAVE_READLINK@
586
extern int readlink (const char *file, char *buf, size_t bufsize);
1156
# if @REPLACE_READLINK@
1157
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1158
# define readlink rpl_readlink
1160
_GL_FUNCDECL_RPL (readlink, ssize_t,
1161
(const char *file, char *buf, size_t bufsize)
1162
_GL_ARG_NONNULL ((1, 2)));
1163
_GL_CXXALIAS_RPL (readlink, ssize_t,
1164
(const char *file, char *buf, size_t bufsize));
1166
# if !@HAVE_READLINK@
1167
_GL_FUNCDECL_SYS (readlink, ssize_t,
1168
(const char *file, char *buf, size_t bufsize)
1169
_GL_ARG_NONNULL ((1, 2)));
1171
_GL_CXXALIAS_SYS (readlink, ssize_t,
1172
(const char *file, char *buf, size_t bufsize));
1174
_GL_CXXALIASWARN (readlink);
588
1175
#elif defined GNULIB_POSIXCHECK
589
1176
# undef readlink
590
# define readlink(f,b,s) \
591
(GL_LINK_WARNING ("readlink is unportable - " \
592
"use gnulib module readlink for portability"), \
1177
# if HAVE_RAW_DECL_READLINK
1178
_GL_WARN_ON_USE (readlink, "readlink is unportable - "
1179
"use gnulib module readlink for portability");
1184
#if @GNULIB_READLINKAT@
1185
# if !@HAVE_READLINKAT@
1186
_GL_FUNCDECL_SYS (readlinkat, ssize_t,
1187
(int fd, char const *file, char *buf, size_t len)
1188
_GL_ARG_NONNULL ((2, 3)));
1190
_GL_CXXALIAS_SYS (readlinkat, ssize_t,
1191
(int fd, char const *file, char *buf, size_t len));
1192
_GL_CXXALIASWARN (readlinkat);
1193
#elif defined GNULIB_POSIXCHECK
1195
# if HAVE_RAW_DECL_READLINKAT
1196
_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1197
"use gnulib module readlinkat for portability");
1203
/* Remove the directory DIR. */
1204
# if @REPLACE_RMDIR@
1205
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1206
# define rmdir rpl_rmdir
1208
_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1209
_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1211
_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1213
_GL_CXXALIASWARN (rmdir);
1214
#elif defined GNULIB_POSIXCHECK
1216
# if HAVE_RAW_DECL_RMDIR
1217
_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1218
"use gnulib module rmdir for portability");
599
1225
Returns the number of seconds left to sleep.
600
1226
See the POSIX:2001 specification
601
1227
<http://www.opengroup.org/susv3xsh/sleep.html>. */
603
extern unsigned int sleep (unsigned int n);
1228
# if @REPLACE_SLEEP@
1229
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1231
# define sleep rpl_sleep
1233
_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1234
_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1237
_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1239
_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1241
_GL_CXXALIASWARN (sleep);
605
1242
#elif defined GNULIB_POSIXCHECK
608
(GL_LINK_WARNING ("sleep is unportable - " \
609
"use gnulib module sleep for portability"), \
614
#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
1244
# if HAVE_RAW_DECL_SLEEP
1245
_GL_WARN_ON_USE (sleep, "sleep is unportable - "
1246
"use gnulib module sleep for portability");
1251
#if @GNULIB_SYMLINK@
1252
# if @REPLACE_SYMLINK@
1253
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1255
# define symlink rpl_symlink
1257
_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1258
_GL_ARG_NONNULL ((1, 2)));
1259
_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1261
# if !@HAVE_SYMLINK@
1262
_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1263
_GL_ARG_NONNULL ((1, 2)));
1265
_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1267
_GL_CXXALIASWARN (symlink);
1268
#elif defined GNULIB_POSIXCHECK
1270
# if HAVE_RAW_DECL_SYMLINK
1271
_GL_WARN_ON_USE (symlink, "symlink is not portable - "
1272
"use gnulib module symlink for portability");
1277
#if @GNULIB_SYMLINKAT@
1278
# if !@HAVE_SYMLINKAT@
1279
_GL_FUNCDECL_SYS (symlinkat, int,
1280
(char const *contents, int fd, char const *file)
1281
_GL_ARG_NONNULL ((1, 3)));
1283
_GL_CXXALIAS_SYS (symlinkat, int,
1284
(char const *contents, int fd, char const *file));
1285
_GL_CXXALIASWARN (symlinkat);
1286
#elif defined GNULIB_POSIXCHECK
1288
# if HAVE_RAW_DECL_SYMLINKAT
1289
_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1290
"use gnulib module symlinkat for portability");
1295
#if @GNULIB_TTYNAME_R@
1296
/* Store at most BUFLEN characters of the pathname of the terminal FD is
1297
open on in BUF. Return 0 on success, otherwise an error number. */
1298
# if @REPLACE_TTYNAME_R@
1299
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1301
# define ttyname_r rpl_ttyname_r
1303
_GL_FUNCDECL_RPL (ttyname_r, int,
1304
(int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1305
_GL_CXXALIAS_RPL (ttyname_r, int,
1306
(int fd, char *buf, size_t buflen));
1308
# if !@HAVE_DECL_TTYNAME_R@
1309
_GL_FUNCDECL_SYS (ttyname_r, int,
1310
(int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1312
_GL_CXXALIAS_SYS (ttyname_r, int,
1313
(int fd, char *buf, size_t buflen));
1315
_GL_CXXALIASWARN (ttyname_r);
1316
#elif defined GNULIB_POSIXCHECK
1318
# if HAVE_RAW_DECL_TTYNAME_R
1319
_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1320
"use gnulib module ttyname_r for portability");
1326
# if @REPLACE_UNLINK@
1327
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1329
# define unlink rpl_unlink
1331
_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1332
_GL_CXXALIAS_RPL (unlink, int, (char const *file));
1334
_GL_CXXALIAS_SYS (unlink, int, (char const *file));
1336
_GL_CXXALIASWARN (unlink);
1337
#elif defined GNULIB_POSIXCHECK
1339
# if HAVE_RAW_DECL_UNLINK
1340
_GL_WARN_ON_USE (unlink, "unlink is not portable - "
1341
"use gnulib module unlink for portability");
1346
#if @GNULIB_UNLINKAT@
1347
# if @REPLACE_UNLINKAT@
1348
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1350
# define unlinkat rpl_unlinkat
1352
_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1353
_GL_ARG_NONNULL ((2)));
1354
_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1356
# if !@HAVE_UNLINKAT@
1357
_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1358
_GL_ARG_NONNULL ((2)));
1360
_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1362
_GL_CXXALIASWARN (unlinkat);
1363
#elif defined GNULIB_POSIXCHECK
1365
# if HAVE_RAW_DECL_UNLINKAT
1366
_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1367
"use gnulib module openat for portability");
1373
/* Pause the execution of the current thread for N microseconds.
1374
Returns 0 on completion, or -1 on range error.
1375
See the POSIX:2001 specification
1376
<http://www.opengroup.org/susv3xsh/sleep.html>. */
1377
# if @REPLACE_USLEEP@
1378
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1380
# define usleep rpl_usleep
1382
_GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1383
_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1386
_GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1388
_GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
1390
_GL_CXXALIASWARN (usleep);
1391
#elif defined GNULIB_POSIXCHECK
1393
# if HAVE_RAW_DECL_USLEEP
1394
_GL_WARN_ON_USE (usleep, "usleep is unportable - "
1395
"use gnulib module usleep for portability");
615
1401
/* Write up to COUNT bytes starting at BUF to file descriptor FD.
616
1402
See the POSIX:2001 specification
617
1403
<http://www.opengroup.org/susv3xsh/write.html>. */
619
# define write rpl_write
620
extern ssize_t write (int fd, const void *buf, size_t count);
629
#endif /* _GL_UNISTD_H */
630
#endif /* _GL_UNISTD_H */
1404
# if @REPLACE_WRITE@ && (@GNULIB_UNISTD_H_NONBLOCKING@ || @GNULIB_UNISTD_H_SIGPIPE@)
1405
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1407
# define write rpl_write
1409
_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1410
_GL_ARG_NONNULL ((2)));
1411
_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1413
/* Need to cast, because on mingw, the third parameter is
1415
and the return type is 'int'. */
1416
_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1418
_GL_CXXALIASWARN (write);
1422
#endif /* _@GUARD_PREFIX@_UNISTD_H */
1423
#endif /* _@GUARD_PREFIX@_UNISTD_H */