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