43
46
# include <sys/types.h>
49
/* Get getopt(), optarg, optind, opterr, optopt. */
50
#if @GNULIB_UNISTD_H_GETOPT@
46
54
#if @GNULIB_GETHOSTNAME@
47
55
/* Get all possible declarations of gethostname(). */
48
56
# if @UNISTD_H_HAVE_WINSOCK2_H@
150
#if @GNULIB_FCHOWNAT@
151
# if @REPLACE_FCHOWNAT@
153
# define fchownat rpl_fchownat
155
# if !@HAVE_FCHOWNAT@ || @REPLACE_FCHOWNAT@
156
extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag);
158
#elif defined GNULIB_POSIXCHECK
160
# define fchownat(d,n,o,g,f) \
161
(GL_LINK_WARNING ("fchownat is not portable - " \
162
"use gnulib module openat for portability"), \
163
fchownat (d, n, o, g, f))
167
#if @GNULIB_UNLINKAT@
168
# if !@HAVE_UNLINKAT@
169
extern int unlinkat (int fd, char const *file, int flag);
171
#elif defined GNULIB_POSIXCHECK
173
# define unlinkat(d,n,f) \
174
(GL_LINK_WARNING ("unlinkat is not portable - " \
175
"use gnulib module openat for portability"), \
180
#if @GNULIB_FACCESSAT@
181
# if !@HAVE_FACCESSAT@
182
int faccessat (int fd, char const *file, int mode, int flag);
184
#elif defined GNULIB_POSIXCHECK
186
# define faccessat(d,n,m,f) \
187
(GL_LINK_WARNING ("faccessat is not portable - " \
188
"use gnulib module faccessat for portability"), \
189
faccessat (d, n, m, f))
192
#if @GNULIB_SYMLINKAT@
193
# if !@HAVE_SYMLINKAT@
194
int symlinkat (char const *contents, int fd, char const *file);
196
#elif defined GNULIB_POSIXCHECK
198
# define symlinkat(c,d,n) \
199
(GL_LINK_WARNING ("symlinkat is not portable - " \
200
"use gnulib module symlinkat for portability"), \
204
#if @GNULIB_READLINKAT@
205
# if !@HAVE_READLINKAT@
206
ssize_t readlinkat (int fd, char const *file, char *buf, size_t len);
208
#elif defined GNULIB_POSIXCHECK
210
# define readlinkat(d,n,b,l) \
211
(GL_LINK_WARNING ("readlinkat is not portable - " \
212
"use gnulib module symlinkat for portability"), \
213
readlinkat (d, n, b, l))
133
216
#if @GNULIB_CLOSE@
134
217
# if @REPLACE_CLOSE@
135
218
/* Automatically included by modules that need a replacement for close. */
152
235
#if @GNULIB_DUP2@
237
# define dup2 rpl_dup2
239
# if !@HAVE_DUP2@ || @REPLACE_DUP2@
154
240
/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
155
241
NEWFD = OLDFD, otherwise close NEWFD first if it is open.
156
Return 0 if successful, otherwise -1 and errno set.
242
Return newfd if successful, otherwise -1 and errno set.
157
243
See the POSIX:2001 specification
158
244
<http://www.opengroup.org/susv3xsh/dup2.html>. */
159
245
extern int dup2 (int oldfd, int newfd);
257
/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
259
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
260
and O_TEXT, O_BINARY (defined in "binary-io.h").
261
Close NEWFD first if it is open.
262
Return newfd if successful, otherwise -1 and errno set.
263
See the Linux man page at
264
<http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
266
# define dup3 rpl_dup3
268
extern int dup3 (int oldfd, int newfd, int flags);
269
#elif defined GNULIB_POSIXCHECK
271
# define dup3(o,n,f) \
272
(GL_LINK_WARNING ("dup3 is unportable - " \
273
"use gnulib module dup3 for portability"), \
170
278
#if @GNULIB_ENVIRON@
171
279
# if !@HAVE_DECL_ENVIRON@
172
280
/* Set of environment variables and values. An array of strings of the form
215
323
# define dup rpl_dup
216
324
extern int dup (int);
217
# define dup2 rpl_dup2
218
extern int dup2 (int, int);
326
/* Gnulib internal hooks needed to maintain the fchdir metadata. */
327
extern int _gl_register_fd (int fd, const char *filename);
328
extern void _gl_unregister_fd (int fd);
329
extern int _gl_register_dup (int oldfd, int newfd);
330
extern const char *_gl_directory_name (int fd);
221
333
#elif defined GNULIB_POSIXCHECK
314
426
#if @GNULIB_GETDTABLESIZE@
315
427
# if !@HAVE_GETDTABLESIZE@
316
/* Return the maximum number of file descriptors in the current process. */
428
/* Return the maximum number of file descriptors in the current process.
429
In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
317
430
extern int getdtablesize (void);
319
432
#elif defined GNULIB_POSIXCHECK
633
/* Create a pipe, applying the given flags when opening the read-end of the
634
pipe and the write-end of the pipe.
635
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
636
and O_TEXT, O_BINARY (defined in "binary-io.h").
637
Store the read-end as fd[0] and the write-end as fd[1].
638
Return 0 upon success, or -1 with errno set upon failure.
639
See also the Linux man page at
640
<http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
642
# define pipe2 rpl_pipe2
644
extern int pipe2 (int fd[2], int flags);
645
#elif defined GNULIB_POSIXCHECK
647
# define pipe2(f,o) \
648
(GL_LINK_WARNING ("pipe2 is unportable - " \
649
"use gnulib module pipe2 for portability"), \
520
654
#if @GNULIB_READLINK@
521
655
/* Read the contents of the symbolic link FILE and place the first BUFSIZE
522
656
bytes of it into BUF. Return the number of bytes placed into BUF if