Avoid line length limitation from HP NonStop system header files.
[pspp] / lib / sys_socket.in.h
1 /* Provide a sys/socket header file for systems lacking it (read: MinGW)
2    and for systems where it is incomplete.
3    Copyright (C) 2005-2010 Free Software Foundation, Inc.
4    Written by Simon Josefsson.
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 2, 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 /* This file is supposed to be used on platforms that lack <sys/socket.h>,
21    on platforms where <sys/socket.h> cannot be included standalone, and on
22    platforms where <sys/socket.h> does not provide all necessary definitions.
23    It is intended to provide definitions and prototypes needed by an
24    application.  */
25
26 #if __GNUC__ >= 3
27 @PRAGMA_SYSTEM_HEADER@
28 #endif
29 @PRAGMA_COLUMNS@
30
31 #if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
32 /* Special invocation convention:
33    - On Cygwin 1.5.x we have a sequence of nested includes
34      <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
35      and the latter includes <sys/socket.h>.  In this situation, the functions
36      are not yet declared, therefore we cannot provide the C++ aliases.  */
37
38 #@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
39
40 #else
41 /* Normal invocation convention.  */
42
43 #ifndef _GL_SYS_SOCKET_H
44
45 #if @HAVE_SYS_SOCKET_H@
46
47 # define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
48
49 /* On many platforms, <sys/socket.h> assumes prior inclusion of
50    <sys/types.h>.  */
51 # include <sys/types.h>
52
53 /* The include_next requires a split double-inclusion guard.  */
54 # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
55
56 # undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H
57
58 #endif
59
60 #ifndef _GL_SYS_SOCKET_H
61 #define _GL_SYS_SOCKET_H
62
63 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
64
65 /* The definition of _GL_ARG_NONNULL is copied here.  */
66
67 /* The definition of _GL_WARN_ON_USE is copied here.  */
68
69 #if !@HAVE_SA_FAMILY_T@
70 typedef unsigned short  sa_family_t;
71 #endif
72
73 #if !@HAVE_STRUCT_SOCKADDR_STORAGE@
74 # include <alignof.h>
75 /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
76    2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
77 # define __ss_aligntype unsigned long int
78 # define _SS_SIZE 256
79 # define _SS_PADSIZE \
80     (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)      \
81                   ? sizeof (sa_family_t)                                \
82                   : alignof (__ss_aligntype))                           \
83                  + sizeof (__ss_aligntype)))
84
85 struct sockaddr_storage
86 {
87   sa_family_t ss_family;      /* Address family, etc.  */
88   __ss_aligntype __ss_align;  /* Force desired alignment.  */
89   char __ss_padding[_SS_PADSIZE];
90 };
91 #endif
92
93 #if @HAVE_SYS_SOCKET_H@
94
95 /* A platform that has <sys/socket.h>.  */
96
97 /* For shutdown().  */
98 # if !defined SHUT_RD
99 #  define SHUT_RD 0
100 # endif
101 # if !defined SHUT_WR
102 #  define SHUT_WR 1
103 # endif
104 # if !defined SHUT_RDWR
105 #  define SHUT_RDWR 2
106 # endif
107
108 #else
109
110 # ifdef __CYGWIN__
111 #  error "Cygwin does have a sys/socket.h, doesn't it?!?"
112 # endif
113
114 /* A platform that lacks <sys/socket.h>.
115
116    Currently only MinGW is supported.  See the gnulib manual regarding
117    Windows sockets.  MinGW has the header files winsock2.h and
118    ws2tcpip.h that declare the sys/socket.h definitions we need.  Note
119    that you can influence which definitions you get by setting the
120    WINVER symbol before including these two files.  For example,
121    getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
122    symbol is set indiriectly through WINVER).  You can set this by
123    adding AC_DEFINE(WINVER, 0x0501) to configure.ac.  Note that your
124    code may not run on older Windows releases then.  My Windows 2000
125    box was not able to run the code, for example.  The situation is
126    slightly confusing because
127    <http://msdn.microsoft.com/en-us/library/ms738520>
128    suggests that getaddrinfo should be available on all Windows
129    releases. */
130
131
132 # if @HAVE_WINSOCK2_H@
133 #  include <winsock2.h>
134 # endif
135 # if @HAVE_WS2TCPIP_H@
136 #  include <ws2tcpip.h>
137 # endif
138
139 /* For shutdown(). */
140 # if !defined SHUT_RD && defined SD_RECEIVE
141 #  define SHUT_RD SD_RECEIVE
142 # endif
143 # if !defined SHUT_WR && defined SD_SEND
144 #  define SHUT_WR SD_SEND
145 # endif
146 # if !defined SHUT_RDWR && defined SD_BOTH
147 #  define SHUT_RDWR SD_BOTH
148 # endif
149
150 # if @HAVE_WINSOCK2_H@
151 /* Include headers needed by the emulation code.  */
152 #  include <sys/types.h>
153 #  include <io.h>
154
155 typedef int socklen_t;
156
157 # endif
158
159 #endif
160
161 #if @HAVE_WINSOCK2_H@
162
163 /* Re-define FD_ISSET to avoid a WSA call while we are not using
164    network sockets.  */
165 static inline int
166 rpl_fd_isset (SOCKET fd, fd_set * set)
167 {
168   u_int i;
169   if (set == NULL)
170     return 0;
171
172   for (i = 0; i < set->fd_count; i++)
173     if (set->fd_array[i] == fd)
174       return 1;
175
176   return 0;
177 }
178
179 # undef FD_ISSET
180 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
181
182 #endif
183
184 /* Wrap everything else to use libc file descriptors for sockets.  */
185
186 #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
187 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
188 #  undef close
189 #  define close close_used_without_including_unistd_h
190 # else
191    _GL_WARN_ON_USE (close,
192                     "close() used without including <unistd.h>");
193 # endif
194 #endif
195
196 #if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
197 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
198 #  undef gethostname
199 #  define gethostname gethostname_used_without_including_unistd_h
200 # else
201    _GL_WARN_ON_USE (gethostname,
202                     "gethostname() used without including <unistd.h>");
203 # endif
204 #endif
205
206 #if @GNULIB_SOCKET@
207 # if @HAVE_WINSOCK2_H@
208 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
209 #   undef socket
210 #   define socket rpl_socket
211 #  endif
212 _GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol));
213 _GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
214 # else
215 _GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
216 # endif
217 _GL_CXXALIASWARN (socket);
218 #elif @HAVE_WINSOCK2_H@
219 # undef socket
220 # define socket socket_used_without_requesting_gnulib_module_socket
221 #elif defined GNULIB_POSIXCHECK
222 # undef socket
223 # if HAVE_RAW_DECL_SOCKET
224 _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
225                  "use gnulib module socket for portability");
226 # endif
227 #endif
228
229 #if @GNULIB_CONNECT@
230 # if @HAVE_WINSOCK2_H@
231 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
232 #   undef connect
233 #   define connect rpl_connect
234 #  endif
235 _GL_FUNCDECL_RPL (connect, int,
236                   (int fd, const struct sockaddr *addr, socklen_t addrlen)
237                   _GL_ARG_NONNULL ((2)));
238 _GL_CXXALIAS_RPL (connect, int,
239                   (int fd, const struct sockaddr *addr, socklen_t addrlen));
240 # else
241 _GL_CXXALIAS_SYS (connect, int,
242                   (int fd, const struct sockaddr *addr, socklen_t addrlen));
243 # endif
244 _GL_CXXALIASWARN (connect);
245 #elif @HAVE_WINSOCK2_H@
246 # undef connect
247 # define connect socket_used_without_requesting_gnulib_module_connect
248 #elif defined GNULIB_POSIXCHECK
249 # undef connect
250 # if HAVE_RAW_DECL_CONNECT
251 _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
252                  "use gnulib module connect for portability");
253 # endif
254 #endif
255
256 #if @GNULIB_ACCEPT@
257 # if @HAVE_WINSOCK2_H@
258 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
259 #   undef accept
260 #   define accept rpl_accept
261 #  endif
262 _GL_FUNCDECL_RPL (accept, int,
263                   (int fd, struct sockaddr *addr, socklen_t *addrlen));
264 _GL_CXXALIAS_RPL (accept, int,
265                   (int fd, struct sockaddr *addr, socklen_t *addrlen));
266 # else
267 /* Need to cast, because on Solaris 10 systems, the third parameter is
268                                                        void *addrlen.  */
269 _GL_CXXALIAS_SYS_CAST (accept, int,
270                        (int fd, struct sockaddr *addr, socklen_t *addrlen));
271 # endif
272 _GL_CXXALIASWARN (accept);
273 #elif @HAVE_WINSOCK2_H@
274 # undef accept
275 # define accept accept_used_without_requesting_gnulib_module_accept
276 #elif defined GNULIB_POSIXCHECK
277 # undef accept
278 # if HAVE_RAW_DECL_ACCEPT
279 _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
280                  "use gnulib module accept for portability");
281 # endif
282 #endif
283
284 #if @GNULIB_BIND@
285 # if @HAVE_WINSOCK2_H@
286 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
287 #   undef bind
288 #   define bind rpl_bind
289 #  endif
290 _GL_FUNCDECL_RPL (bind, int,
291                   (int fd, const struct sockaddr *addr, socklen_t addrlen)
292                   _GL_ARG_NONNULL ((2)));
293 _GL_CXXALIAS_RPL (bind, int,
294                   (int fd, const struct sockaddr *addr, socklen_t addrlen));
295 # else
296 _GL_CXXALIAS_SYS (bind, int,
297                   (int fd, const struct sockaddr *addr, socklen_t addrlen));
298 # endif
299 _GL_CXXALIASWARN (bind);
300 #elif @HAVE_WINSOCK2_H@
301 # undef bind
302 # define bind bind_used_without_requesting_gnulib_module_bind
303 #elif defined GNULIB_POSIXCHECK
304 # undef bind
305 # if HAVE_RAW_DECL_BIND
306 _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
307                  "use gnulib module bind for portability");
308 # endif
309 #endif
310
311 #if @GNULIB_GETPEERNAME@
312 # if @HAVE_WINSOCK2_H@
313 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
314 #   undef getpeername
315 #   define getpeername rpl_getpeername
316 #  endif
317 _GL_FUNCDECL_RPL (getpeername, int,
318                   (int fd, struct sockaddr *addr, socklen_t *addrlen)
319                   _GL_ARG_NONNULL ((2, 3)));
320 _GL_CXXALIAS_RPL (getpeername, int,
321                   (int fd, struct sockaddr *addr, socklen_t *addrlen));
322 # else
323 /* Need to cast, because on Solaris 10 systems, the third parameter is
324                                                        void *addrlen.  */
325 _GL_CXXALIAS_SYS_CAST (getpeername, int,
326                        (int fd, struct sockaddr *addr, socklen_t *addrlen));
327 # endif
328 _GL_CXXALIASWARN (getpeername);
329 #elif @HAVE_WINSOCK2_H@
330 # undef getpeername
331 # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
332 #elif defined GNULIB_POSIXCHECK
333 # undef getpeername
334 # if HAVE_RAW_DECL_GETPEERNAME
335 _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
336                  "use gnulib module getpeername for portability");
337 # endif
338 #endif
339
340 #if @GNULIB_GETSOCKNAME@
341 # if @HAVE_WINSOCK2_H@
342 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
343 #   undef getsockname
344 #   define getsockname rpl_getsockname
345 #  endif
346 _GL_FUNCDECL_RPL (getsockname, int,
347                   (int fd, struct sockaddr *addr, socklen_t *addrlen)
348                   _GL_ARG_NONNULL ((2, 3)));
349 _GL_CXXALIAS_RPL (getsockname, int,
350                   (int fd, struct sockaddr *addr, socklen_t *addrlen));
351 # else
352 /* Need to cast, because on Solaris 10 systems, the third parameter is
353                                                        void *addrlen.  */
354 _GL_CXXALIAS_SYS_CAST (getsockname, int,
355                        (int fd, struct sockaddr *addr, socklen_t *addrlen));
356 # endif
357 _GL_CXXALIASWARN (getsockname);
358 #elif @HAVE_WINSOCK2_H@
359 # undef getsockname
360 # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
361 #elif defined GNULIB_POSIXCHECK
362 # undef getsockname
363 # if HAVE_RAW_DECL_GETSOCKNAME
364 _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
365                  "use gnulib module getsockname for portability");
366 # endif
367 #endif
368
369 #if @GNULIB_GETSOCKOPT@
370 # if @HAVE_WINSOCK2_H@
371 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
372 #   undef getsockopt
373 #   define getsockopt rpl_getsockopt
374 #  endif
375 _GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname,
376                                     void *optval, socklen_t *optlen)
377                                    _GL_ARG_NONNULL ((4, 5)));
378 _GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname,
379                                     void *optval, socklen_t *optlen));
380 # else
381 /* Need to cast, because on Solaris 10 systems, the fifth parameter is
382                                                        void *optlen.  */
383 _GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname,
384                                          void *optval, socklen_t *optlen));
385 # endif
386 _GL_CXXALIASWARN (getsockopt);
387 #elif @HAVE_WINSOCK2_H@
388 # undef getsockopt
389 # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
390 #elif defined GNULIB_POSIXCHECK
391 # undef getsockopt
392 # if HAVE_RAW_DECL_GETSOCKOPT
393 _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
394                  "use gnulib module getsockopt for portability");
395 # endif
396 #endif
397
398 #if @GNULIB_LISTEN@
399 # if @HAVE_WINSOCK2_H@
400 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
401 #   undef listen
402 #   define listen rpl_listen
403 #  endif
404 _GL_FUNCDECL_RPL (listen, int, (int fd, int backlog));
405 _GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
406 # else
407 _GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
408 # endif
409 _GL_CXXALIASWARN (listen);
410 #elif @HAVE_WINSOCK2_H@
411 # undef listen
412 # define listen listen_used_without_requesting_gnulib_module_listen
413 #elif defined GNULIB_POSIXCHECK
414 # undef listen
415 # if HAVE_RAW_DECL_LISTEN
416 _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
417                  "use gnulib module listen for portability");
418 # endif
419 #endif
420
421 #if @GNULIB_RECV@
422 # if @HAVE_WINSOCK2_H@
423 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
424 #   undef recv
425 #   define recv rpl_recv
426 #  endif
427 _GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
428                                  _GL_ARG_NONNULL ((2)));
429 _GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
430 # else
431 _GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
432 # endif
433 _GL_CXXALIASWARN (recv);
434 #elif @HAVE_WINSOCK2_H@
435 # undef recv
436 # define recv recv_used_without_requesting_gnulib_module_recv
437 #elif defined GNULIB_POSIXCHECK
438 # undef recv
439 # if HAVE_RAW_DECL_RECV
440 _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
441                  "use gnulib module recv for portability");
442 # endif
443 #endif
444
445 #if @GNULIB_SEND@
446 # if @HAVE_WINSOCK2_H@
447 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
448 #   undef send
449 #   define send rpl_send
450 #  endif
451 _GL_FUNCDECL_RPL (send, ssize_t,
452                   (int fd, const void *buf, size_t len, int flags)
453                   _GL_ARG_NONNULL ((2)));
454 _GL_CXXALIAS_RPL (send, ssize_t,
455                   (int fd, const void *buf, size_t len, int flags));
456 # else
457 _GL_CXXALIAS_SYS (send, ssize_t,
458                   (int fd, const void *buf, size_t len, int flags));
459 # endif
460 _GL_CXXALIASWARN (send);
461 #elif @HAVE_WINSOCK2_H@
462 # undef send
463 # define send send_used_without_requesting_gnulib_module_send
464 #elif defined GNULIB_POSIXCHECK
465 # undef send
466 # if HAVE_RAW_DECL_SEND
467 _GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
468                  "use gnulib module send for portability");
469 # endif
470 #endif
471
472 #if @GNULIB_RECVFROM@
473 # if @HAVE_WINSOCK2_H@
474 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
475 #   undef recvfrom
476 #   define recvfrom rpl_recvfrom
477 #  endif
478 _GL_FUNCDECL_RPL (recvfrom, ssize_t,
479                   (int fd, void *buf, size_t len, int flags,
480                    struct sockaddr *from, socklen_t *fromlen)
481                   _GL_ARG_NONNULL ((2)));
482 _GL_CXXALIAS_RPL (recvfrom, ssize_t,
483                   (int fd, void *buf, size_t len, int flags,
484                    struct sockaddr *from, socklen_t *fromlen));
485 # else
486 /* Need to cast, because on Solaris 10 systems, the sixth parameter is
487                                                void *fromlen.  */
488 _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
489                        (int fd, void *buf, size_t len, int flags,
490                         struct sockaddr *from, socklen_t *fromlen));
491 # endif
492 _GL_CXXALIASWARN (recvfrom);
493 #elif @HAVE_WINSOCK2_H@
494 # undef recvfrom
495 # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
496 #elif defined GNULIB_POSIXCHECK
497 # undef recvfrom
498 # if HAVE_RAW_DECL_RECVFROM
499 _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
500                  "use gnulib module recvfrom for portability");
501 # endif
502 #endif
503
504 #if @GNULIB_SENDTO@
505 # if @HAVE_WINSOCK2_H@
506 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
507 #   undef sendto
508 #   define sendto rpl_sendto
509 #  endif
510 _GL_FUNCDECL_RPL (sendto, ssize_t,
511                   (int fd, const void *buf, size_t len, int flags,
512                    const struct sockaddr *to, socklen_t tolen)
513                   _GL_ARG_NONNULL ((2)));
514 _GL_CXXALIAS_RPL (sendto, ssize_t,
515                   (int fd, const void *buf, size_t len, int flags,
516                    const struct sockaddr *to, socklen_t tolen));
517 # else
518 _GL_CXXALIAS_SYS (sendto, ssize_t,
519                   (int fd, const void *buf, size_t len, int flags,
520                    const struct sockaddr *to, socklen_t tolen));
521 # endif
522 _GL_CXXALIASWARN (sendto);
523 #elif @HAVE_WINSOCK2_H@
524 # undef sendto
525 # define sendto sendto_used_without_requesting_gnulib_module_sendto
526 #elif defined GNULIB_POSIXCHECK
527 # undef sendto
528 # if HAVE_RAW_DECL_SENDTO
529 _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
530                  "use gnulib module sendto for portability");
531 # endif
532 #endif
533
534 #if @GNULIB_SETSOCKOPT@
535 # if @HAVE_WINSOCK2_H@
536 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
537 #   undef setsockopt
538 #   define setsockopt rpl_setsockopt
539 #  endif
540 _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
541                                     const void * optval, socklen_t optlen)
542                                    _GL_ARG_NONNULL ((4)));
543 _GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
544                                     const void * optval, socklen_t optlen));
545 # else
546 _GL_CXXALIAS_SYS (setsockopt, int, (int fd, int level, int optname,
547                                     const void * optval, socklen_t optlen));
548 # endif
549 _GL_CXXALIASWARN (setsockopt);
550 #elif @HAVE_WINSOCK2_H@
551 # undef setsockopt
552 # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
553 #elif defined GNULIB_POSIXCHECK
554 # undef setsockopt
555 # if HAVE_RAW_DECL_SETSOCKOPT
556 _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
557                  "use gnulib module setsockopt for portability");
558 # endif
559 #endif
560
561 #if @GNULIB_SHUTDOWN@
562 # if @HAVE_WINSOCK2_H@
563 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
564 #   undef shutdown
565 #   define shutdown rpl_shutdown
566 #  endif
567 _GL_FUNCDECL_RPL (shutdown, int, (int fd, int how));
568 _GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
569 # else
570 _GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
571 # endif
572 _GL_CXXALIASWARN (shutdown);
573 #elif @HAVE_WINSOCK2_H@
574 # undef shutdown
575 # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
576 #elif defined GNULIB_POSIXCHECK
577 # undef shutdown
578 # if HAVE_RAW_DECL_SHUTDOWN
579 _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
580                  "use gnulib module shutdown for portability");
581 # endif
582 #endif
583
584 #if @HAVE_WINSOCK2_H@
585 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
586 #  undef select
587 #  define select select_used_without_including_sys_select_h
588 # else
589    _GL_WARN_ON_USE (select,
590                     "select() used without including <sys/select.h>");
591 # endif
592 #endif
593
594 #if @GNULIB_ACCEPT4@
595 /* Accept a connection on a socket, with specific opening flags.
596    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
597    and O_TEXT, O_BINARY (defined in "binary-io.h").
598    See also the Linux man page at
599    <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>.  */
600 # if @HAVE_ACCEPT4@
601 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
602 #   define accept4 rpl_accept4
603 #  endif
604 _GL_FUNCDECL_RPL (accept4, int,
605                   (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
606                    int flags));
607 _GL_CXXALIAS_RPL (accept4, int,
608                   (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
609                    int flags));
610 # else
611 _GL_FUNCDECL_SYS (accept4, int,
612                   (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
613                    int flags));
614 _GL_CXXALIAS_SYS (accept4, int,
615                   (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
616                    int flags));
617 # endif
618 _GL_CXXALIASWARN (accept4);
619 #elif defined GNULIB_POSIXCHECK
620 # undef accept4
621 # if HAVE_RAW_DECL_ACCEPT4
622 _GL_WARN_ON_USE (accept4, "accept4 is unportable - "
623                  "use gnulib module accept4 for portability");
624 # endif
625 #endif
626
627 #endif /* _GL_SYS_SOCKET_H */
628 #endif /* _GL_SYS_SOCKET_H */
629 #endif