77
77
/* mingw fails to declare _exit in <unistd.h>. */
78
/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
78
/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
79
80
/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
80
81
/* But avoid namespace pollution on glibc systems. */
82
83
# include <stdlib.h>
85
/* mingw declares getcwd in <io.h>, not in <unistd.h>. */
86
#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
86
/* Native Windows platforms declare chdir, getcwd, rmdir in
87
<io.h> and/or <direct.h>, not in <unistd.h>. */
88
#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
89
|| defined GNULIB_POSIXCHECK) \
87
90
&& ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
91
# include <io.h> /* mingw32, mingw64 */
92
# include <direct.h> /* mingw64, MSVC 9 */
91
95
/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
116
127
/* The definition of _GL_WARN_ON_USE is copied here. */
119
#if @GNULIB_GETHOSTNAME@
120
/* Get all possible declarations of gethostname(). */
121
# if @UNISTD_H_HAVE_WINSOCK2_H@
122
# if !defined _GL_SYS_SOCKET_H
123
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
125
# define socket socket_used_without_including_sys_socket_h
127
# define connect connect_used_without_including_sys_socket_h
129
# define accept accept_used_without_including_sys_socket_h
131
# define bind bind_used_without_including_sys_socket_h
133
# define getpeername getpeername_used_without_including_sys_socket_h
135
# define getsockname getsockname_used_without_including_sys_socket_h
137
# define getsockopt getsockopt_used_without_including_sys_socket_h
139
# define listen listen_used_without_including_sys_socket_h
141
# define recv recv_used_without_including_sys_socket_h
143
# define send send_used_without_including_sys_socket_h
145
# define recvfrom recvfrom_used_without_including_sys_socket_h
147
# define sendto sendto_used_without_including_sys_socket_h
149
# define setsockopt setsockopt_used_without_including_sys_socket_h
151
# define shutdown shutdown_used_without_including_sys_socket_h
153
_GL_WARN_ON_USE (socket,
154
"socket() used without including <sys/socket.h>");
155
_GL_WARN_ON_USE (connect,
156
"connect() used without including <sys/socket.h>");
157
_GL_WARN_ON_USE (accept,
158
"accept() used without including <sys/socket.h>");
159
_GL_WARN_ON_USE (bind,
160
"bind() used without including <sys/socket.h>");
161
_GL_WARN_ON_USE (getpeername,
162
"getpeername() used without including <sys/socket.h>");
163
_GL_WARN_ON_USE (getsockname,
164
"getsockname() used without including <sys/socket.h>");
165
_GL_WARN_ON_USE (getsockopt,
166
"getsockopt() used without including <sys/socket.h>");
167
_GL_WARN_ON_USE (listen,
168
"listen() used without including <sys/socket.h>");
169
_GL_WARN_ON_USE (recv,
170
"recv() used without including <sys/socket.h>");
171
_GL_WARN_ON_USE (send,
172
"send() used without including <sys/socket.h>");
173
_GL_WARN_ON_USE (recvfrom,
174
"recvfrom() used without including <sys/socket.h>");
175
_GL_WARN_ON_USE (sendto,
176
"sendto() used without including <sys/socket.h>");
177
_GL_WARN_ON_USE (setsockopt,
178
"setsockopt() used without including <sys/socket.h>");
179
_GL_WARN_ON_USE (shutdown,
180
"shutdown() used without including <sys/socket.h>");
130
/* Hide some function declarations from <winsock2.h>. */
132
#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
133
# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
134
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
136
# define socket socket_used_without_including_sys_socket_h
138
# define connect connect_used_without_including_sys_socket_h
140
# define accept accept_used_without_including_sys_socket_h
142
# define bind bind_used_without_including_sys_socket_h
144
# define getpeername getpeername_used_without_including_sys_socket_h
146
# define getsockname getsockname_used_without_including_sys_socket_h
148
# define getsockopt getsockopt_used_without_including_sys_socket_h
150
# define listen listen_used_without_including_sys_socket_h
152
# define recv recv_used_without_including_sys_socket_h
154
# define send send_used_without_including_sys_socket_h
156
# define recvfrom recvfrom_used_without_including_sys_socket_h
158
# define sendto sendto_used_without_including_sys_socket_h
160
# define setsockopt setsockopt_used_without_including_sys_socket_h
162
# define shutdown shutdown_used_without_including_sys_socket_h
164
_GL_WARN_ON_USE (socket,
165
"socket() used without including <sys/socket.h>");
166
_GL_WARN_ON_USE (connect,
167
"connect() used without including <sys/socket.h>");
168
_GL_WARN_ON_USE (accept,
169
"accept() used without including <sys/socket.h>");
170
_GL_WARN_ON_USE (bind,
171
"bind() used without including <sys/socket.h>");
172
_GL_WARN_ON_USE (getpeername,
173
"getpeername() used without including <sys/socket.h>");
174
_GL_WARN_ON_USE (getsockname,
175
"getsockname() used without including <sys/socket.h>");
176
_GL_WARN_ON_USE (getsockopt,
177
"getsockopt() used without including <sys/socket.h>");
178
_GL_WARN_ON_USE (listen,
179
"listen() used without including <sys/socket.h>");
180
_GL_WARN_ON_USE (recv,
181
"recv() used without including <sys/socket.h>");
182
_GL_WARN_ON_USE (send,
183
"send() used without including <sys/socket.h>");
184
_GL_WARN_ON_USE (recvfrom,
185
"recvfrom() used without including <sys/socket.h>");
186
_GL_WARN_ON_USE (sendto,
187
"sendto() used without including <sys/socket.h>");
188
_GL_WARN_ON_USE (setsockopt,
189
"setsockopt() used without including <sys/socket.h>");
190
_GL_WARN_ON_USE (shutdown,
191
"shutdown() used without including <sys/socket.h>");
183
# if !defined _GL_SYS_SELECT_H
184
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
186
# define select select_used_without_including_sys_select_h
188
_GL_WARN_ON_USE (select,
189
"select() used without including <sys/select.h>");
194
# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
195
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
197
# define select select_used_without_including_sys_select_h
199
_GL_WARN_ON_USE (select,
200
"select() used without including <sys/select.h>");
283
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
306
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
286
309
_GL_FUNCDECL_RPL (dup, int, (int oldfd));
287
310
_GL_CXXALIAS_RPL (dup, int, (int oldfd));
289
312
_GL_CXXALIAS_SYS (dup, int, (int oldfd));
291
314
_GL_CXXALIASWARN (dup);
315
#elif defined GNULIB_POSIXCHECK
317
# if HAVE_RAW_DECL_DUP
318
_GL_WARN_ON_USE (dup, "dup is unportable - "
319
"use gnulib module dup for portability");
294
324
#if @GNULIB_DUP2@
295
325
/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
296
326
NEWFD = OLDFD, otherwise close NEWFD first if it is open.
297
327
Return newfd if successful, otherwise -1 and errno set.
298
See the POSIX:2001 specification
299
<http://www.opengroup.org/susv3xsh/dup2.html>. */
328
See the POSIX:2008 specification
329
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
300
330
# if @REPLACE_DUP2@
301
331
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
302
332
# define dup2 rpl_dup2
516
#if @GNULIB_FDATASYNC@
517
/* Synchronize changes to a file.
518
Return 0 if successful, otherwise -1 and errno set.
519
See POSIX:2008 specification
520
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
521
# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
522
_GL_FUNCDECL_SYS (fdatasync, int, (int fd));
524
_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
525
_GL_CXXALIASWARN (fdatasync);
526
#elif defined GNULIB_POSIXCHECK
528
# if HAVE_RAW_DECL_FDATASYNC
529
_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
530
"use gnulib module fdatasync for portability");
486
535
#if @GNULIB_FSYNC@
487
/* Synchronize changes to a file.
536
/* Synchronize changes, including metadata, to a file.
488
537
Return 0 if successful, otherwise -1 and errno set.
489
See POSIX:2001 specification
490
<http://www.opengroup.org/susv3xsh/fsync.html>. */
538
See POSIX:2008 specification
539
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
491
540
# if !@HAVE_FSYNC@
492
541
_GL_FUNCDECL_SYS (fsync, int, (int fd));
922
#if @GNULIB_GROUP_MEMBER@
923
/* Determine whether group id is in calling user's group list. */
924
# if !@HAVE_GROUP_MEMBER@
925
_GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
927
_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
928
_GL_CXXALIASWARN (group_member);
929
#elif defined GNULIB_POSIXCHECK
931
# if HAVE_RAW_DECL_GROUP_MEMBER
932
_GL_WARN_ON_USE (group_member, "group_member is unportable - "
933
"use gnulib module group-member for portability");
873
938
#if @GNULIB_LCHOWN@
874
939
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
875
940
to GID (if GID is not -1). Do not follow symbolic links.
876
941
Return 0 if successful, otherwise -1 and errno set.
877
See the POSIX:2001 specification
878
<http://www.opengroup.org/susv3xsh/lchown.html>. */
942
See the POSIX:2008 specification
943
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
879
944
# if @REPLACE_LCHOWN@
880
945
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1177
/* Read up to COUNT bytes from file descriptor FD into the buffer starting
1178
at BUF. See the POSIX:2008 specification
1179
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
1181
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1183
# define read rpl_read
1185
_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1186
_GL_ARG_NONNULL ((2)));
1187
_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1189
/* Need to cast, because on mingw, the third parameter is
1191
and the return type is 'int'. */
1192
_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1194
_GL_CXXALIASWARN (read);
1108
1198
#if @GNULIB_READLINK@
1109
1199
/* Read the contents of the symbolic link FILE and place the first BUFSIZE
1110
1200
bytes of it into BUF. Return the number of bytes placed into BUF if
1111
1201
successful, otherwise -1 and errno set.
1112
See the POSIX:2001 specification
1113
<http://www.opengroup.org/susv3xsh/readlink.html>. */
1202
See the POSIX:2008 specification
1203
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
1114
1204
# if @REPLACE_READLINK@
1115
1205
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1116
1206
# define readlink rpl_readlink
1271
#if @GNULIB_SETHOSTNAME@
1272
/* Set the host name of the machine.
1273
The host name may or may not be fully qualified.
1275
Put LEN bytes of NAME into the host name.
1276
Return 0 if successful, otherwise, set errno and return -1.
1278
Platforms with no ability to set the hostname return -1 and set
1280
# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
1281
_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
1282
_GL_ARG_NONNULL ((1)));
1284
/* Need to cast, because on Solaris 11 2011-10, MacOS X 10.5, IRIX 6.5
1285
and FreeBSD 6.4 the second parameter is int. On Solaris 11
1286
2011-10, the first parameter is not const. */
1287
_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
1288
_GL_CXXALIASWARN (sethostname);
1289
#elif defined GNULIB_POSIXCHECK
1291
# if HAVE_RAW_DECL_SETHOSTNAME
1292
_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
1293
"use gnulib module sethostname for portability");
1181
1298
#if @GNULIB_SLEEP@
1182
1299
/* Pause the execution of the current thread for N seconds.
1183
1300
Returns the number of seconds left to sleep.
1184
See the POSIX:2001 specification
1185
<http://www.opengroup.org/susv3xsh/sleep.html>. */
1301
See the POSIX:2008 specification
1302
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
1186
1303
# if @REPLACE_SLEEP@
1187
1304
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)