1
/* -*- buffer-read-only: t -*- vi: set ro: */
2
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3
1
/* Substitute for and wrapper around <unistd.h>.
4
Copyright (C) 2003-2011 Free Software Foundation, Inc.
2
Copyright (C) 2003-2012 Free Software Foundation, Inc.
6
4
This program is free software; you can redistribute it and/or modify
7
5
it under the terms of the GNU General Public License as published by
14
12
GNU General Public License for more details.
16
14
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. */
15
along with this program; if not, see <http://www.gnu.org/licenses/>. */
21
18
@PRAGMA_SYSTEM_HEADER@
79
76
/* mingw fails to declare _exit in <unistd.h>. */
80
/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
77
/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
81
79
/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
82
80
/* But avoid namespace pollution on glibc systems. */
84
82
# include <stdlib.h>
87
/* mingw declares getcwd in <io.h>, not in <unistd.h>. */
88
#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
85
/* Native Windows platforms declare chdir, getcwd, rmdir in
86
<io.h> and/or <direct.h>, not in <unistd.h>.
87
They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
88
lseek(), read(), unlink(), write() in <io.h>. */
89
#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
90
|| defined GNULIB_POSIXCHECK) \
89
91
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
90
92
# include <io.h> /* mingw32, mingw64 */
91
# include <direct.h> /* mingw64 */
93
# include <direct.h> /* mingw64, MSVC 9 */
94
#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
95
|| @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
96
|| defined GNULIB_POSIXCHECK) \
97
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
94
101
/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
100
107
# include <netdb.h>
110
/* MSVC defines off_t in <sys/types.h>.
111
May also define off_t to a 64-bit type on native Windows. */
112
#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
114
# include <sys/types.h>
103
117
#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
104
118
|| @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
105
119
|| @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
244
_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
245
_GL_CXXALIASWARN (chdir);
246
#elif defined GNULIB_POSIXCHECK
248
# if HAVE_RAW_DECL_CHDIR
249
_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
250
"use gnulib module chdir for portability");
229
255
#if @GNULIB_CHOWN@
230
256
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
231
257
to GID (if GID is not -1). Follow symbolic links.
232
258
Return 0 if successful, otherwise -1 and errno set.
233
See the POSIX:2001 specification
234
<http://www.opengroup.org/susv3xsh/chown.html>. */
259
See the POSIX:2008 specification
260
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
235
261
# if @REPLACE_CHOWN@
236
262
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
286
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
313
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
289
316
_GL_FUNCDECL_RPL (dup, int, (int oldfd));
290
317
_GL_CXXALIAS_RPL (dup, int, (int oldfd));
292
319
_GL_CXXALIAS_SYS (dup, int, (int oldfd));
294
321
_GL_CXXALIASWARN (dup);
322
#elif defined GNULIB_POSIXCHECK
324
# if HAVE_RAW_DECL_DUP
325
_GL_WARN_ON_USE (dup, "dup is unportable - "
326
"use gnulib module dup for portability");
297
331
#if @GNULIB_DUP2@
298
332
/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
299
333
NEWFD = OLDFD, otherwise close NEWFD first if it is open.
300
334
Return newfd if successful, otherwise -1 and errno set.
301
See the POSIX:2001 specification
302
<http://www.opengroup.org/susv3xsh/dup2.html>. */
335
See the POSIX:2008 specification
336
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
303
337
# if @REPLACE_DUP2@
304
338
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
305
339
# define dup2 rpl_dup2
428
462
/* Change the process' current working directory to the directory on which
429
463
the given file descriptor is open.
430
464
Return 0 if successful, otherwise -1 and errno set.
431
See the POSIX:2001 specification
432
<http://www.opengroup.org/susv3xsh/fchdir.html>. */
465
See the POSIX:2008 specification
466
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
433
467
# if ! @HAVE_FCHDIR@
434
468
_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
523
#if @GNULIB_FDATASYNC@
524
/* Synchronize changes to a file.
525
Return 0 if successful, otherwise -1 and errno set.
526
See POSIX:2008 specification
527
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
528
# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
529
_GL_FUNCDECL_SYS (fdatasync, int, (int fd));
531
_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
532
_GL_CXXALIASWARN (fdatasync);
533
#elif defined GNULIB_POSIXCHECK
535
# if HAVE_RAW_DECL_FDATASYNC
536
_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
537
"use gnulib module fdatasync for portability");
489
542
#if @GNULIB_FSYNC@
490
/* Synchronize changes to a file.
543
/* Synchronize changes, including metadata, to a file.
491
544
Return 0 if successful, otherwise -1 and errno set.
492
See POSIX:2001 specification
493
<http://www.opengroup.org/susv3xsh/fsync.html>. */
545
See POSIX:2008 specification
546
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
494
547
# if !@HAVE_FSYNC@
495
548
_GL_FUNCDECL_SYS (fsync, int, (int fd));
508
561
#if @GNULIB_FTRUNCATE@
509
562
/* Change the size of the file to which FD is opened to become equal to LENGTH.
510
563
Return 0 if successful, otherwise -1 and errno set.
511
See the POSIX:2001 specification
512
<http://www.opengroup.org/susv3xsh/ftruncate.html>. */
513
# if !@HAVE_FTRUNCATE@
564
See the POSIX:2008 specification
565
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
566
# if @REPLACE_FTRUNCATE@
567
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
569
# define ftruncate rpl_ftruncate
571
_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
572
_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
574
# if !@HAVE_FTRUNCATE@
514
575
_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
516
577
_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
517
579
_GL_CXXALIASWARN (ftruncate);
518
580
#elif defined GNULIB_POSIXCHECK
519
581
# undef ftruncate
530
592
Return BUF if successful, or NULL if the directory couldn't be determined
531
593
or SIZE was too small.
532
See the POSIX:2001 specification
533
<http://www.opengroup.org/susv3xsh/getcwd.html>.
594
See the POSIX:2008 specification
595
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
534
596
Additionally, the gnulib module 'getcwd' guarantees the following GNU
535
597
extension: If BUF is NULL, an array is allocated with 'malloc'; the array
536
598
is SIZE bytes long, unless SIZE == 0, in which case it is as big as
955
# if @REPLACE_ISATTY@
956
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
958
# define isatty rpl_isatty
960
_GL_FUNCDECL_RPL (isatty, int, (int fd));
961
_GL_CXXALIAS_RPL (isatty, int, (int fd));
963
_GL_CXXALIAS_SYS (isatty, int, (int fd));
965
_GL_CXXALIASWARN (isatty);
966
#elif defined GNULIB_POSIXCHECK
968
# if HAVE_RAW_DECL_ISATTY
969
_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
970
"use gnulib module isatty for portability");
892
975
#if @GNULIB_LCHOWN@
893
976
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
894
977
to GID (if GID is not -1). Do not follow symbolic links.
895
978
Return 0 if successful, otherwise -1 and errno set.
896
See the POSIX:2001 specification
897
<http://www.opengroup.org/susv3xsh/lchown.html>. */
979
See the POSIX:2008 specification
980
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
898
981
# if @REPLACE_LCHOWN@
899
982
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
923
1006
#if @GNULIB_LINK@
924
1007
/* Create a new hard link for an existing file.
925
1008
Return 0 if successful, otherwise -1 and errno set.
926
See POSIX:2001 specification
927
<http://www.opengroup.org/susv3xsh/link.html>. */
1009
See POSIX:2008 specification
1010
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
928
1011
# if @REPLACE_LINK@
929
1012
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
930
1013
# define link rpl_link
989
1072
#if @GNULIB_LSEEK@
990
1073
/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
991
1074
Return the new offset if successful, otherwise -1 and errno set.
992
See the POSIX:2001 specification
993
<http://www.opengroup.org/susv3xsh/lseek.html>. */
1075
See the POSIX:2008 specification
1076
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
994
1077
# if @REPLACE_LSEEK@
995
1078
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
996
1079
# define lseek rpl_lseek
1060
1143
#if @GNULIB_PREAD@
1061
1144
/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1062
1145
Return the number of bytes placed into BUF if successful, otherwise
1063
set errno and return -1. 0 indicates EOF. See the POSIX:2001
1064
specification <http://www.opengroup.org/susv3xsh/pread.html>. */
1146
set errno and return -1. 0 indicates EOF.
1147
See the POSIX:2008 specification
1148
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
1065
1149
# if @REPLACE_PREAD@
1066
1150
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1095
1179
/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1096
1180
Return the number of bytes written if successful, otherwise
1097
1181
set errno and return -1. 0 indicates nothing written. See the
1098
POSIX:2001 specification
1099
<http://www.opengroup.org/susv3xsh/pwrite.html>. */
1182
POSIX:2008 specification
1183
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
1100
1184
# if @REPLACE_PWRITE@
1101
1185
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1129
1213
#if @GNULIB_READ@
1130
1214
/* Read up to COUNT bytes from file descriptor FD into the buffer starting
1131
at BUF. See the POSIX:2001 specification
1132
<http://www.opengroup.org/susv3xsh/read.html>. */
1133
# if @REPLACE_READ@ && @GNULIB_UNISTD_H_NONBLOCKING@
1215
at BUF. See the POSIX:2008 specification
1216
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
1134
1218
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1136
1220
# define read rpl_read
1152
1236
/* Read the contents of the symbolic link FILE and place the first BUFSIZE
1153
1237
bytes of it into BUF. Return the number of bytes placed into BUF if
1154
1238
successful, otherwise -1 and errno set.
1155
See the POSIX:2001 specification
1156
<http://www.opengroup.org/susv3xsh/readlink.html>. */
1239
See the POSIX:2008 specification
1240
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
1157
1241
# if @REPLACE_READLINK@
1158
1242
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1159
1243
# define readlink rpl_readlink
1308
#if @GNULIB_SETHOSTNAME@
1309
/* Set the host name of the machine.
1310
The host name may or may not be fully qualified.
1312
Put LEN bytes of NAME into the host name.
1313
Return 0 if successful, otherwise, set errno and return -1.
1315
Platforms with no ability to set the hostname return -1 and set
1317
# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
1318
_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
1319
_GL_ARG_NONNULL ((1)));
1321
/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
1322
and FreeBSD 6.4 the second parameter is int. On Solaris 11
1323
2011-10, the first parameter is not const. */
1324
_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
1325
_GL_CXXALIASWARN (sethostname);
1326
#elif defined GNULIB_POSIXCHECK
1328
# if HAVE_RAW_DECL_SETHOSTNAME
1329
_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
1330
"use gnulib module sethostname for portability");
1224
1335
#if @GNULIB_SLEEP@
1225
1336
/* Pause the execution of the current thread for N seconds.
1226
1337
Returns the number of seconds left to sleep.
1227
See the POSIX:2001 specification
1228
<http://www.opengroup.org/susv3xsh/sleep.html>. */
1338
See the POSIX:2008 specification
1339
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
1229
1340
# if @REPLACE_SLEEP@
1230
1341
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1374
1485
/* Pause the execution of the current thread for N microseconds.
1375
1486
Returns 0 on completion, or -1 on range error.
1376
1487
See the POSIX:2001 specification
1377
<http://www.opengroup.org/susv3xsh/sleep.html>. */
1488
<http://www.opengroup.org/susv3xsh/usleep.html>. */
1378
1489
# if @REPLACE_USLEEP@
1379
1490
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1401
1512
#if @GNULIB_WRITE@
1402
1513
/* Write up to COUNT bytes starting at BUF to file descriptor FD.
1403
See the POSIX:2001 specification
1404
<http://www.opengroup.org/susv3xsh/write.html>. */
1405
# if @REPLACE_WRITE@ && (@GNULIB_UNISTD_H_NONBLOCKING@ || @GNULIB_UNISTD_H_SIGPIPE@)
1514
See the POSIX:2008 specification
1515
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
1516
# if @REPLACE_WRITE@
1406
1517
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1408
1519
# define write rpl_write