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