summaryrefslogtreecommitdiffstats
path: root/gl/sys_socket.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/sys_socket.in.h')
-rw-r--r--gl/sys_socket.in.h158
1 files changed, 92 insertions, 66 deletions
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h
index 6705593f..c19b7461 100644
--- a/gl/sys_socket.in.h
+++ b/gl/sys_socket.in.h
@@ -1,6 +1,6 @@
1/* Provide a sys/socket header file for systems lacking it (read: MinGW) 1/* Provide a sys/socket header file for systems lacking it (read: MinGW)
2 and for systems where it is incomplete. 2 and for systems where it is incomplete.
3 Copyright (C) 2005-2023 Free Software Foundation, Inc. 3 Copyright (C) 2005-2026 Free Software Foundation, Inc.
4 Written by Simon Josefsson. 4 Written by Simon Josefsson.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
@@ -27,7 +27,7 @@
27#endif 27#endif
28@PRAGMA_COLUMNS@ 28@PRAGMA_COLUMNS@
29 29
30#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H 30#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_SYS_SOCKET_H
31/* Special invocation convention: 31/* Special invocation convention:
32 - On Cygwin 1.5.x we have a sequence of nested includes 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>, 33 <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
@@ -43,7 +43,7 @@
43 43
44#if @HAVE_SYS_SOCKET_H@ 44#if @HAVE_SYS_SOCKET_H@
45 45
46# define _GL_ALREADY_INCLUDING_SYS_SOCKET_H 46# define _@GUARD_PREFIX@_ALREADY_INCLUDING_SYS_SOCKET_H
47 47
48/* On many platforms, <sys/socket.h> assumes prior inclusion of 48/* On many platforms, <sys/socket.h> assumes prior inclusion of
49 <sys/types.h>. */ 49 <sys/types.h>. */
@@ -56,16 +56,19 @@
56/* The include_next requires a split double-inclusion guard. */ 56/* The include_next requires a split double-inclusion guard. */
57# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ 57# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
58 58
59# undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H 59# undef _@GUARD_PREFIX@_ALREADY_INCLUDING_SYS_SOCKET_H
60 60
61#endif 61#endif
62 62
63#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H 63#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
64#define _@GUARD_PREFIX@_SYS_SOCKET_H 64#define _@GUARD_PREFIX@_SYS_SOCKET_H
65 65
66#ifndef _GL_INLINE_HEADER_BEGIN 66/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK,
67 HAVE_RAW_DECL_*, alignof. */
68#if !_GL_CONFIG_H_INCLUDED
67 #error "Please include config.h first." 69 #error "Please include config.h first."
68#endif 70#endif
71
69_GL_INLINE_HEADER_BEGIN 72_GL_INLINE_HEADER_BEGIN
70#ifndef _GL_SYS_SOCKET_INLINE 73#ifndef _GL_SYS_SOCKET_INLINE
71# define _GL_SYS_SOCKET_INLINE _GL_INLINE 74# define _GL_SYS_SOCKET_INLINE _GL_INLINE
@@ -199,6 +202,7 @@ struct sockaddr_storage
199 202
200/* Rudimentary 'struct msghdr'; this works as long as you don't try to 203/* Rudimentary 'struct msghdr'; this works as long as you don't try to
201 access msg_control or msg_controllen. */ 204 access msg_control or msg_controllen. */
205# if !defined GNULIB_defined_struct_msghdr
202struct msghdr { 206struct msghdr {
203 void *msg_name; 207 void *msg_name;
204 socklen_t msg_namelen; 208 socklen_t msg_namelen;
@@ -206,6 +210,8 @@ struct msghdr {
206 int msg_iovlen; 210 int msg_iovlen;
207 int msg_flags; 211 int msg_flags;
208}; 212};
213# define GNULIB_defined_struct_msghdr 1
214# endif
209 215
210#endif 216#endif
211 217
@@ -229,11 +235,10 @@ struct msghdr {
229_GL_SYS_SOCKET_INLINE int 235_GL_SYS_SOCKET_INLINE int
230rpl_fd_isset (SOCKET fd, fd_set * set) 236rpl_fd_isset (SOCKET fd, fd_set * set)
231{ 237{
232 u_int i;
233 if (set == NULL) 238 if (set == NULL)
234 return 0; 239 return 0;
235 240
236 for (i = 0; i < set->fd_count; i++) 241 for (u_int i = 0; i < set->fd_count; i++)
237 if (set->fd_array[i] == fd) 242 if (set->fd_array[i] == fd)
238 return 1; 243 return 1;
239 244
@@ -286,17 +291,18 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
286# undef socket 291# undef socket
287# define socket rpl_socket 292# define socket rpl_socket
288# endif 293# endif
289_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol)); 294_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol), );
290_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol)); 295_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
291# else 296# else
292_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol)); 297_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
293# endif 298# endif
294_GL_CXXALIASWARN (socket); 299_GL_CXXALIASWARN (socket);
295#elif @HAVE_WINSOCK2_H@ 300#elif @HAVE_WINSOCK2_H@
296# undef socket 301# if !GNULIB_SOCKET
297# define socket socket_used_without_requesting_gnulib_module_socket 302# undef socket
303# define socket socket_used_without_requesting_gnulib_module_socket
304# endif
298#elif defined GNULIB_POSIXCHECK 305#elif defined GNULIB_POSIXCHECK
299# undef socket
300# if HAVE_RAW_DECL_SOCKET 306# if HAVE_RAW_DECL_SOCKET
301_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - " 307_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
302 "use gnulib module socket for portability"); 308 "use gnulib module socket for portability");
@@ -310,7 +316,7 @@ _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
310# define connect rpl_connect 316# define connect rpl_connect
311# endif 317# endif
312_GL_FUNCDECL_RPL (connect, int, 318_GL_FUNCDECL_RPL (connect, int,
313 (int fd, const struct sockaddr *addr, socklen_t addrlen) 319 (int fd, const struct sockaddr *addr, socklen_t addrlen),
314 _GL_ARG_NONNULL ((2))); 320 _GL_ARG_NONNULL ((2)));
315_GL_CXXALIAS_RPL (connect, int, 321_GL_CXXALIAS_RPL (connect, int,
316 (int fd, const struct sockaddr *addr, socklen_t addrlen)); 322 (int fd, const struct sockaddr *addr, socklen_t addrlen));
@@ -323,10 +329,11 @@ _GL_CXXALIAS_SYS_CAST (connect, int,
323# endif 329# endif
324_GL_CXXALIASWARN (connect); 330_GL_CXXALIASWARN (connect);
325#elif @HAVE_WINSOCK2_H@ 331#elif @HAVE_WINSOCK2_H@
326# undef connect 332# if !GNULIB_CONNECT
327# define connect socket_used_without_requesting_gnulib_module_connect 333# undef connect
334# define connect connect_used_without_requesting_gnulib_module_connect
335# endif
328#elif defined GNULIB_POSIXCHECK 336#elif defined GNULIB_POSIXCHECK
329# undef connect
330# if HAVE_RAW_DECL_CONNECT 337# if HAVE_RAW_DECL_CONNECT
331_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - " 338_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
332 "use gnulib module connect for portability"); 339 "use gnulib module connect for portability");
@@ -342,7 +349,7 @@ _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
342_GL_FUNCDECL_RPL (accept, int, 349_GL_FUNCDECL_RPL (accept, int,
343 (int fd, 350 (int fd,
344 struct sockaddr *restrict addr, 351 struct sockaddr *restrict addr,
345 socklen_t *restrict addrlen)); 352 socklen_t *restrict addrlen), );
346_GL_CXXALIAS_RPL (accept, int, 353_GL_CXXALIAS_RPL (accept, int,
347 (int fd, 354 (int fd,
348 struct sockaddr *restrict addr, 355 struct sockaddr *restrict addr,
@@ -355,12 +362,15 @@ _GL_CXXALIAS_SYS_CAST (accept, int,
355 struct sockaddr *restrict addr, 362 struct sockaddr *restrict addr,
356 socklen_t *restrict addrlen)); 363 socklen_t *restrict addrlen));
357# endif 364# endif
365# if __GLIBC__ >= 2
358_GL_CXXALIASWARN (accept); 366_GL_CXXALIASWARN (accept);
367# endif
359#elif @HAVE_WINSOCK2_H@ 368#elif @HAVE_WINSOCK2_H@
360# undef accept 369# if !GNULIB_ACCEPT
361# define accept accept_used_without_requesting_gnulib_module_accept 370# undef accept
371# define accept accept_used_without_requesting_gnulib_module_accept
372# endif
362#elif defined GNULIB_POSIXCHECK 373#elif defined GNULIB_POSIXCHECK
363# undef accept
364# if HAVE_RAW_DECL_ACCEPT 374# if HAVE_RAW_DECL_ACCEPT
365_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - " 375_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
366 "use gnulib module accept for portability"); 376 "use gnulib module accept for portability");
@@ -374,7 +384,7 @@ _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
374# define bind rpl_bind 384# define bind rpl_bind
375# endif 385# endif
376_GL_FUNCDECL_RPL (bind, int, 386_GL_FUNCDECL_RPL (bind, int,
377 (int fd, const struct sockaddr *addr, socklen_t addrlen) 387 (int fd, const struct sockaddr *addr, socklen_t addrlen),
378 _GL_ARG_NONNULL ((2))); 388 _GL_ARG_NONNULL ((2)));
379_GL_CXXALIAS_RPL (bind, int, 389_GL_CXXALIAS_RPL (bind, int,
380 (int fd, const struct sockaddr *addr, socklen_t addrlen)); 390 (int fd, const struct sockaddr *addr, socklen_t addrlen));
@@ -387,10 +397,11 @@ _GL_CXXALIAS_SYS_CAST (bind, int,
387# endif 397# endif
388_GL_CXXALIASWARN (bind); 398_GL_CXXALIASWARN (bind);
389#elif @HAVE_WINSOCK2_H@ 399#elif @HAVE_WINSOCK2_H@
390# undef bind 400# if !GNULIB_BIND
391# define bind bind_used_without_requesting_gnulib_module_bind 401# undef bind
402# define bind bind_used_without_requesting_gnulib_module_bind
403# endif
392#elif defined GNULIB_POSIXCHECK 404#elif defined GNULIB_POSIXCHECK
393# undef bind
394# if HAVE_RAW_DECL_BIND 405# if HAVE_RAW_DECL_BIND
395_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - " 406_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
396 "use gnulib module bind for portability"); 407 "use gnulib module bind for portability");
@@ -405,7 +416,7 @@ _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
405# endif 416# endif
406_GL_FUNCDECL_RPL (getpeername, int, 417_GL_FUNCDECL_RPL (getpeername, int,
407 (int fd, struct sockaddr *restrict addr, 418 (int fd, struct sockaddr *restrict addr,
408 socklen_t *restrict addrlen) 419 socklen_t *restrict addrlen),
409 _GL_ARG_NONNULL ((2, 3))); 420 _GL_ARG_NONNULL ((2, 3)));
410_GL_CXXALIAS_RPL (getpeername, int, 421_GL_CXXALIAS_RPL (getpeername, int,
411 (int fd, struct sockaddr *restrict addr, 422 (int fd, struct sockaddr *restrict addr,
@@ -417,12 +428,15 @@ _GL_CXXALIAS_SYS_CAST (getpeername, int,
417 (int fd, struct sockaddr *restrict addr, 428 (int fd, struct sockaddr *restrict addr,
418 socklen_t *restrict addrlen)); 429 socklen_t *restrict addrlen));
419# endif 430# endif
431# if __GLIBC__ >= 2
420_GL_CXXALIASWARN (getpeername); 432_GL_CXXALIASWARN (getpeername);
433# endif
421#elif @HAVE_WINSOCK2_H@ 434#elif @HAVE_WINSOCK2_H@
422# undef getpeername 435# if !GNULIB_GETPEERNAME
423# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername 436# undef getpeername
437# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
438# endif
424#elif defined GNULIB_POSIXCHECK 439#elif defined GNULIB_POSIXCHECK
425# undef getpeername
426# if HAVE_RAW_DECL_GETPEERNAME 440# if HAVE_RAW_DECL_GETPEERNAME
427_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - " 441_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
428 "use gnulib module getpeername for portability"); 442 "use gnulib module getpeername for portability");
@@ -437,7 +451,7 @@ _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
437# endif 451# endif
438_GL_FUNCDECL_RPL (getsockname, int, 452_GL_FUNCDECL_RPL (getsockname, int,
439 (int fd, struct sockaddr *restrict addr, 453 (int fd, struct sockaddr *restrict addr,
440 socklen_t *restrict addrlen) 454 socklen_t *restrict addrlen),
441 _GL_ARG_NONNULL ((2, 3))); 455 _GL_ARG_NONNULL ((2, 3)));
442_GL_CXXALIAS_RPL (getsockname, int, 456_GL_CXXALIAS_RPL (getsockname, int,
443 (int fd, struct sockaddr *restrict addr, 457 (int fd, struct sockaddr *restrict addr,
@@ -449,12 +463,15 @@ _GL_CXXALIAS_SYS_CAST (getsockname, int,
449 (int fd, struct sockaddr *restrict addr, 463 (int fd, struct sockaddr *restrict addr,
450 socklen_t *restrict addrlen)); 464 socklen_t *restrict addrlen));
451# endif 465# endif
466# if __GLIBC__ >= 2
452_GL_CXXALIASWARN (getsockname); 467_GL_CXXALIASWARN (getsockname);
468# endif
453#elif @HAVE_WINSOCK2_H@ 469#elif @HAVE_WINSOCK2_H@
454# undef getsockname 470# if !GNULIB_GETSOCKNAME
455# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname 471# undef getsockname
472# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
473# endif
456#elif defined GNULIB_POSIXCHECK 474#elif defined GNULIB_POSIXCHECK
457# undef getsockname
458# if HAVE_RAW_DECL_GETSOCKNAME 475# if HAVE_RAW_DECL_GETSOCKNAME
459_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - " 476_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
460 "use gnulib module getsockname for portability"); 477 "use gnulib module getsockname for portability");
@@ -469,7 +486,7 @@ _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
469# endif 486# endif
470_GL_FUNCDECL_RPL (getsockopt, int, 487_GL_FUNCDECL_RPL (getsockopt, int,
471 (int fd, int level, int optname, 488 (int fd, int level, int optname,
472 void *restrict optval, socklen_t *restrict optlen) 489 void *restrict optval, socklen_t *restrict optlen),
473 _GL_ARG_NONNULL ((4, 5))); 490 _GL_ARG_NONNULL ((4, 5)));
474_GL_CXXALIAS_RPL (getsockopt, int, 491_GL_CXXALIAS_RPL (getsockopt, int,
475 (int fd, int level, int optname, 492 (int fd, int level, int optname,
@@ -483,10 +500,11 @@ _GL_CXXALIAS_SYS_CAST (getsockopt, int,
483# endif 500# endif
484_GL_CXXALIASWARN (getsockopt); 501_GL_CXXALIASWARN (getsockopt);
485#elif @HAVE_WINSOCK2_H@ 502#elif @HAVE_WINSOCK2_H@
486# undef getsockopt 503# if !GNULIB_GETSOCKOPT
487# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt 504# undef getsockopt
505# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
506# endif
488#elif defined GNULIB_POSIXCHECK 507#elif defined GNULIB_POSIXCHECK
489# undef getsockopt
490# if HAVE_RAW_DECL_GETSOCKOPT 508# if HAVE_RAW_DECL_GETSOCKOPT
491_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - " 509_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
492 "use gnulib module getsockopt for portability"); 510 "use gnulib module getsockopt for portability");
@@ -499,17 +517,18 @@ _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
499# undef listen 517# undef listen
500# define listen rpl_listen 518# define listen rpl_listen
501# endif 519# endif
502_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog)); 520_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog), );
503_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog)); 521_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
504# else 522# else
505_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog)); 523_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
506# endif 524# endif
507_GL_CXXALIASWARN (listen); 525_GL_CXXALIASWARN (listen);
508#elif @HAVE_WINSOCK2_H@ 526#elif @HAVE_WINSOCK2_H@
509# undef listen 527# if !GNULIB_LISTEN
510# define listen listen_used_without_requesting_gnulib_module_listen 528# undef listen
529# define listen listen_used_without_requesting_gnulib_module_listen
530# endif
511#elif defined GNULIB_POSIXCHECK 531#elif defined GNULIB_POSIXCHECK
512# undef listen
513# if HAVE_RAW_DECL_LISTEN 532# if HAVE_RAW_DECL_LISTEN
514_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - " 533_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
515 "use gnulib module listen for portability"); 534 "use gnulib module listen for portability");
@@ -522,7 +541,7 @@ _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
522# undef recv 541# undef recv
523# define recv rpl_recv 542# define recv rpl_recv
524# endif 543# endif
525_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags) 544_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags),
526 _GL_ARG_NONNULL ((2))); 545 _GL_ARG_NONNULL ((2)));
527_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); 546_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
528# else 547# else
@@ -533,10 +552,11 @@ _GL_CXXALIAS_SYS_CAST (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
533# endif 552# endif
534_GL_CXXALIASWARN (recv); 553_GL_CXXALIASWARN (recv);
535#elif @HAVE_WINSOCK2_H@ 554#elif @HAVE_WINSOCK2_H@
536# undef recv 555# if !GNULIB_RECV
537# define recv recv_used_without_requesting_gnulib_module_recv 556# undef recv
557# define recv recv_used_without_requesting_gnulib_module_recv
558# endif
538#elif defined GNULIB_POSIXCHECK 559#elif defined GNULIB_POSIXCHECK
539# undef recv
540# if HAVE_RAW_DECL_RECV 560# if HAVE_RAW_DECL_RECV
541_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - " 561_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
542 "use gnulib module recv for portability"); 562 "use gnulib module recv for portability");
@@ -550,7 +570,7 @@ _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
550# define send rpl_send 570# define send rpl_send
551# endif 571# endif
552_GL_FUNCDECL_RPL (send, ssize_t, 572_GL_FUNCDECL_RPL (send, ssize_t,
553 (int fd, const void *buf, size_t len, int flags) 573 (int fd, const void *buf, size_t len, int flags),
554 _GL_ARG_NONNULL ((2))); 574 _GL_ARG_NONNULL ((2)));
555_GL_CXXALIAS_RPL (send, ssize_t, 575_GL_CXXALIAS_RPL (send, ssize_t,
556 (int fd, const void *buf, size_t len, int flags)); 576 (int fd, const void *buf, size_t len, int flags));
@@ -563,10 +583,11 @@ _GL_CXXALIAS_SYS_CAST (send, ssize_t,
563# endif 583# endif
564_GL_CXXALIASWARN (send); 584_GL_CXXALIASWARN (send);
565#elif @HAVE_WINSOCK2_H@ 585#elif @HAVE_WINSOCK2_H@
566# undef send 586# if !GNULIB_SEND
567# define send send_used_without_requesting_gnulib_module_send 587# undef send
588# define send send_used_without_requesting_gnulib_module_send
589# endif
568#elif defined GNULIB_POSIXCHECK 590#elif defined GNULIB_POSIXCHECK
569# undef send
570# if HAVE_RAW_DECL_SEND 591# if HAVE_RAW_DECL_SEND
571_GL_WARN_ON_USE (send, "send is not always POSIX compliant - " 592_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
572 "use gnulib module send for portability"); 593 "use gnulib module send for portability");
@@ -582,7 +603,7 @@ _GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
582_GL_FUNCDECL_RPL (recvfrom, ssize_t, 603_GL_FUNCDECL_RPL (recvfrom, ssize_t,
583 (int fd, void *restrict buf, size_t len, int flags, 604 (int fd, void *restrict buf, size_t len, int flags,
584 struct sockaddr *restrict from, 605 struct sockaddr *restrict from,
585 socklen_t *restrict fromlen) 606 socklen_t *restrict fromlen),
586 _GL_ARG_NONNULL ((2))); 607 _GL_ARG_NONNULL ((2)));
587_GL_CXXALIAS_RPL (recvfrom, ssize_t, 608_GL_CXXALIAS_RPL (recvfrom, ssize_t,
588 (int fd, void *restrict buf, size_t len, int flags, 609 (int fd, void *restrict buf, size_t len, int flags,
@@ -596,12 +617,15 @@ _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
596 struct sockaddr *restrict from, 617 struct sockaddr *restrict from,
597 socklen_t *restrict fromlen)); 618 socklen_t *restrict fromlen));
598# endif 619# endif
620# if __GLIBC__ >= 2
599_GL_CXXALIASWARN (recvfrom); 621_GL_CXXALIASWARN (recvfrom);
622# endif
600#elif @HAVE_WINSOCK2_H@ 623#elif @HAVE_WINSOCK2_H@
601# undef recvfrom 624# if !GNULIB_RECVFROM
602# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom 625# undef recvfrom
626# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
627# endif
603#elif defined GNULIB_POSIXCHECK 628#elif defined GNULIB_POSIXCHECK
604# undef recvfrom
605# if HAVE_RAW_DECL_RECVFROM 629# if HAVE_RAW_DECL_RECVFROM
606_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - " 630_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
607 "use gnulib module recvfrom for portability"); 631 "use gnulib module recvfrom for portability");
@@ -616,7 +640,7 @@ _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
616# endif 640# endif
617_GL_FUNCDECL_RPL (sendto, ssize_t, 641_GL_FUNCDECL_RPL (sendto, ssize_t,
618 (int fd, const void *buf, size_t len, int flags, 642 (int fd, const void *buf, size_t len, int flags,
619 const struct sockaddr *to, socklen_t tolen) 643 const struct sockaddr *to, socklen_t tolen),
620 _GL_ARG_NONNULL ((2))); 644 _GL_ARG_NONNULL ((2)));
621_GL_CXXALIAS_RPL (sendto, ssize_t, 645_GL_CXXALIAS_RPL (sendto, ssize_t,
622 (int fd, const void *buf, size_t len, int flags, 646 (int fd, const void *buf, size_t len, int flags,
@@ -630,10 +654,11 @@ _GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
630# endif 654# endif
631_GL_CXXALIASWARN (sendto); 655_GL_CXXALIASWARN (sendto);
632#elif @HAVE_WINSOCK2_H@ 656#elif @HAVE_WINSOCK2_H@
633# undef sendto 657# if !GNULIB_SENDTO
634# define sendto sendto_used_without_requesting_gnulib_module_sendto 658# undef sendto
659# define sendto sendto_used_without_requesting_gnulib_module_sendto
660# endif
635#elif defined GNULIB_POSIXCHECK 661#elif defined GNULIB_POSIXCHECK
636# undef sendto
637# if HAVE_RAW_DECL_SENDTO 662# if HAVE_RAW_DECL_SENDTO
638_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - " 663_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
639 "use gnulib module sendto for portability"); 664 "use gnulib module sendto for portability");
@@ -647,7 +672,7 @@ _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
647# define setsockopt rpl_setsockopt 672# define setsockopt rpl_setsockopt
648# endif 673# endif
649_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname, 674_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
650 const void * optval, socklen_t optlen) 675 const void * optval, socklen_t optlen),
651 _GL_ARG_NONNULL ((4))); 676 _GL_ARG_NONNULL ((4)));
652_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname, 677_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
653 const void * optval, socklen_t optlen)); 678 const void * optval, socklen_t optlen));
@@ -660,10 +685,11 @@ _GL_CXXALIAS_SYS_CAST (setsockopt, int,
660# endif 685# endif
661_GL_CXXALIASWARN (setsockopt); 686_GL_CXXALIASWARN (setsockopt);
662#elif @HAVE_WINSOCK2_H@ 687#elif @HAVE_WINSOCK2_H@
663# undef setsockopt 688# if !GNULIB_SETSOCKOPT
664# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt 689# undef setsockopt
690# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
691# endif
665#elif defined GNULIB_POSIXCHECK 692#elif defined GNULIB_POSIXCHECK
666# undef setsockopt
667# if HAVE_RAW_DECL_SETSOCKOPT 693# if HAVE_RAW_DECL_SETSOCKOPT
668_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - " 694_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
669 "use gnulib module setsockopt for portability"); 695 "use gnulib module setsockopt for portability");
@@ -676,17 +702,18 @@ _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
676# undef shutdown 702# undef shutdown
677# define shutdown rpl_shutdown 703# define shutdown rpl_shutdown
678# endif 704# endif
679_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how)); 705_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how), );
680_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how)); 706_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
681# else 707# else
682_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how)); 708_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
683# endif 709# endif
684_GL_CXXALIASWARN (shutdown); 710_GL_CXXALIASWARN (shutdown);
685#elif @HAVE_WINSOCK2_H@ 711#elif @HAVE_WINSOCK2_H@
686# undef shutdown 712# if !GNULIB_SHUTDOWN
687# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown 713# undef shutdown
714# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
715# endif
688#elif defined GNULIB_POSIXCHECK 716#elif defined GNULIB_POSIXCHECK
689# undef shutdown
690# if HAVE_RAW_DECL_SHUTDOWN 717# if HAVE_RAW_DECL_SHUTDOWN
691_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " 718_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
692 "use gnulib module shutdown for portability"); 719 "use gnulib module shutdown for portability");
@@ -705,21 +732,20 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
705# endif 732# endif
706_GL_FUNCDECL_RPL (accept4, int, 733_GL_FUNCDECL_RPL (accept4, int,
707 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 734 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
708 int flags)); 735 int flags), );
709_GL_CXXALIAS_RPL (accept4, int, 736_GL_CXXALIAS_RPL (accept4, int,
710 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 737 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
711 int flags)); 738 int flags));
712# else 739# else
713_GL_FUNCDECL_SYS (accept4, int, 740_GL_FUNCDECL_SYS (accept4, int,
714 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 741 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
715 int flags)); 742 int flags), );
716_GL_CXXALIAS_SYS (accept4, int, 743_GL_CXXALIAS_SYS (accept4, int,
717 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 744 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
718 int flags)); 745 int flags));
719# endif 746# endif
720_GL_CXXALIASWARN (accept4); 747_GL_CXXALIASWARN (accept4);
721#elif defined GNULIB_POSIXCHECK 748#elif defined GNULIB_POSIXCHECK
722# undef accept4
723# if HAVE_RAW_DECL_ACCEPT4 749# if HAVE_RAW_DECL_ACCEPT4
724_GL_WARN_ON_USE (accept4, "accept4 is unportable - " 750_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
725 "use gnulib module accept4 for portability"); 751 "use gnulib module accept4 for portability");