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