~peter-pearse/ubuntu/natty/diffutils/prop001

« back to all changes in this revision

Viewing changes to lib/unistd.in.h

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2010-05-04 20:38:00 UTC
  • mfrom: (2.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100504203800-f67xd9rsa9xl9qqj
Tags: 1:3.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

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