15
15
along with this program; if not, write to the Free Software Foundation,
16
16
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
21
19
@PRAGMA_SYSTEM_HEADER@
22
/* Special invocation convention:
23
- On mingw, several headers, including <winsock2.h>, include <unistd.h>,
24
but we need to ensure that both the system <unistd.h> and <winsock2.h>
25
are completely included before we replace gethostname. */
26
#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
27
&& !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H
28
/* <unistd.h> is being indirectly included for the first time from
29
<winsock2.h>; avoid declaring any overrides. */
31
# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
33
# error unexpected; report this to bug-gnulib@gnu.org
35
# define _GL_WINSOCK2_H_WITNESS
37
/* Normal invocation. */
38
#elif !defined _GL_UNISTD_H
24
40
/* The include_next requires a split double-inclusion guard. */
25
41
#if @HAVE_UNISTD_H@
26
42
# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
45
/* Get all possible declarations of gethostname(). */
46
#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
47
&& !defined _GL_INCLUDING_WINSOCK2_H
48
# define _GL_INCLUDING_WINSOCK2_H
49
# include <winsock2.h>
50
# undef _GL_INCLUDING_WINSOCK2_H
53
#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
30
54
#define _GL_UNISTD_H
56
/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
32
59
/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
33
#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
60
/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
61
/* But avoid namespace pollution on glibc systems. */
62
#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
63
|| (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \
64
&& ! defined __GLIBC__
34
65
# include <stdio.h>
68
/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
69
/* But avoid namespace pollution on glibc systems. */
70
#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__
37
74
/* mingw fails to declare _exit in <unistd.h>. */
38
75
/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
41
#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
76
/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
77
/* But avoid namespace pollution on glibc systems. */
82
/* mingw declares getcwd in <io.h>, not in <unistd.h>. */
83
#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
84
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
88
#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
89
|| @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
43
91
# include <sys/types.h>
94
/* Get getopt(), optarg, optind, opterr, optopt.
95
But avoid namespace pollution on glibc systems. */
96
#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
100
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
102
/* The definition of _GL_ARG_NONNULL is copied here. */
104
/* The definition of _GL_WARN_ON_USE is copied here. */
46
107
#if @GNULIB_GETHOSTNAME@
47
108
/* Get all possible declarations of gethostname(). */
48
109
# if @UNISTD_H_HAVE_WINSOCK2_H@
49
# include <winsock2.h>
50
110
# if !defined _GL_SYS_SOCKET_H
52
# define socket socket_used_without_including_sys_socket_h
54
# define connect connect_used_without_including_sys_socket_h
56
# define accept accept_used_without_including_sys_socket_h
58
# define bind bind_used_without_including_sys_socket_h
60
# define getpeername getpeername_used_without_including_sys_socket_h
62
# define getsockname getsockname_used_without_including_sys_socket_h
64
# define getsockopt getsockopt_used_without_including_sys_socket_h
66
# define listen listen_used_without_including_sys_socket_h
68
# define recv recv_used_without_including_sys_socket_h
70
# define send send_used_without_including_sys_socket_h
72
# define recvfrom recvfrom_used_without_including_sys_socket_h
74
# define sendto sendto_used_without_including_sys_socket_h
76
# define setsockopt setsockopt_used_without_including_sys_socket_h
78
# define shutdown shutdown_used_without_including_sys_socket_h
111
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
113
# define socket socket_used_without_including_sys_socket_h
115
# define connect connect_used_without_including_sys_socket_h
117
# define accept accept_used_without_including_sys_socket_h
119
# define bind bind_used_without_including_sys_socket_h
121
# define getpeername getpeername_used_without_including_sys_socket_h
123
# define getsockname getsockname_used_without_including_sys_socket_h
125
# define getsockopt getsockopt_used_without_including_sys_socket_h
127
# define listen listen_used_without_including_sys_socket_h
129
# define recv recv_used_without_including_sys_socket_h
131
# define send send_used_without_including_sys_socket_h
133
# define recvfrom recvfrom_used_without_including_sys_socket_h
135
# define sendto sendto_used_without_including_sys_socket_h
137
# define setsockopt setsockopt_used_without_including_sys_socket_h
139
# define shutdown shutdown_used_without_including_sys_socket_h
141
_GL_WARN_ON_USE (socket,
142
"socket() used without including <sys/socket.h>");
143
_GL_WARN_ON_USE (connect,
144
"connect() used without including <sys/socket.h>");
145
_GL_WARN_ON_USE (accept,
146
"accept() used without including <sys/socket.h>");
147
_GL_WARN_ON_USE (bind,
148
"bind() used without including <sys/socket.h>");
149
_GL_WARN_ON_USE (getpeername,
150
"getpeername() used without including <sys/socket.h>");
151
_GL_WARN_ON_USE (getsockname,
152
"getsockname() used without including <sys/socket.h>");
153
_GL_WARN_ON_USE (getsockopt,
154
"getsockopt() used without including <sys/socket.h>");
155
_GL_WARN_ON_USE (listen,
156
"listen() used without including <sys/socket.h>");
157
_GL_WARN_ON_USE (recv,
158
"recv() used without including <sys/socket.h>");
159
_GL_WARN_ON_USE (send,
160
"send() used without including <sys/socket.h>");
161
_GL_WARN_ON_USE (recvfrom,
162
"recvfrom() used without including <sys/socket.h>");
163
_GL_WARN_ON_USE (sendto,
164
"sendto() used without including <sys/socket.h>");
165
_GL_WARN_ON_USE (setsockopt,
166
"setsockopt() used without including <sys/socket.h>");
167
_GL_WARN_ON_USE (shutdown,
168
"shutdown() used without including <sys/socket.h>");
80
171
# if !defined _GL_SYS_SELECT_H
82
# define select select_used_without_including_sys_select_h
172
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
174
# define select select_used_without_including_sys_select_h
176
_GL_WARN_ON_USE (select,
177
"select() used without including <sys/select.h>");
87
/* The definition of GL_LINK_WARNING is copied here. */
90
184
/* OS/2 EMX lacks these macros. */
91
185
#ifndef STDIN_FILENO
98
192
# define STDERR_FILENO 2
195
/* Ensure *_OK macros exist. */
101
204
/* Declare overridden functions. */
207
#if defined GNULIB_POSIXCHECK
208
/* The access() function is a security risk. */
209
_GL_WARN_ON_USE (access, "the access function is a security risk - "
210
"use the gnulib module faccessat instead");
108
214
#if @GNULIB_CHOWN@
110
# ifndef REPLACE_CHOWN
111
# define REPLACE_CHOWN 1
114
215
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
115
216
to GID (if GID is not -1). Follow symbolic links.
116
217
Return 0 if successful, otherwise -1 and errno set.
117
218
See the POSIX:2001 specification
118
219
<http://www.opengroup.org/susv3xsh/chown.html>. */
221
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
119
223
# define chown rpl_chown
120
extern int chown (const char *file, uid_t uid, gid_t gid);
225
_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
226
_GL_ARG_NONNULL ((1)));
227
_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
230
_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
231
_GL_ARG_NONNULL ((1)));
233
_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
235
_GL_CXXALIASWARN (chown);
123
236
#elif defined GNULIB_POSIXCHECK
125
# define chown(f,u,g) \
126
(GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
127
"doesn't treat a uid or gid of -1 on some systems - " \
128
"use gnulib module chown for portability"), \
238
# if HAVE_RAW_DECL_CHOWN
239
_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
240
"doesn't treat a uid or gid of -1 on some systems - "
241
"use gnulib module chown for portability");
133
246
#if @GNULIB_CLOSE@
134
247
# if @REPLACE_CLOSE@
135
248
/* Automatically included by modules that need a replacement for close. */
137
# define close rpl_close
138
extern int close (int);
249
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
251
# define close rpl_close
253
_GL_FUNCDECL_RPL (close, int, (int fd));
254
_GL_CXXALIAS_RPL (close, int, (int fd));
256
_GL_CXXALIAS_SYS (close, int, (int fd));
140
#elif @UNISTD_H_HAVE_WINSOCK2_H@
258
_GL_CXXALIASWARN (close);
259
#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
142
261
# define close close_used_without_requesting_gnulib_module_close
143
262
#elif defined GNULIB_POSIXCHECK
146
(GL_LINK_WARNING ("close does not portably work on sockets - " \
147
"use gnulib module close for portability"), \
264
/* Assume close is always declared. */
265
_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
266
"use gnulib module close for portability");
271
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
274
_GL_FUNCDECL_RPL (dup, int, (int oldfd));
275
_GL_CXXALIAS_RPL (dup, int, (int oldfd));
277
_GL_CXXALIAS_SYS (dup, int, (int oldfd));
279
_GL_CXXALIASWARN (dup);
152
282
#if @GNULIB_DUP2@
154
283
/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
155
284
NEWFD = OLDFD, otherwise close NEWFD first if it is open.
156
Return 0 if successful, otherwise -1 and errno set.
285
Return newfd if successful, otherwise -1 and errno set.
157
286
See the POSIX:2001 specification
158
287
<http://www.opengroup.org/susv3xsh/dup2.html>. */
159
extern int dup2 (int oldfd, int newfd);
289
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
290
# define dup2 rpl_dup2
292
_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
293
_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
296
_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
298
_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
300
_GL_CXXALIASWARN (dup2);
161
301
#elif defined GNULIB_POSIXCHECK
164
(GL_LINK_WARNING ("dup2 is unportable - " \
165
"use gnulib module dup2 for portability"), \
303
# if HAVE_RAW_DECL_DUP2
304
_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
305
"use gnulib module dup2 for portability");
311
/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
313
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
314
and O_TEXT, O_BINARY (defined in "binary-io.h").
315
Close NEWFD first if it is open.
316
Return newfd if successful, otherwise -1 and errno set.
317
See the Linux man page at
318
<http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
320
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
321
# define dup3 rpl_dup3
323
_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
324
_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
326
_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
327
_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
329
_GL_CXXALIASWARN (dup3);
330
#elif defined GNULIB_POSIXCHECK
332
# if HAVE_RAW_DECL_DUP3
333
_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
334
"use gnulib module dup3 for portability");
175
344
# include <crt_externs.h>
176
345
# define environ (*_NSGetEnviron ())
178
350
extern char **environ;
181
356
#elif defined GNULIB_POSIXCHECK
184
(GL_LINK_WARNING ("environ is unportable - " \
185
"use gnulib module environ for portability"), \
357
# if HAVE_RAW_DECL_ENVIRON
358
static inline char ***
363
_GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
364
"use gnulib module environ for portability");
366
# define environ (*rpl_environ ())
190
371
#if @GNULIB_EUIDACCESS@
372
/* Like access(), except that it uses the effective user id and group id of
373
the current process. */
191
374
# if !@HAVE_EUIDACCESS@
192
/* Like access(), except that is uses the effective user id and group id of
193
the current process. */
194
extern int euidaccess (const char *filename, int mode);
375
_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
376
_GL_ARG_NONNULL ((1)));
378
_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
379
_GL_CXXALIASWARN (euidaccess);
380
# if defined GNULIB_POSIXCHECK
381
/* Like access(), this function is a security risk. */
382
_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
383
"use the gnulib module faccessat instead");
196
385
#elif defined GNULIB_POSIXCHECK
197
386
# undef euidaccess
198
# define euidaccess(f,m) \
199
(GL_LINK_WARNING ("euidaccess is unportable - " \
200
"use gnulib module euidaccess for portability"), \
387
# if HAVE_RAW_DECL_EUIDACCESS
388
_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
389
"use gnulib module euidaccess for portability");
394
#if @GNULIB_FACCESSAT@
395
# if !@HAVE_FACCESSAT@
396
_GL_FUNCDECL_SYS (faccessat, int,
397
(int fd, char const *file, int mode, int flag)
398
_GL_ARG_NONNULL ((2)));
400
_GL_CXXALIAS_SYS (faccessat, int,
401
(int fd, char const *file, int mode, int flag));
402
_GL_CXXALIASWARN (faccessat);
403
#elif defined GNULIB_POSIXCHECK
405
# if HAVE_RAW_DECL_FACCESSAT
406
_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
407
"use gnulib module faccessat for portability");
205
412
#if @GNULIB_FCHDIR@
206
# if @REPLACE_FCHDIR@
208
413
/* Change the process' current working directory to the directory on which
209
414
the given file descriptor is open.
210
415
Return 0 if successful, otherwise -1 and errno set.
211
416
See the POSIX:2001 specification
212
417
<http://www.opengroup.org/susv3xsh/fchdir.html>. */
213
extern int fchdir (int /*fd*/);
419
_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
216
extern int dup (int);
217
# define dup2 rpl_dup2
218
extern int dup2 (int, int);
421
/* Gnulib internal hooks needed to maintain the fchdir metadata. */
422
_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
423
_GL_ARG_NONNULL ((2));
424
_GL_EXTERN_C void _gl_unregister_fd (int fd);
425
_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
426
_GL_EXTERN_C const char *_gl_directory_name (int fd);
429
_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
430
_GL_CXXALIASWARN (fchdir);
221
431
#elif defined GNULIB_POSIXCHECK
224
(GL_LINK_WARNING ("fchdir is unportable - " \
225
"use gnulib module fchdir for portability"), \
433
# if HAVE_RAW_DECL_FCHDIR
434
_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
435
"use gnulib module fchdir for portability");
440
#if @GNULIB_FCHOWNAT@
441
# if @REPLACE_FCHOWNAT@
442
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
444
# define fchownat rpl_fchownat
446
_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
447
uid_t owner, gid_t group, int flag)
448
_GL_ARG_NONNULL ((2)));
449
_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
450
uid_t owner, gid_t group, int flag));
452
# if !@HAVE_FCHOWNAT@
453
_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
454
uid_t owner, gid_t group, int flag)
455
_GL_ARG_NONNULL ((2)));
457
_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
458
uid_t owner, gid_t group, int flag));
460
_GL_CXXALIASWARN (fchownat);
461
#elif defined GNULIB_POSIXCHECK
463
# if HAVE_RAW_DECL_FCHOWNAT
464
_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
465
"use gnulib module openat for portability");
233
473
See POSIX:2001 specification
234
474
<http://www.opengroup.org/susv3xsh/fsync.html>. */
235
475
# if !@HAVE_FSYNC@
236
extern int fsync (int fd);
476
_GL_FUNCDECL_SYS (fsync, int, (int fd));
478
_GL_CXXALIAS_SYS (fsync, int, (int fd));
479
_GL_CXXALIASWARN (fsync);
238
480
#elif defined GNULIB_POSIXCHECK
241
(GL_LINK_WARNING ("fsync is unportable - " \
242
"use gnulib module fsync for portability"), \
482
# if HAVE_RAW_DECL_FSYNC
483
_GL_WARN_ON_USE (fsync, "fsync is unportable - "
484
"use gnulib module fsync for portability");
247
489
#if @GNULIB_FTRUNCATE@
248
# if !@HAVE_FTRUNCATE@
249
490
/* Change the size of the file to which FD is opened to become equal to LENGTH.
250
491
Return 0 if successful, otherwise -1 and errno set.
251
492
See the POSIX:2001 specification
252
493
<http://www.opengroup.org/susv3xsh/ftruncate.html>. */
253
extern int ftruncate (int fd, off_t length);
494
# if !@HAVE_FTRUNCATE@
495
_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
497
_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
498
_GL_CXXALIASWARN (ftruncate);
255
499
#elif defined GNULIB_POSIXCHECK
256
500
# undef ftruncate
257
# define ftruncate(f,l) \
258
(GL_LINK_WARNING ("ftruncate is unportable - " \
259
"use gnulib module ftruncate for portability"), \
501
# if HAVE_RAW_DECL_FTRUNCATE
502
_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
503
"use gnulib module ftruncate for portability");
264
508
#if @GNULIB_GETCWD@
265
/* Include the headers that might declare getcwd so that they will not
266
cause confusion if included after this file. */
268
# if @REPLACE_GETCWD@
269
509
/* Get the name of the current working directory, and put it in SIZE bytes
271
511
Return BUF if successful, or NULL if the directory couldn't be determined
300
549
If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
301
550
Return 0 if successful, otherwise set errno and return -1. */
302
551
# if !@HAVE_GETDOMAINNAME@
303
extern int getdomainname(char *name, size_t len);
552
_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
553
_GL_ARG_NONNULL ((1)));
555
/* Need to cast, because on MacOS X 10.5 systems, the second parameter is
557
_GL_CXXALIAS_SYS_CAST (getdomainname, int, (char *name, size_t len));
558
_GL_CXXALIASWARN (getdomainname);
305
559
#elif defined GNULIB_POSIXCHECK
306
560
# undef getdomainname
307
# define getdomainname(n,l) \
308
(GL_LINK_WARNING ("getdomainname is unportable - " \
309
"use gnulib module getdomainname for portability"), \
310
getdomainname (n, l))
561
# if HAVE_RAW_DECL_GETDOMAINNAME
562
_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
563
"use gnulib module getdomainname for portability");
314
568
#if @GNULIB_GETDTABLESIZE@
569
/* Return the maximum number of file descriptors in the current process.
570
In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
315
571
# if !@HAVE_GETDTABLESIZE@
316
/* Return the maximum number of file descriptors in the current process. */
317
extern int getdtablesize (void);
572
_GL_FUNCDECL_SYS (getdtablesize, int, (void));
574
_GL_CXXALIAS_SYS (getdtablesize, int, (void));
575
_GL_CXXALIASWARN (getdtablesize);
319
576
#elif defined GNULIB_POSIXCHECK
320
577
# undef getdtablesize
321
# define getdtablesize() \
322
(GL_LINK_WARNING ("getdtablesize is unportable - " \
323
"use gnulib module getdtablesize for portability"), \
578
# if HAVE_RAW_DECL_GETDTABLESIZE
579
_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
580
"use gnulib module getdtablesize for portability");
585
#if @GNULIB_GETGROUPS@
586
/* Return the supplemental groups that the current process belongs to.
587
It is unspecified whether the effective group id is in the list.
588
If N is 0, return the group count; otherwise, N describes how many
589
entries are available in GROUPS. Return -1 and set errno if N is
590
not 0 and not large enough. Fails with ENOSYS on some systems. */
591
# if @REPLACE_GETGROUPS@
592
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
594
# define getgroups rpl_getgroups
596
_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
597
_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
599
# if !@HAVE_GETGROUPS@
600
_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
602
_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
604
_GL_CXXALIASWARN (getgroups);
605
#elif defined GNULIB_POSIXCHECK
607
# if HAVE_RAW_DECL_GETGROUPS
608
_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
609
"use gnulib module getgroups for portability");
334
620
If the host name is longer than LEN, set errno = EINVAL and return -1.
335
621
Return 0 if successful, otherwise set errno and return -1. */
336
622
# if @UNISTD_H_HAVE_WINSOCK2_H@
338
# define gethostname rpl_gethostname
340
# if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
341
extern int gethostname(char *name, size_t len);
623
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
625
# define gethostname rpl_gethostname
627
_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
628
_GL_ARG_NONNULL ((1)));
629
_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
631
# if !@HAVE_GETHOSTNAME@
632
_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
633
_GL_ARG_NONNULL ((1)));
635
/* Need to cast, because on Solaris 10 systems, the second parameter is
637
_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
639
_GL_CXXALIASWARN (gethostname);
343
640
#elif @UNISTD_H_HAVE_WINSOCK2_H@
344
641
# undef gethostname
345
642
# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
346
643
#elif defined GNULIB_POSIXCHECK
347
644
# undef gethostname
348
# define gethostname(n,l) \
349
(GL_LINK_WARNING ("gethostname is unportable - " \
350
"use gnulib module gethostname for portability"), \
645
# if HAVE_RAW_DECL_GETHOSTNAME
646
_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
647
"use gnulib module gethostname for portability");
652
#if @GNULIB_GETLOGIN@
653
/* Returns the user's login name, or NULL if it cannot be found. Upon error,
654
returns NULL with errno set.
656
See <http://www.opengroup.org/susv3xsh/getlogin.html>.
658
Most programs don't need to use this function, because the information is
659
available through environment variables:
660
${LOGNAME-$USER} on Unix platforms,
661
$USERNAME on native Windows platforms.
663
# if !@HAVE_GETLOGIN@
664
_GL_FUNCDECL_SYS (getlogin, char *, (void));
666
_GL_CXXALIAS_SYS (getlogin, char *, (void));
667
_GL_CXXALIASWARN (getlogin);
668
#elif defined GNULIB_POSIXCHECK
670
# if HAVE_RAW_DECL_GETLOGIN
671
_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
672
"use gnulib module getlogin for portability");
361
683
provided (this case is hopefully rare but is left open by the POSIX spec).
363
685
See <http://www.opengroup.org/susv3xsh/getlogin.html>.
687
Most programs don't need to use this function, because the information is
688
available through environment variables:
689
${LOGNAME-$USER} on Unix platforms,
690
$USERNAME on native Windows platforms.
365
692
# if !@HAVE_DECL_GETLOGIN_R@
367
extern int getlogin_r (char *name, size_t size);
693
_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
694
_GL_ARG_NONNULL ((1)));
696
/* Need to cast, because on Solaris 10 systems, the second argument is
698
_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
699
_GL_CXXALIASWARN (getlogin_r);
369
700
#elif defined GNULIB_POSIXCHECK
370
701
# undef getlogin_r
371
# define getlogin_r(n,s) \
372
(GL_LINK_WARNING ("getlogin_r is unportable - " \
373
"use gnulib module getlogin_r for portability"), \
702
# if HAVE_RAW_DECL_GETLOGIN_R
703
_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
704
"use gnulib module getlogin_r for portability");
378
709
#if @GNULIB_GETPAGESIZE@
379
710
# if @REPLACE_GETPAGESIZE@
380
# define getpagesize rpl_getpagesize
381
extern int getpagesize (void);
382
# elif !@HAVE_GETPAGESIZE@
711
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
712
# define getpagesize rpl_getpagesize
714
_GL_FUNCDECL_RPL (getpagesize, int, (void));
715
_GL_CXXALIAS_RPL (getpagesize, int, (void));
717
# if !@HAVE_GETPAGESIZE@
718
# if !defined getpagesize
383
719
/* This is for POSIX systems. */
384
# if !defined getpagesize && defined _SC_PAGESIZE
385
# if ! (defined __VMS && __VMS_VER < 70000000)
386
# define getpagesize() sysconf (_SC_PAGESIZE)
720
# if !defined _gl_getpagesize && defined _SC_PAGESIZE
721
# if ! (defined __VMS && __VMS_VER < 70000000)
722
# define _gl_getpagesize() sysconf (_SC_PAGESIZE)
389
725
/* This is for older VMS. */
390
# if !defined getpagesize && defined __VMS
392
# define getpagesize() 8192
394
# define getpagesize() 512
726
# if !defined _gl_getpagesize && defined __VMS
728
# define _gl_getpagesize() 8192
730
# define _gl_getpagesize() 512
397
733
/* This is for BeOS. */
398
# if !defined getpagesize && @HAVE_OS_H@
400
# if defined B_PAGE_SIZE
401
# define getpagesize() B_PAGE_SIZE
734
# if !defined _gl_getpagesize && @HAVE_OS_H@
736
# if defined B_PAGE_SIZE
737
# define _gl_getpagesize() B_PAGE_SIZE
404
740
/* This is for AmigaOS4.0. */
405
# if !defined getpagesize && defined __amigaos4__
406
# define getpagesize() 2048
741
# if !defined _gl_getpagesize && defined __amigaos4__
742
# define _gl_getpagesize() 2048
408
744
/* This is for older Unix systems. */
409
# if !defined getpagesize && @HAVE_SYS_PARAM_H@
410
# include <sys/param.h>
411
# ifdef EXEC_PAGESIZE
412
# define getpagesize() EXEC_PAGESIZE
745
# if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
746
# include <sys/param.h>
747
# ifdef EXEC_PAGESIZE
748
# define _gl_getpagesize() EXEC_PAGESIZE
754
# define _gl_getpagesize() (NBPG * CLSIZE)
757
# define _gl_getpagesize() NBPC
418
# define getpagesize() (NBPG * CLSIZE)
762
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
763
# define getpagesize() _gl_getpagesize ()
421
# define getpagesize() NBPC
768
return _gl_getpagesize ();
773
/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
774
_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
776
# if @HAVE_DECL_GETPAGESIZE@
777
_GL_CXXALIASWARN (getpagesize);
427
779
#elif defined GNULIB_POSIXCHECK
428
780
# undef getpagesize
429
# define getpagesize() \
430
(GL_LINK_WARNING ("getpagesize is unportable - " \
431
"use gnulib module getpagesize for portability"), \
781
# if HAVE_RAW_DECL_GETPAGESIZE
782
_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
783
"use gnulib module getpagesize for portability");
436
788
#if @GNULIB_GETUSERSHELL@
437
# if !@HAVE_GETUSERSHELL@
438
789
/* Return the next valid login shell on the system, or NULL when the end of
439
790
the list has been reached. */
440
extern char *getusershell (void);
791
# if !@HAVE_DECL_GETUSERSHELL@
792
_GL_FUNCDECL_SYS (getusershell, char *, (void));
794
_GL_CXXALIAS_SYS (getusershell, char *, (void));
795
_GL_CXXALIASWARN (getusershell);
796
#elif defined GNULIB_POSIXCHECK
798
# if HAVE_RAW_DECL_GETUSERSHELL
799
_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
800
"use gnulib module getusershell for portability");
804
#if @GNULIB_GETUSERSHELL@
441
805
/* Rewind to pointer that is advanced at each getusershell() call. */
442
extern void setusershell (void);
806
# if !@HAVE_DECL_GETUSERSHELL@
807
_GL_FUNCDECL_SYS (setusershell, void, (void));
809
_GL_CXXALIAS_SYS (setusershell, void, (void));
810
_GL_CXXALIASWARN (setusershell);
811
#elif defined GNULIB_POSIXCHECK
813
# if HAVE_RAW_DECL_SETUSERSHELL
814
_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
815
"use gnulib module getusershell for portability");
819
#if @GNULIB_GETUSERSHELL@
443
820
/* Free the pointer that is advanced at each getusershell() call and
444
821
associated resources. */
445
extern void endusershell (void);
822
# if !@HAVE_DECL_GETUSERSHELL@
823
_GL_FUNCDECL_SYS (endusershell, void, (void));
825
_GL_CXXALIAS_SYS (endusershell, void, (void));
826
_GL_CXXALIASWARN (endusershell);
447
827
#elif defined GNULIB_POSIXCHECK
449
# define getusershell() \
450
(GL_LINK_WARNING ("getusershell is unportable - " \
451
"use gnulib module getusershell for portability"), \
454
# define setusershell() \
455
(GL_LINK_WARNING ("setusershell is unportable - " \
456
"use gnulib module getusershell for portability"), \
458
828
# undef endusershell
459
# define endusershell() \
460
(GL_LINK_WARNING ("endusershell is unportable - " \
461
"use gnulib module getusershell for portability"), \
829
# if HAVE_RAW_DECL_ENDUSERSHELL
830
_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
831
"use gnulib module getusershell for portability");
466
836
#if @GNULIB_LCHOWN@
467
# if @REPLACE_LCHOWN@
468
837
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
469
838
to GID (if GID is not -1). Do not follow symbolic links.
470
839
Return 0 if successful, otherwise -1 and errno set.
471
840
See the POSIX:2001 specification
472
841
<http://www.opengroup.org/susv3xsh/lchown.html>. */
473
# define lchown rpl_lchown
474
extern int lchown (char const *file, uid_t owner, gid_t group);
842
# if @REPLACE_LCHOWN@
843
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
845
# define lchown rpl_lchown
847
_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
848
_GL_ARG_NONNULL ((1)));
849
_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
852
_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
853
_GL_ARG_NONNULL ((1)));
855
_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
857
_GL_CXXALIASWARN (lchown);
476
858
#elif defined GNULIB_POSIXCHECK
478
# define lchown(f,u,g) \
479
(GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
480
"systems - use gnulib module lchown for portability"), \
860
# if HAVE_RAW_DECL_LCHOWN
861
_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
862
"use gnulib module lchown for portability");
487
869
Return 0 if successful, otherwise -1 and errno set.
488
870
See POSIX:2001 specification
489
871
<http://www.opengroup.org/susv3xsh/link.html>. */
491
extern int link (const char *path1, const char *path2);
873
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
874
# define link rpl_link
876
_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
877
_GL_ARG_NONNULL ((1, 2)));
878
_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
881
_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
882
_GL_ARG_NONNULL ((1, 2)));
884
_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
886
_GL_CXXALIASWARN (link);
493
887
#elif defined GNULIB_POSIXCHECK
495
# define link(path1,path2) \
496
(GL_LINK_WARNING ("link is unportable - " \
497
"use gnulib module link for portability"), \
889
# if HAVE_RAW_DECL_LINK
890
_GL_WARN_ON_USE (link, "link is unportable - "
891
"use gnulib module link for portability");
897
/* Create a new hard link for an existing file, relative to two
898
directories. FLAG controls whether symlinks are followed.
899
Return 0 if successful, otherwise -1 and errno set. */
900
# if @REPLACE_LINKAT@
901
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
903
# define linkat rpl_linkat
905
_GL_FUNCDECL_RPL (linkat, int,
906
(int fd1, const char *path1, int fd2, const char *path2,
908
_GL_ARG_NONNULL ((2, 4)));
909
_GL_CXXALIAS_RPL (linkat, int,
910
(int fd1, const char *path1, int fd2, const char *path2,
914
_GL_FUNCDECL_SYS (linkat, int,
915
(int fd1, const char *path1, int fd2, const char *path2,
917
_GL_ARG_NONNULL ((2, 4)));
919
_GL_CXXALIAS_SYS (linkat, int,
920
(int fd1, const char *path1, int fd2, const char *path2,
923
_GL_CXXALIASWARN (linkat);
924
#elif defined GNULIB_POSIXCHECK
926
# if HAVE_RAW_DECL_LINKAT
927
_GL_WARN_ON_USE (linkat, "linkat is unportable - "
928
"use gnulib module linkat for portability");
502
933
#if @GNULIB_LSEEK@
504
934
/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
505
935
Return the new offset if successful, otherwise -1 and errno set.
506
936
See the POSIX:2001 specification
507
937
<http://www.opengroup.org/susv3xsh/lseek.html>. */
508
# define lseek rpl_lseek
509
extern off_t lseek (int fd, off_t offset, int whence);
939
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
940
# define lseek rpl_lseek
942
_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
943
_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
945
_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
947
_GL_CXXALIASWARN (lseek);
511
948
#elif defined GNULIB_POSIXCHECK
513
# define lseek(f,o,w) \
514
(GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
515
"systems - use gnulib module lseek for portability"), \
950
# if HAVE_RAW_DECL_LSEEK
951
_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
952
"systems - use gnulib module lseek for portability");
958
/* Create a pipe, applying the given flags when opening the read-end of the
959
pipe and the write-end of the pipe.
960
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
961
and O_TEXT, O_BINARY (defined in "binary-io.h").
962
Store the read-end as fd[0] and the write-end as fd[1].
963
Return 0 upon success, or -1 with errno set upon failure.
964
See also the Linux man page at
965
<http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
967
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
968
# define pipe2 rpl_pipe2
970
_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
971
_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
973
_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
974
_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
976
_GL_CXXALIASWARN (pipe2);
977
#elif defined GNULIB_POSIXCHECK
979
# if HAVE_RAW_DECL_PIPE2
980
_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
981
"use gnulib module pipe2 for portability");
987
/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
988
Return the number of bytes placed into BUF if successful, otherwise
989
set errno and return -1. 0 indicates EOF. See the POSIX:2001
990
specification <http://www.opengroup.org/susv3xsh/pread.html>. */
992
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
993
# define pread rpl_pread
995
_GL_FUNCDECL_RPL (pread, ssize_t,
996
(int fd, void *buf, size_t bufsize, off_t offset)
997
_GL_ARG_NONNULL ((2)));
998
_GL_CXXALIAS_RPL (pread, ssize_t,
999
(int fd, void *buf, size_t bufsize, off_t offset));
1002
_GL_FUNCDECL_SYS (pread, ssize_t,
1003
(int fd, void *buf, size_t bufsize, off_t offset)
1004
_GL_ARG_NONNULL ((2)));
1006
_GL_CXXALIAS_SYS (pread, ssize_t,
1007
(int fd, void *buf, size_t bufsize, off_t offset));
1009
_GL_CXXALIASWARN (pread);
1010
#elif defined GNULIB_POSIXCHECK
1012
# if HAVE_RAW_DECL_PREAD
1013
_GL_WARN_ON_USE (pread, "pread is unportable - "
1014
"use gnulib module pread for portability");
1020
/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1021
Return the number of bytes written if successful, otherwise
1022
set errno and return -1. 0 indicates nothing written. See the
1023
POSIX:2001 specification
1024
<http://www.opengroup.org/susv3xsh/pwrite.html>. */
1025
# if @REPLACE_PWRITE@
1026
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1027
# define pwrite rpl_pwrite
1029
_GL_FUNCDECL_RPL (pwrite, ssize_t,
1030
(int fd, const void *buf, size_t bufsize, off_t offset)
1031
_GL_ARG_NONNULL ((2)));
1032
_GL_CXXALIAS_RPL (pwrite, ssize_t,
1033
(int fd, const void *buf, size_t bufsize, off_t offset));
1036
_GL_FUNCDECL_SYS (pwrite, ssize_t,
1037
(int fd, const void *buf, size_t bufsize, off_t offset)
1038
_GL_ARG_NONNULL ((2)));
1040
_GL_CXXALIAS_SYS (pwrite, ssize_t,
1041
(int fd, const void *buf, size_t bufsize, off_t offset));
1043
_GL_CXXALIASWARN (pwrite);
1044
#elif defined GNULIB_POSIXCHECK
1046
# if HAVE_RAW_DECL_PWRITE
1047
_GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1048
"use gnulib module pwrite for portability");
523
1056
successful, otherwise -1 and errno set.
524
1057
See the POSIX:2001 specification
525
1058
<http://www.opengroup.org/susv3xsh/readlink.html>. */
526
# if !@HAVE_READLINK@
528
extern int readlink (const char *file, char *buf, size_t bufsize);
1059
# if @REPLACE_READLINK@
1060
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1061
# define readlink rpl_readlink
1063
_GL_FUNCDECL_RPL (readlink, ssize_t,
1064
(const char *file, char *buf, size_t bufsize)
1065
_GL_ARG_NONNULL ((1, 2)));
1066
_GL_CXXALIAS_RPL (readlink, ssize_t,
1067
(const char *file, char *buf, size_t bufsize));
1069
# if !@HAVE_READLINK@
1070
_GL_FUNCDECL_SYS (readlink, ssize_t,
1071
(const char *file, char *buf, size_t bufsize)
1072
_GL_ARG_NONNULL ((1, 2)));
1074
_GL_CXXALIAS_SYS (readlink, ssize_t,
1075
(const char *file, char *buf, size_t bufsize));
1077
_GL_CXXALIASWARN (readlink);
530
1078
#elif defined GNULIB_POSIXCHECK
531
1079
# undef readlink
532
# define readlink(f,b,s) \
533
(GL_LINK_WARNING ("readlink is unportable - " \
534
"use gnulib module readlink for portability"), \
1080
# if HAVE_RAW_DECL_READLINK
1081
_GL_WARN_ON_USE (readlink, "readlink is unportable - "
1082
"use gnulib module readlink for portability");
1087
#if @GNULIB_READLINKAT@
1088
# if !@HAVE_READLINKAT@
1089
_GL_FUNCDECL_SYS (readlinkat, ssize_t,
1090
(int fd, char const *file, char *buf, size_t len)
1091
_GL_ARG_NONNULL ((2, 3)));
1093
_GL_CXXALIAS_SYS (readlinkat, ssize_t,
1094
(int fd, char const *file, char *buf, size_t len));
1095
_GL_CXXALIASWARN (readlinkat);
1096
#elif defined GNULIB_POSIXCHECK
1098
# if HAVE_RAW_DECL_READLINKAT
1099
_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1100
"use gnulib module symlinkat for portability");
1106
/* Remove the directory DIR. */
1107
# if @REPLACE_RMDIR@
1108
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1109
# define rmdir rpl_rmdir
1111
_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1112
_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1114
_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1116
_GL_CXXALIASWARN (rmdir);
1117
#elif defined GNULIB_POSIXCHECK
1119
# if HAVE_RAW_DECL_RMDIR
1120
_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1121
"use gnulib module rmdir for portability");
541
1128
Returns the number of seconds left to sleep.
542
1129
See the POSIX:2001 specification
543
1130
<http://www.opengroup.org/susv3xsh/sleep.html>. */
545
extern unsigned int sleep (unsigned int n);
1131
# if @REPLACE_SLEEP@
1132
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1134
# define sleep rpl_sleep
1136
_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1137
_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1140
_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1142
_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1144
_GL_CXXALIASWARN (sleep);
547
1145
#elif defined GNULIB_POSIXCHECK
550
(GL_LINK_WARNING ("sleep is unportable - " \
551
"use gnulib module sleep for portability"), \
556
#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
1147
# if HAVE_RAW_DECL_SLEEP
1148
_GL_WARN_ON_USE (sleep, "sleep is unportable - "
1149
"use gnulib module sleep for portability");
1154
#if @GNULIB_SYMLINK@
1155
# if @REPLACE_SYMLINK@
1156
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1158
# define symlink rpl_symlink
1160
_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1161
_GL_ARG_NONNULL ((1, 2)));
1162
_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1164
# if !@HAVE_SYMLINK@
1165
_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1166
_GL_ARG_NONNULL ((1, 2)));
1168
_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1170
_GL_CXXALIASWARN (symlink);
1171
#elif defined GNULIB_POSIXCHECK
1173
# if HAVE_RAW_DECL_SYMLINK
1174
_GL_WARN_ON_USE (symlink, "symlink is not portable - "
1175
"use gnulib module symlink for portability");
1180
#if @GNULIB_SYMLINKAT@
1181
# if !@HAVE_SYMLINKAT@
1182
_GL_FUNCDECL_SYS (symlinkat, int,
1183
(char const *contents, int fd, char const *file)
1184
_GL_ARG_NONNULL ((1, 3)));
1186
_GL_CXXALIAS_SYS (symlinkat, int,
1187
(char const *contents, int fd, char const *file));
1188
_GL_CXXALIASWARN (symlinkat);
1189
#elif defined GNULIB_POSIXCHECK
1191
# if HAVE_RAW_DECL_SYMLINKAT
1192
_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1193
"use gnulib module symlinkat for portability");
1198
#if @GNULIB_TTYNAME_R@
1199
/* Store at most BUFLEN characters of the pathname of the terminal FD is
1200
open on in BUF. Return 0 on success, otherwise an error number. */
1201
# if @REPLACE_TTYNAME_R@
1202
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1204
# define ttyname_r rpl_ttyname_r
1206
_GL_FUNCDECL_RPL (ttyname_r, int,
1207
(int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1208
_GL_CXXALIAS_RPL (ttyname_r, int,
1209
(int fd, char *buf, size_t buflen));
1211
# if !@HAVE_TTYNAME_R@
1212
_GL_FUNCDECL_SYS (ttyname_r, int,
1213
(int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1215
_GL_CXXALIAS_SYS (ttyname_r, int,
1216
(int fd, char *buf, size_t buflen));
1218
_GL_CXXALIASWARN (ttyname_r);
1219
#elif defined GNULIB_POSIXCHECK
1221
# if HAVE_RAW_DECL_TTYNAME_R
1222
_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1223
"use gnulib module ttyname_r for portability");
1229
# if @REPLACE_UNLINK@
1230
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1232
# define unlink rpl_unlink
1234
_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1235
_GL_CXXALIAS_RPL (unlink, int, (char const *file));
1237
_GL_CXXALIAS_SYS (unlink, int, (char const *file));
1239
_GL_CXXALIASWARN (unlink);
1240
#elif defined GNULIB_POSIXCHECK
1242
# if HAVE_RAW_DECL_UNLINK
1243
_GL_WARN_ON_USE (unlink, "unlink is not portable - "
1244
"use gnulib module unlink for portability");
1249
#if @GNULIB_UNLINKAT@
1250
# if @REPLACE_UNLINKAT@
1251
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1253
# define unlinkat rpl_unlinkat
1255
_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1256
_GL_ARG_NONNULL ((2)));
1257
_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1259
# if !@HAVE_UNLINKAT@
1260
_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1261
_GL_ARG_NONNULL ((2)));
1263
_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1265
_GL_CXXALIASWARN (unlinkat);
1266
#elif defined GNULIB_POSIXCHECK
1268
# if HAVE_RAW_DECL_UNLINKAT
1269
_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1270
"use gnulib module openat for portability");
1276
/* Pause the execution of the current thread for N microseconds.
1277
Returns 0 on completion, or -1 on range error.
1278
See the POSIX:2001 specification
1279
<http://www.opengroup.org/susv3xsh/sleep.html>. */
1280
# if @REPLACE_USLEEP@
1281
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1283
# define usleep rpl_usleep
1285
_GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1286
_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1289
_GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1291
_GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
1293
_GL_CXXALIASWARN (usleep);
1294
#elif defined GNULIB_POSIXCHECK
1296
# if HAVE_RAW_DECL_USLEEP
1297
_GL_WARN_ON_USE (usleep, "usleep is unportable - "
1298
"use gnulib module usleep for portability");
557
1304
/* Write up to COUNT bytes starting at BUF to file descriptor FD.
558
1305
See the POSIX:2001 specification
559
1306
<http://www.opengroup.org/susv3xsh/write.html>. */
561
# define write rpl_write
562
extern ssize_t write (int fd, const void *buf, size_t count);
566
#ifdef FCHDIR_REPLACEMENT
567
/* gnulib internal function. */
568
extern void _gl_unregister_fd (int fd);
1307
# if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
1308
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1310
# define write rpl_write
1312
_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1313
_GL_ARG_NONNULL ((2)));
1314
_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1316
/* Need to cast, because on mingw, the third parameter is
1318
and the return type is 'int'. */
1319
_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1321
_GL_CXXALIASWARN (write);