| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
# if __GNUC__ >= 3 |
| 18 |
@PRAGMA_SYSTEM_HEADER@ |
| 19 |
# endif |
| 20 |
@PRAGMA_COLUMNS@ |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
#if (@HAVE_SYS_SELECT_H@ \ |
| 27 |
&& !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H \ |
| 28 |
&& ((defined __osf__ && defined _SYS_TYPES_H_ \ |
| 29 |
&& defined _OSF_SOURCE) \ |
| 30 |
|| (defined __sun && defined _SYS_TYPES_H \ |
| 31 |
&& (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \ |
| 32 |
|| defined __EXTENSIONS__)))) |
| 33 |
|
| 34 |
# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H |
| 35 |
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ |
| 36 |
|
| 37 |
#elif (@HAVE_SYS_SELECT_H@ \ |
| 38 |
&& (defined _CYGWIN_SYS_TIME_H \ |
| 39 |
|| (!defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \ |
| 40 |
&& ((defined __osf__ && defined _SYS_TIME_H_ \ |
| 41 |
&& defined _OSF_SOURCE) \ |
| 42 |
|| (defined __sun && defined _SYS_TIME_H \ |
| 43 |
&& (! (defined _XOPEN_SOURCE \ |
| 44 |
|| defined _POSIX_C_SOURCE) \ |
| 45 |
|| defined __EXTENSIONS__)))))) |
| 46 |
|
| 47 |
# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H |
| 48 |
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
#elif @HAVE_SYS_SELECT_H@ && defined __sgi && (defined _SYS_BSD_TYPES_H && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H) |
| 56 |
|
| 57 |
# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H |
| 58 |
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
#elif @HAVE_SYS_SELECT_H@ && defined __OpenBSD__ && (defined _PTHREAD_H_ && !defined PTHREAD_MUTEX_INITIALIZER) |
| 66 |
|
| 67 |
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ |
| 68 |
|
| 69 |
#else |
| 70 |
|
| 71 |
#ifndef _@GUARD_PREFIX@_SYS_SELECT_H |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
#include <sys/types.h> |
| 77 |
|
| 78 |
#if @HAVE_SYS_SELECT_H@ |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
# if !(defined __GLIBC__ || defined __CYGWIN__) |
| 87 |
# include <sys/time.h> |
| 88 |
# endif |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
# if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __osf__ || defined __BEOS__) \ |
| 94 |
&& ! defined __GLIBC__ |
| 95 |
# include <string.h> |
| 96 |
# endif |
| 97 |
|
| 98 |
|
| 99 |
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ |
| 100 |
|
| 101 |
#endif |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
#if !((defined __GLIBC__ || defined __CYGWIN__) && !defined __UCLIBC__) |
| 109 |
# include <signal.h> |
| 110 |
#endif |
| 111 |
|
| 112 |
#ifndef _@GUARD_PREFIX@_SYS_SELECT_H |
| 113 |
#define _@GUARD_PREFIX@_SYS_SELECT_H |
| 114 |
|
| 115 |
#if !@HAVE_SYS_SELECT_H@ |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
# include <sys/time.h> |
| 120 |
|
| 121 |
|
| 122 |
# if defined __hpux |
| 123 |
# include <string.h> |
| 124 |
# endif |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
# if @HAVE_WINSOCK2_H@ |
| 129 |
# if !defined _GL_INCLUDING_WINSOCK2_H |
| 130 |
# define _GL_INCLUDING_WINSOCK2_H |
| 131 |
# include <winsock2.h> |
| 132 |
# undef _GL_INCLUDING_WINSOCK2_H |
| 133 |
# endif |
| 134 |
# include <io.h> |
| 135 |
# endif |
| 136 |
#endif |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
#if @HAVE_WINSOCK2_H@ |
| 146 |
|
| 147 |
# if !GNULIB_defined_rpl_fd_isset |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
static int |
| 152 |
rpl_fd_isset (SOCKET fd, fd_set * set) |
| 153 |
{ |
| 154 |
u_int i; |
| 155 |
if (set == NULL) |
| 156 |
return 0; |
| 157 |
|
| 158 |
for (i = 0; i < set->fd_count; i++) |
| 159 |
if (set->fd_array[i] == fd) |
| 160 |
return 1; |
| 161 |
|
| 162 |
return 0; |
| 163 |
} |
| 164 |
|
| 165 |
# define GNULIB_defined_rpl_fd_isset 1 |
| 166 |
# endif |
| 167 |
|
| 168 |
# undef FD_ISSET |
| 169 |
# define FD_ISSET(fd, set) rpl_fd_isset(fd, set) |
| 170 |
|
| 171 |
#endif |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
#if @HAVE_WINSOCK2_H@ |
| 176 |
# if !defined _@GUARD_PREFIX@_UNISTD_H |
| 177 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 178 |
# undef close |
| 179 |
# define close close_used_without_including_unistd_h |
| 180 |
# else |
| 181 |
_GL_WARN_ON_USE (close, |
| 182 |
"close() used without including <unistd.h>"); |
| 183 |
# endif |
| 184 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 185 |
# undef gethostname |
| 186 |
# define gethostname gethostname_used_without_including_unistd_h |
| 187 |
# else |
| 188 |
_GL_WARN_ON_USE (gethostname, |
| 189 |
"gethostname() used without including <unistd.h>"); |
| 190 |
# endif |
| 191 |
# endif |
| 192 |
# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H |
| 193 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 194 |
# undef socket |
| 195 |
# define socket socket_used_without_including_sys_socket_h |
| 196 |
# undef connect |
| 197 |
# define connect connect_used_without_including_sys_socket_h |
| 198 |
# undef accept |
| 199 |
# define accept accept_used_without_including_sys_socket_h |
| 200 |
# undef bind |
| 201 |
# define bind bind_used_without_including_sys_socket_h |
| 202 |
# undef getpeername |
| 203 |
# define getpeername getpeername_used_without_including_sys_socket_h |
| 204 |
# undef getsockname |
| 205 |
# define getsockname getsockname_used_without_including_sys_socket_h |
| 206 |
# undef getsockopt |
| 207 |
# define getsockopt getsockopt_used_without_including_sys_socket_h |
| 208 |
# undef listen |
| 209 |
# define listen listen_used_without_including_sys_socket_h |
| 210 |
# undef recv |
| 211 |
# define recv recv_used_without_including_sys_socket_h |
| 212 |
# undef send |
| 213 |
# define send send_used_without_including_sys_socket_h |
| 214 |
# undef recvfrom |
| 215 |
# define recvfrom recvfrom_used_without_including_sys_socket_h |
| 216 |
# undef sendto |
| 217 |
# define sendto sendto_used_without_including_sys_socket_h |
| 218 |
# undef setsockopt |
| 219 |
# define setsockopt setsockopt_used_without_including_sys_socket_h |
| 220 |
# undef shutdown |
| 221 |
# define shutdown shutdown_used_without_including_sys_socket_h |
| 222 |
# else |
| 223 |
_GL_WARN_ON_USE (socket, |
| 224 |
"socket() used without including <sys/socket.h>"); |
| 225 |
_GL_WARN_ON_USE (connect, |
| 226 |
"connect() used without including <sys/socket.h>"); |
| 227 |
_GL_WARN_ON_USE (accept, |
| 228 |
"accept() used without including <sys/socket.h>"); |
| 229 |
_GL_WARN_ON_USE (bind, |
| 230 |
"bind() used without including <sys/socket.h>"); |
| 231 |
_GL_WARN_ON_USE (getpeername, |
| 232 |
"getpeername() used without including <sys/socket.h>"); |
| 233 |
_GL_WARN_ON_USE (getsockname, |
| 234 |
"getsockname() used without including <sys/socket.h>"); |
| 235 |
_GL_WARN_ON_USE (getsockopt, |
| 236 |
"getsockopt() used without including <sys/socket.h>"); |
| 237 |
_GL_WARN_ON_USE (listen, |
| 238 |
"listen() used without including <sys/socket.h>"); |
| 239 |
_GL_WARN_ON_USE (recv, |
| 240 |
"recv() used without including <sys/socket.h>"); |
| 241 |
_GL_WARN_ON_USE (send, |
| 242 |
"send() used without including <sys/socket.h>"); |
| 243 |
_GL_WARN_ON_USE (recvfrom, |
| 244 |
"recvfrom() used without including <sys/socket.h>"); |
| 245 |
_GL_WARN_ON_USE (sendto, |
| 246 |
"sendto() used without including <sys/socket.h>"); |
| 247 |
_GL_WARN_ON_USE (setsockopt, |
| 248 |
"setsockopt() used without including <sys/socket.h>"); |
| 249 |
_GL_WARN_ON_USE (shutdown, |
| 250 |
"shutdown() used without including <sys/socket.h>"); |
| 251 |
# endif |
| 252 |
# endif |
| 253 |
#endif |
| 254 |
|
| 255 |
|
| 256 |
#if @GNULIB_PSELECT@ |
| 257 |
# if @REPLACE_PSELECT@ |
| 258 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 259 |
# undef pselect |
| 260 |
# define pselect rpl_pselect |
| 261 |
# endif |
| 262 |
_GL_FUNCDECL_RPL (pselect, int, |
| 263 |
(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, |
| 264 |
struct timespec const *restrict, const sigset_t *restrict)); |
| 265 |
_GL_CXXALIAS_RPL (pselect, int, |
| 266 |
(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, |
| 267 |
struct timespec const *restrict, const sigset_t *restrict)); |
| 268 |
# else |
| 269 |
# if !@HAVE_PSELECT@ |
| 270 |
_GL_FUNCDECL_SYS (pselect, int, |
| 271 |
(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, |
| 272 |
struct timespec const *restrict, const sigset_t *restrict)); |
| 273 |
# endif |
| 274 |
_GL_CXXALIAS_SYS (pselect, int, |
| 275 |
(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, |
| 276 |
struct timespec const *restrict, const sigset_t *restrict)); |
| 277 |
# endif |
| 278 |
_GL_CXXALIASWARN (pselect); |
| 279 |
#elif defined GNULIB_POSIXCHECK |
| 280 |
# undef pselect |
| 281 |
# if HAVE_RAW_DECL_PSELECT |
| 282 |
_GL_WARN_ON_USE (pselect, "pselect is not portable - " |
| 283 |
"use gnulib module pselect for portability"); |
| 284 |
# endif |
| 285 |
#endif |
| 286 |
|
| 287 |
#if @GNULIB_SELECT@ |
| 288 |
# if @REPLACE_SELECT@ |
| 289 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 290 |
# undef select |
| 291 |
# define select rpl_select |
| 292 |
# endif |
| 293 |
_GL_FUNCDECL_RPL (select, int, |
| 294 |
(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, |
| 295 |
struct timeval *restrict)); |
| 296 |
_GL_CXXALIAS_RPL (select, int, |
| 297 |
(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, |
| 298 |
timeval *restrict)); |
| 299 |
# else |
| 300 |
_GL_CXXALIAS_SYS (select, int, |
| 301 |
(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, |
| 302 |
timeval *restrict)); |
| 303 |
# endif |
| 304 |
_GL_CXXALIASWARN (select); |
| 305 |
#elif @HAVE_WINSOCK2_H@ |
| 306 |
# undef select |
| 307 |
# define select select_used_without_requesting_gnulib_module_select |
| 308 |
#elif defined GNULIB_POSIXCHECK |
| 309 |
# undef select |
| 310 |
# if HAVE_RAW_DECL_SELECT |
| 311 |
_GL_WARN_ON_USE (select, "select is not always POSIX compliant - " |
| 312 |
"use gnulib module select for portability"); |
| 313 |
# endif |
| 314 |
#endif |
| 315 |
|
| 316 |
|
| 317 |
#endif |
| 318 |
#endif |
| 319 |
#endif |