Mercurial > gnulib
annotate lib/sys_socket.in.h @ 17363:5a51fb7777a9
sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Problem reported by Marco Atzeri in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>.
* lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]:
Simply delegate to the system <sys/select.h> in this case too.
Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only
if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to
be needed on Solaris either.
* lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]:
Simply delgate to the system <sys/time.h> in this case.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 19 Mar 2013 09:08:47 -0700 |
parents | e542fd46ad6f |
children | 1f9070ef79b0 |
rev | line source |
---|---|
9907
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
1 /* Provide a sys/socket header file for systems lacking it (read: MinGW) |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
2 and for systems where it is incomplete. |
17249
e542fd46ad6f
maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents:
17173
diff
changeset
|
3 Copyright (C) 2005-2013 Free Software Foundation, Inc. |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 Written by Simon Josefsson. |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 This program is free software; you can redistribute it and/or modify |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 it under the terms of the GNU General Public License as published by |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 the Free Software Foundation; either version 2, or (at your option) |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 any later version. |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 This program is distributed in the hope that it will be useful, |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 GNU General Public License for more details. |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License |
16366
bb182ee4a09d
maint: replace FSF snail-mail addresses with URLs
Paul Eggert <eggert@cs.ucla.edu>
parents:
16358
diff
changeset
|
17 along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 |
9907
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
19 /* This file is supposed to be used on platforms that lack <sys/socket.h>, |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
20 on platforms where <sys/socket.h> cannot be included standalone, and on |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
21 platforms where <sys/socket.h> does not provide all necessary definitions. |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 It is intended to provide definitions and prototypes needed by an |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 application. */ |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 |
13055
c7be8484e434
maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents:
12945
diff
changeset
|
25 #if __GNUC__ >= 3 |
c7be8484e434
maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents:
12945
diff
changeset
|
26 @PRAGMA_SYSTEM_HEADER@ |
c7be8484e434
maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents:
12945
diff
changeset
|
27 #endif |
13761
a19ace3ba849
Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents:
13758
diff
changeset
|
28 @PRAGMA_COLUMNS@ |
13055
c7be8484e434
maint: use pragma consistently across replacement headers
Eric Blake <eblake@redhat.com>
parents:
12945
diff
changeset
|
29 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
30 #if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
31 /* Special invocation convention: |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
32 - On Cygwin 1.5.x we have a sequence of nested includes |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
33 <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
34 and the latter includes <sys/socket.h>. In this situation, the functions |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
35 are not yet declared, therefore we cannot provide the C++ aliases. */ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
36 |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
37 #@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
38 |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
39 #else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
40 /* Normal invocation convention. */ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
41 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14661
diff
changeset
|
42 #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 #if @HAVE_SYS_SOCKET_H@ |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
45 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
46 # define _GL_ALREADY_INCLUDING_SYS_SOCKET_H |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
47 |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 /* On many platforms, <sys/socket.h> assumes prior inclusion of |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 <sys/types.h>. */ |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 # include <sys/types.h> |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 |
14428
37be22410279
passfd: Work around bug with CMSG_FIRSTHDR on FreeBSD 6.4.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
52 /* On FreeBSD 6.4, <sys/socket.h> defines some macros that assume that NULL |
37be22410279
passfd: Work around bug with CMSG_FIRSTHDR on FreeBSD 6.4.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
53 is defined. */ |
37be22410279
passfd: Work around bug with CMSG_FIRSTHDR on FreeBSD 6.4.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
54 # include <stddef.h> |
37be22410279
passfd: Work around bug with CMSG_FIRSTHDR on FreeBSD 6.4.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
55 |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 /* The include_next requires a split double-inclusion guard. */ |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
59 # undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
60 |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 #endif |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
62 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14661
diff
changeset
|
63 #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H |
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14661
diff
changeset
|
64 #define _@GUARD_PREFIX@_SYS_SOCKET_H |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 |
17173
69d9b9c93232
sys_socket: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
66 _GL_INLINE_HEADER_BEGIN |
69d9b9c93232
sys_socket: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
67 #ifndef _GL_SYS_SOCKET_INLINE |
69d9b9c93232
sys_socket: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
68 # define _GL_SYS_SOCKET_INLINE _GL_INLINE |
69d9b9c93232
sys_socket: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
69 #endif |
69d9b9c93232
sys_socket: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
70 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
71 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
72 |
12422
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
73 /* The definition of _GL_ARG_NONNULL is copied here. */ |
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
74 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
75 /* The definition of _GL_WARN_ON_USE is copied here. */ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
76 |
11577
40afcbcc19ed
sys_socket: MinGW and IRIX does not have sa_family_t type.
Simon Josefsson <simon@josefsson.org>
parents:
11559
diff
changeset
|
77 #if !@HAVE_SA_FAMILY_T@ |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
78 # if !GNULIB_defined_sa_family_t |
11577
40afcbcc19ed
sys_socket: MinGW and IRIX does not have sa_family_t type.
Simon Josefsson <simon@josefsson.org>
parents:
11559
diff
changeset
|
79 typedef unsigned short sa_family_t; |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
80 # define GNULIB_defined_sa_family_t 1 |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
81 # endif |
11577
40afcbcc19ed
sys_socket: MinGW and IRIX does not have sa_family_t type.
Simon Josefsson <simon@josefsson.org>
parents:
11559
diff
changeset
|
82 #endif |
40afcbcc19ed
sys_socket: MinGW and IRIX does not have sa_family_t type.
Simon Josefsson <simon@josefsson.org>
parents:
11559
diff
changeset
|
83 |
13910
d2ab80f79a05
sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents:
13761
diff
changeset
|
84 #if @HAVE_STRUCT_SOCKADDR_STORAGE@ |
d2ab80f79a05
sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents:
13761
diff
changeset
|
85 /* Make the 'struct sockaddr_storage' field 'ss_family' visible on AIX 7.1. */ |
d2ab80f79a05
sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents:
13761
diff
changeset
|
86 # if !@HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@ |
d2ab80f79a05
sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents:
13761
diff
changeset
|
87 # ifndef ss_family |
d2ab80f79a05
sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents:
13761
diff
changeset
|
88 # define ss_family __ss_family |
d2ab80f79a05
sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents:
13761
diff
changeset
|
89 # endif |
d2ab80f79a05
sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents:
13761
diff
changeset
|
90 # endif |
d2ab80f79a05
sys_socket: Ensure ss_family field on AIX.
Bruno Haible <bruno@clisp.org>
parents:
13761
diff
changeset
|
91 #else |
15998
9b28a5d31bb5
sys_socket: use stdalign, not alignof
Paul Eggert <eggert@cs.ucla.edu>
parents:
15355
diff
changeset
|
92 # include <stdalign.h> |
11555
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
93 /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on |
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
94 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */ |
11559
b7f5d7ba4651
Don't use undefined macro 'max'.
Bruno Haible <bruno@clisp.org>
parents:
11555
diff
changeset
|
95 # define __ss_aligntype unsigned long int |
b7f5d7ba4651
Don't use undefined macro 'max'.
Bruno Haible <bruno@clisp.org>
parents:
11555
diff
changeset
|
96 # define _SS_SIZE 256 |
b7f5d7ba4651
Don't use undefined macro 'max'.
Bruno Haible <bruno@clisp.org>
parents:
11555
diff
changeset
|
97 # define _SS_PADSIZE \ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11899
diff
changeset
|
98 (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11899
diff
changeset
|
99 ? sizeof (sa_family_t) \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11899
diff
changeset
|
100 : alignof (__ss_aligntype)) \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11899
diff
changeset
|
101 + sizeof (__ss_aligntype))) |
11555
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
102 |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
103 # if !GNULIB_defined_struct_sockaddr_storage |
11555
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
104 struct sockaddr_storage |
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
105 { |
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
106 sa_family_t ss_family; /* Address family, etc. */ |
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
107 __ss_aligntype __ss_align; /* Force desired alignment. */ |
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
108 char __ss_padding[_SS_PADSIZE]; |
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
109 }; |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
110 # define GNULIB_defined_struct_sockaddr_storage 1 |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
111 # endif |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
112 |
11555
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
113 #endif |
7612308943f7
sys_socket: Define sockaddr_storage.
Simon Josefsson <simon@josefsson.org>
parents:
11250
diff
changeset
|
114 |
14661
b98c01416471
sys_socket: Ensure 'struct iovec' definition.
Bruno Haible <bruno@clisp.org>
parents:
14599
diff
changeset
|
115 /* Get struct iovec. */ |
b98c01416471
sys_socket: Ensure 'struct iovec' definition.
Bruno Haible <bruno@clisp.org>
parents:
14599
diff
changeset
|
116 /* But avoid namespace pollution on glibc systems. */ |
b98c01416471
sys_socket: Ensure 'struct iovec' definition.
Bruno Haible <bruno@clisp.org>
parents:
14599
diff
changeset
|
117 #if ! defined __GLIBC__ |
b98c01416471
sys_socket: Ensure 'struct iovec' definition.
Bruno Haible <bruno@clisp.org>
parents:
14599
diff
changeset
|
118 # include <sys/uio.h> |
b98c01416471
sys_socket: Ensure 'struct iovec' definition.
Bruno Haible <bruno@clisp.org>
parents:
14599
diff
changeset
|
119 #endif |
b98c01416471
sys_socket: Ensure 'struct iovec' definition.
Bruno Haible <bruno@clisp.org>
parents:
14599
diff
changeset
|
120 |
9907
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
121 #if @HAVE_SYS_SOCKET_H@ |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
122 |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
123 /* A platform that has <sys/socket.h>. */ |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
124 |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
125 /* For shutdown(). */ |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
126 # if !defined SHUT_RD |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
127 # define SHUT_RD 0 |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
128 # endif |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
129 # if !defined SHUT_WR |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
130 # define SHUT_WR 1 |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
131 # endif |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
132 # if !defined SHUT_RDWR |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
133 # define SHUT_RDWR 2 |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
134 # endif |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
135 |
be905220886f
Override <sys/socket.h> when it exists but is incomplete.
Bruno Haible <bruno@clisp.org>
parents:
9266
diff
changeset
|
136 #else |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
137 |
10466 | 138 # ifdef __CYGWIN__ |
139 # error "Cygwin does have a sys/socket.h, doesn't it?!?" | |
140 # endif | |
141 | |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
142 /* A platform that lacks <sys/socket.h>. |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
143 |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
144 Currently only MinGW is supported. See the gnulib manual regarding |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
145 Windows sockets. MinGW has the header files winsock2.h and |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
146 ws2tcpip.h that declare the sys/socket.h definitions we need. Note |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
147 that you can influence which definitions you get by setting the |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
148 WINVER symbol before including these two files. For example, |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
149 getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that |
16358 | 150 symbol is set indirectly through WINVER). You can set this by |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
151 adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
152 code may not run on older Windows releases then. My Windows 2000 |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
153 box was not able to run the code, for example. The situation is |
13758
e50f7d9e3040
Avoid some lines longer than 80 characters.
Paul Eggert <eggert@cs.ucla.edu>
parents:
13170
diff
changeset
|
154 slightly confusing because |
e50f7d9e3040
Avoid some lines longer than 80 characters.
Paul Eggert <eggert@cs.ucla.edu>
parents:
13170
diff
changeset
|
155 <http://msdn.microsoft.com/en-us/library/ms738520> |
9266
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
156 suggests that getaddrinfo should be available on all Windows |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
157 releases. */ |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
158 |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
159 # if @HAVE_WINSOCK2_H@ |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
160 # include <winsock2.h> |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
161 # endif |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
162 # if @HAVE_WS2TCPIP_H@ |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
163 # include <ws2tcpip.h> |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
164 # endif |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
165 |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
166 /* For shutdown(). */ |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
167 # if !defined SHUT_RD && defined SD_RECEIVE |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
168 # define SHUT_RD SD_RECEIVE |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
169 # endif |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
170 # if !defined SHUT_WR && defined SD_SEND |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
171 # define SHUT_WR SD_SEND |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
172 # endif |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
173 # if !defined SHUT_RDWR && defined SD_BOTH |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
174 # define SHUT_RDWR SD_BOTH |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
175 # endif |
2e4b4a414ab5
Rename sys_socket_.h to sys_socket.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
176 |
10466 | 177 # if @HAVE_WINSOCK2_H@ |
178 /* Include headers needed by the emulation code. */ | |
179 # include <sys/types.h> | |
180 # include <io.h> | |
181 | |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
182 # if !GNULIB_defined_socklen_t |
10466 | 183 typedef int socklen_t; |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
184 # define GNULIB_defined_socklen_t 1 |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
185 # endif |
10466 | 186 |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
187 # endif |
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
188 |
14599
2a40136b85ae
passfd: allow compilation on mingw
Eric Blake <eblake@redhat.com>
parents:
14428
diff
changeset
|
189 /* Rudimentary 'struct msghdr'; this works as long as you don't try to |
2a40136b85ae
passfd: allow compilation on mingw
Eric Blake <eblake@redhat.com>
parents:
14428
diff
changeset
|
190 access msg_control or msg_controllen. */ |
2a40136b85ae
passfd: allow compilation on mingw
Eric Blake <eblake@redhat.com>
parents:
14428
diff
changeset
|
191 struct msghdr { |
2a40136b85ae
passfd: allow compilation on mingw
Eric Blake <eblake@redhat.com>
parents:
14428
diff
changeset
|
192 void *msg_name; |
2a40136b85ae
passfd: allow compilation on mingw
Eric Blake <eblake@redhat.com>
parents:
14428
diff
changeset
|
193 socklen_t msg_namelen; |
2a40136b85ae
passfd: allow compilation on mingw
Eric Blake <eblake@redhat.com>
parents:
14428
diff
changeset
|
194 struct iovec *msg_iov; |
2a40136b85ae
passfd: allow compilation on mingw
Eric Blake <eblake@redhat.com>
parents:
14428
diff
changeset
|
195 int msg_iovlen; |
2a40136b85ae
passfd: allow compilation on mingw
Eric Blake <eblake@redhat.com>
parents:
14428
diff
changeset
|
196 int msg_flags; |
2a40136b85ae
passfd: allow compilation on mingw
Eric Blake <eblake@redhat.com>
parents:
14428
diff
changeset
|
197 }; |
2a40136b85ae
passfd: allow compilation on mingw
Eric Blake <eblake@redhat.com>
parents:
14428
diff
changeset
|
198 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
199 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
200 |
15355
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
201 /* Fix some definitions from <winsock2.h>. */ |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
202 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
203 #if @HAVE_WINSOCK2_H@ |
10539
affb655993ea
Make the headers usable in C++.
Bruno Haible <bruno@clisp.org>
parents:
10474
diff
changeset
|
204 |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
205 # if !GNULIB_defined_rpl_fd_isset |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
206 |
10562
ebbb50a36a9f
remove trailing spaces
Jim Meyering <meyering@redhat.com>
parents:
10539
diff
changeset
|
207 /* Re-define FD_ISSET to avoid a WSA call while we are not using |
10466 | 208 network sockets. */ |
17173
69d9b9c93232
sys_socket: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
209 _GL_SYS_SOCKET_INLINE int |
10701
8666d9b0d37a
lib/sys_socket.in.h (FD_ISSET): Fix warnings under mingw.
Simon Josefsson <simon@josefsson.org>
parents:
10693
diff
changeset
|
210 rpl_fd_isset (SOCKET fd, fd_set * set) |
9966
2efe37d5c70d
Make setsockopt replacement more typesafe.
Simon Josefsson <simon@josefsson.org>
parents:
9962
diff
changeset
|
211 { |
10701
8666d9b0d37a
lib/sys_socket.in.h (FD_ISSET): Fix warnings under mingw.
Simon Josefsson <simon@josefsson.org>
parents:
10693
diff
changeset
|
212 u_int i; |
10466 | 213 if (set == NULL) |
214 return 0; | |
215 | |
216 for (i = 0; i < set->fd_count; i++) | |
217 if (set->fd_array[i] == fd) | |
218 return 1; | |
219 | |
220 return 0; | |
9966
2efe37d5c70d
Make setsockopt replacement more typesafe.
Simon Josefsson <simon@josefsson.org>
parents:
9962
diff
changeset
|
221 } |
10466 | 222 |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
223 # define GNULIB_defined_rpl_fd_isset 1 |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
224 # endif |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
225 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
226 # undef FD_ISSET |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
227 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) |
10466 | 228 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
229 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
230 |
15355
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
231 /* Hide some function declarations from <winsock2.h>. */ |
10466 | 232 |
15355
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
233 #if @HAVE_WINSOCK2_H@ |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
234 # if !defined _@GUARD_PREFIX@_UNISTD_H |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
235 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
236 # undef close |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
237 # define close close_used_without_including_unistd_h |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
238 # else |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
239 _GL_WARN_ON_USE (close, |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
240 "close() used without including <unistd.h>"); |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
241 # endif |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
242 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
243 # undef gethostname |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
244 # define gethostname gethostname_used_without_including_unistd_h |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
245 # else |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
246 _GL_WARN_ON_USE (gethostname, |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
247 "gethostname() used without including <unistd.h>"); |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
248 # endif |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
249 # endif |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
250 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
251 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
252 # undef select |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
253 # define select select_used_without_including_sys_select_h |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
254 # else |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
255 _GL_WARN_ON_USE (select, |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
256 "select() used without including <sys/select.h>"); |
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
257 # endif |
13170
9b99814e369a
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
13055
diff
changeset
|
258 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
259 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
260 |
15355
c403e287a49e
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
261 /* Wrap everything else to use libc file descriptors for sockets. */ |
10716
16c473421488
Override the gethostname() declaration on native Windows systems.
Bruno Haible <bruno@clisp.org>
parents:
10714
diff
changeset
|
262 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
263 #if @GNULIB_SOCKET@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
264 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
265 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
266 # undef socket |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
267 # define socket rpl_socket |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
268 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
269 _GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
270 _GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
271 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
272 _GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
273 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
274 _GL_CXXALIASWARN (socket); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
275 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
276 # undef socket |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
277 # define socket socket_used_without_requesting_gnulib_module_socket |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
278 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
279 # undef socket |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
280 # if HAVE_RAW_DECL_SOCKET |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
281 _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
282 "use gnulib module socket for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
283 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
284 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
285 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
286 #if @GNULIB_CONNECT@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
287 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
288 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
289 # undef connect |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
290 # define connect rpl_connect |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
291 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
292 _GL_FUNCDECL_RPL (connect, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
293 (int fd, const struct sockaddr *addr, socklen_t addrlen) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
294 _GL_ARG_NONNULL ((2))); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
295 _GL_CXXALIAS_RPL (connect, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
296 (int fd, const struct sockaddr *addr, socklen_t addrlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
297 # else |
14013
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
298 /* Need to cast, because on NonStop Kernel, the third parameter is |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
299 size_t addrlen. */ |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
300 _GL_CXXALIAS_SYS_CAST (connect, int, |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
301 (int fd, |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
302 const struct sockaddr *addr, socklen_t addrlen)); |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
303 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
304 _GL_CXXALIASWARN (connect); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
305 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
306 # undef connect |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
307 # define connect socket_used_without_requesting_gnulib_module_connect |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
308 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
309 # undef connect |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
310 # if HAVE_RAW_DECL_CONNECT |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
311 _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
312 "use gnulib module connect for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
313 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
314 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
315 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
316 #if @GNULIB_ACCEPT@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
317 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
318 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
319 # undef accept |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
320 # define accept rpl_accept |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
321 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
322 _GL_FUNCDECL_RPL (accept, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
323 (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
324 _GL_CXXALIAS_RPL (accept, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
325 (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
326 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
327 /* Need to cast, because on Solaris 10 systems, the third parameter is |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
328 void *addrlen. */ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
329 _GL_CXXALIAS_SYS_CAST (accept, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
330 (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
331 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
332 _GL_CXXALIASWARN (accept); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
333 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
334 # undef accept |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
335 # define accept accept_used_without_requesting_gnulib_module_accept |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
336 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
337 # undef accept |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
338 # if HAVE_RAW_DECL_ACCEPT |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
339 _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
340 "use gnulib module accept for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
341 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
342 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
343 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
344 #if @GNULIB_BIND@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
345 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
346 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
347 # undef bind |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
348 # define bind rpl_bind |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
349 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
350 _GL_FUNCDECL_RPL (bind, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
351 (int fd, const struct sockaddr *addr, socklen_t addrlen) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
352 _GL_ARG_NONNULL ((2))); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
353 _GL_CXXALIAS_RPL (bind, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
354 (int fd, const struct sockaddr *addr, socklen_t addrlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
355 # else |
14013
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
356 /* Need to cast, because on NonStop Kernel, the third parameter is |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
357 size_t addrlen. */ |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
358 _GL_CXXALIAS_SYS_CAST (bind, int, |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
359 (int fd, |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
360 const struct sockaddr *addr, socklen_t addrlen)); |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
361 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
362 _GL_CXXALIASWARN (bind); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
363 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
364 # undef bind |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
365 # define bind bind_used_without_requesting_gnulib_module_bind |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
366 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
367 # undef bind |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
368 # if HAVE_RAW_DECL_BIND |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
369 _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
370 "use gnulib module bind for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
371 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
372 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
373 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
374 #if @GNULIB_GETPEERNAME@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
375 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
376 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
377 # undef getpeername |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
378 # define getpeername rpl_getpeername |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
379 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
380 _GL_FUNCDECL_RPL (getpeername, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
381 (int fd, struct sockaddr *addr, socklen_t *addrlen) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
382 _GL_ARG_NONNULL ((2, 3))); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
383 _GL_CXXALIAS_RPL (getpeername, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
384 (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
385 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
386 /* Need to cast, because on Solaris 10 systems, the third parameter is |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
387 void *addrlen. */ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
388 _GL_CXXALIAS_SYS_CAST (getpeername, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
389 (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
390 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
391 _GL_CXXALIASWARN (getpeername); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
392 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
393 # undef getpeername |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
394 # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
395 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
396 # undef getpeername |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
397 # if HAVE_RAW_DECL_GETPEERNAME |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
398 _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
399 "use gnulib module getpeername for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
400 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
401 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
402 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
403 #if @GNULIB_GETSOCKNAME@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
404 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
405 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
406 # undef getsockname |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
407 # define getsockname rpl_getsockname |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
408 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
409 _GL_FUNCDECL_RPL (getsockname, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
410 (int fd, struct sockaddr *addr, socklen_t *addrlen) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
411 _GL_ARG_NONNULL ((2, 3))); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
412 _GL_CXXALIAS_RPL (getsockname, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
413 (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
414 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
415 /* Need to cast, because on Solaris 10 systems, the third parameter is |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
416 void *addrlen. */ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
417 _GL_CXXALIAS_SYS_CAST (getsockname, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
418 (int fd, struct sockaddr *addr, socklen_t *addrlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
419 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
420 _GL_CXXALIASWARN (getsockname); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
421 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
422 # undef getsockname |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
423 # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
424 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
425 # undef getsockname |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
426 # if HAVE_RAW_DECL_GETSOCKNAME |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
427 _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
428 "use gnulib module getsockname for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
429 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
430 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
431 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
432 #if @GNULIB_GETSOCKOPT@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
433 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
434 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
435 # undef getsockopt |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
436 # define getsockopt rpl_getsockopt |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
437 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
438 _GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
439 void *optval, socklen_t *optlen) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
440 _GL_ARG_NONNULL ((4, 5))); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
441 _GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
442 void *optval, socklen_t *optlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
443 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
444 /* Need to cast, because on Solaris 10 systems, the fifth parameter is |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
445 void *optlen. */ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
446 _GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
447 void *optval, socklen_t *optlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
448 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
449 _GL_CXXALIASWARN (getsockopt); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
450 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
451 # undef getsockopt |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
452 # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
453 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
454 # undef getsockopt |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
455 # if HAVE_RAW_DECL_GETSOCKOPT |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
456 _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
457 "use gnulib module getsockopt for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
458 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
459 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
460 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
461 #if @GNULIB_LISTEN@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
462 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
463 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
464 # undef listen |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
465 # define listen rpl_listen |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
466 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
467 _GL_FUNCDECL_RPL (listen, int, (int fd, int backlog)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
468 _GL_CXXALIAS_RPL (listen, int, (int fd, int backlog)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
469 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
470 _GL_CXXALIAS_SYS (listen, int, (int fd, int backlog)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
471 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
472 _GL_CXXALIASWARN (listen); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
473 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
474 # undef listen |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
475 # define listen listen_used_without_requesting_gnulib_module_listen |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
476 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
477 # undef listen |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
478 # if HAVE_RAW_DECL_LISTEN |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
479 _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
480 "use gnulib module listen for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
481 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
482 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
483 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
484 #if @GNULIB_RECV@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
485 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
486 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
487 # undef recv |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
488 # define recv rpl_recv |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
489 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
490 _GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
491 _GL_ARG_NONNULL ((2))); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
492 _GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
493 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
494 _GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
495 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
496 _GL_CXXALIASWARN (recv); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
497 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
498 # undef recv |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
499 # define recv recv_used_without_requesting_gnulib_module_recv |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
500 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
501 # undef recv |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
502 # if HAVE_RAW_DECL_RECV |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
503 _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
504 "use gnulib module recv for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
505 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
506 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
507 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
508 #if @GNULIB_SEND@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
509 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
510 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
511 # undef send |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
512 # define send rpl_send |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
513 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
514 _GL_FUNCDECL_RPL (send, ssize_t, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
515 (int fd, const void *buf, size_t len, int flags) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
516 _GL_ARG_NONNULL ((2))); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
517 _GL_CXXALIAS_RPL (send, ssize_t, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
518 (int fd, const void *buf, size_t len, int flags)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
519 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
520 _GL_CXXALIAS_SYS (send, ssize_t, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
521 (int fd, const void *buf, size_t len, int flags)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
522 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
523 _GL_CXXALIASWARN (send); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
524 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
525 # undef send |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
526 # define send send_used_without_requesting_gnulib_module_send |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
527 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
528 # undef send |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
529 # if HAVE_RAW_DECL_SEND |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
530 _GL_WARN_ON_USE (send, "send is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
531 "use gnulib module send for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
532 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
533 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
534 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
535 #if @GNULIB_RECVFROM@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
536 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
537 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
538 # undef recvfrom |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
539 # define recvfrom rpl_recvfrom |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
540 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
541 _GL_FUNCDECL_RPL (recvfrom, ssize_t, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
542 (int fd, void *buf, size_t len, int flags, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
543 struct sockaddr *from, socklen_t *fromlen) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
544 _GL_ARG_NONNULL ((2))); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
545 _GL_CXXALIAS_RPL (recvfrom, ssize_t, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
546 (int fd, void *buf, size_t len, int flags, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
547 struct sockaddr *from, socklen_t *fromlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
548 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
549 /* Need to cast, because on Solaris 10 systems, the sixth parameter is |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
550 void *fromlen. */ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
551 _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
552 (int fd, void *buf, size_t len, int flags, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
553 struct sockaddr *from, socklen_t *fromlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
554 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
555 _GL_CXXALIASWARN (recvfrom); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
556 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
557 # undef recvfrom |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
558 # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
559 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
560 # undef recvfrom |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
561 # if HAVE_RAW_DECL_RECVFROM |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
562 _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
563 "use gnulib module recvfrom for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
564 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
565 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
566 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
567 #if @GNULIB_SENDTO@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
568 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
569 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
570 # undef sendto |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
571 # define sendto rpl_sendto |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
572 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
573 _GL_FUNCDECL_RPL (sendto, ssize_t, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
574 (int fd, const void *buf, size_t len, int flags, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
575 const struct sockaddr *to, socklen_t tolen) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
576 _GL_ARG_NONNULL ((2))); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
577 _GL_CXXALIAS_RPL (sendto, ssize_t, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
578 (int fd, const void *buf, size_t len, int flags, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
579 const struct sockaddr *to, socklen_t tolen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
580 # else |
14013
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
581 /* Need to cast, because on NonStop Kernel, the sixth parameter is |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
582 size_t tolen. */ |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
583 _GL_CXXALIAS_SYS_CAST (sendto, ssize_t, |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
584 (int fd, const void *buf, size_t len, int flags, |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
585 const struct sockaddr *to, socklen_t tolen)); |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
586 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
587 _GL_CXXALIASWARN (sendto); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
588 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
589 # undef sendto |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
590 # define sendto sendto_used_without_requesting_gnulib_module_sendto |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
591 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
592 # undef sendto |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
593 # if HAVE_RAW_DECL_SENDTO |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
594 _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
595 "use gnulib module sendto for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
596 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
597 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
598 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
599 #if @GNULIB_SETSOCKOPT@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
600 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
601 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
602 # undef setsockopt |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
603 # define setsockopt rpl_setsockopt |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
604 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
605 _GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
606 const void * optval, socklen_t optlen) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
607 _GL_ARG_NONNULL ((4))); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
608 _GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
609 const void * optval, socklen_t optlen)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
610 # else |
14013
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
611 /* Need to cast, because on NonStop Kernel, the fifth parameter is |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
612 size_t optlen. */ |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
613 _GL_CXXALIAS_SYS_CAST (setsockopt, int, |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
614 (int fd, int level, int optname, |
6738ca181bba
sys_socket: Hide mismatch of declarations on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13910
diff
changeset
|
615 const void * optval, socklen_t optlen)); |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
616 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
617 _GL_CXXALIASWARN (setsockopt); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
618 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
619 # undef setsockopt |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
620 # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
621 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
622 # undef setsockopt |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
623 # if HAVE_RAW_DECL_SETSOCKOPT |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
624 _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
625 "use gnulib module setsockopt for portability"); |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
626 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
627 #endif |
10594
43282f926709
New modules 'accept', 'bind', 'connect', 'getpeername', 'getsockname', 'getsockopt', 'listen', 'recv', 'recvfrom', 'send', 'sendto', 'setsockopt', 'socket'.
Bruno Haible <bruno@clisp.org>
parents:
10562
diff
changeset
|
628 |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
629 #if @GNULIB_SHUTDOWN@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
630 # if @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
631 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
10624 | 632 # undef shutdown |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
633 # define shutdown rpl_shutdown |
10624 | 634 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
635 _GL_FUNCDECL_RPL (shutdown, int, (int fd, int how)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
636 _GL_CXXALIAS_RPL (shutdown, int, (int fd, int how)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
637 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
638 _GL_CXXALIAS_SYS (shutdown, int, (int fd, int how)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
639 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
640 _GL_CXXALIASWARN (shutdown); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
641 #elif @HAVE_WINSOCK2_H@ |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
642 # undef shutdown |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
643 # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
644 #elif defined GNULIB_POSIXCHECK |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
645 # undef shutdown |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
646 # if HAVE_RAW_DECL_SHUTDOWN |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
647 _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
648 "use gnulib module shutdown for portability"); |
10624 | 649 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
650 #endif |
10466 | 651 |
11898 | 652 #if @GNULIB_ACCEPT4@ |
653 /* Accept a connection on a socket, with specific opening flags. | |
654 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) | |
655 and O_TEXT, O_BINARY (defined in "binary-io.h"). | |
656 See also the Linux man page at | |
657 <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>. */ | |
11899
f0c8cf1802a2
Tolerate declared but missing accept4 syscall.
Bruno Haible <bruno@clisp.org>
parents:
11898
diff
changeset
|
658 # if @HAVE_ACCEPT4@ |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
659 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
660 # define accept4 rpl_accept4 |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
661 # endif |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
662 _GL_FUNCDECL_RPL (accept4, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
663 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
664 int flags)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
665 _GL_CXXALIAS_RPL (accept4, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
666 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
667 int flags)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
668 # else |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
669 _GL_FUNCDECL_SYS (accept4, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
670 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
671 int flags)); |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
672 _GL_CXXALIAS_SYS (accept4, int, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
673 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, |
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
674 int flags)); |
11899
f0c8cf1802a2
Tolerate declared but missing accept4 syscall.
Bruno Haible <bruno@clisp.org>
parents:
11898
diff
changeset
|
675 # endif |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
676 _GL_CXXALIASWARN (accept4); |
11898 | 677 #elif defined GNULIB_POSIXCHECK |
678 # undef accept4 | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
679 # if HAVE_RAW_DECL_ACCEPT4 |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
680 _GL_WARN_ON_USE (accept4, "accept4 is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
681 "use gnulib module accept4 for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
682 # endif |
11898 | 683 #endif |
684 | |
17173
69d9b9c93232
sys_socket: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
685 _GL_INLINE_HEADER_END |
69d9b9c93232
sys_socket: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16366
diff
changeset
|
686 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14661
diff
changeset
|
687 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */ |
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14661
diff
changeset
|
688 #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */ |
12945
3df573edd305
sys_socket: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12921
diff
changeset
|
689 #endif |