~ubuntu-branches/ubuntu/quantal/gnutls26/quantal

« back to all changes in this revision

Viewing changes to lib/gl/sys_socket.in.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-05-20 13:07:18 UTC
  • mfrom: (12.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110520130718-db41dybbanzfvlji
Tags: 2.10.5-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Fix build failure with --no-add-needed.
  - Build for multiarch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Provide a sys/socket header file for systems lacking it (read: MinGW)
2
2
   and for systems where it is incomplete.
3
 
   Copyright (C) 2005-2009 Free Software Foundation, Inc.
 
3
   Copyright (C) 2005-2010 Free Software Foundation, Inc.
4
4
   Written by Simon Josefsson.
5
5
 
6
6
   This program is free software; you can redistribute it and/or modify
23
23
   It is intended to provide definitions and prototypes needed by an
24
24
   application.  */
25
25
 
26
 
#ifndef _GL_SYS_SOCKET_H
27
 
 
28
 
#if @HAVE_SYS_SOCKET_H@
29
 
 
30
 
# if __GNUC__ >= 3
 
26
#if __GNUC__ >= 3
31
27
@PRAGMA_SYSTEM_HEADER@
32
 
# endif
 
28
#endif
 
29
 
 
30
#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
 
31
/* Special invocation convention:
 
32
   - On Cygwin 1.5.x we have a sequence of nested includes
 
33
     <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
 
34
     and the latter includes <sys/socket.h>.  In this situation, the functions
 
35
     are not yet declared, therefore we cannot provide the C++ aliases.  */
 
36
 
 
37
#@INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
 
38
 
 
39
#else
 
40
/* Normal invocation convention.  */
 
41
 
 
42
#ifndef _GL_SYS_SOCKET_H
 
43
 
 
44
#if @HAVE_SYS_SOCKET_H@
 
45
 
 
46
# define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
33
47
 
34
48
/* On many platforms, <sys/socket.h> assumes prior inclusion of
35
49
   <sys/types.h>.  */
38
52
/* The include_next requires a split double-inclusion guard.  */
39
53
# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
40
54
 
 
55
# undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H
 
56
 
41
57
#endif
42
58
 
43
59
#ifndef _GL_SYS_SOCKET_H
44
60
#define _GL_SYS_SOCKET_H
45
61
 
 
62
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
63
 
 
64
/* The definition of _GL_ARG_NONNULL is copied here.  */
 
65
 
 
66
/* The definition of _GL_WARN_ON_USE is copied here.  */
 
67
 
46
68
#if !@HAVE_SA_FAMILY_T@
47
69
typedef unsigned short  sa_family_t;
48
70
#endif
54
76
# define __ss_aligntype unsigned long int
55
77
# define _SS_SIZE 256
56
78
# define _SS_PADSIZE \
57
 
    (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)      \
58
 
                  ? sizeof (sa_family_t)                                \
59
 
                  : alignof (__ss_aligntype))                           \
60
 
                 + sizeof (__ss_aligntype)))
 
79
    (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)      \
 
80
                  ? sizeof (sa_family_t)                                \
 
81
                  : alignof (__ss_aligntype))                           \
 
82
                 + sizeof (__ss_aligntype)))
61
83
 
62
84
struct sockaddr_storage
63
85
{
124
146
#  define SHUT_RDWR SD_BOTH
125
147
# endif
126
148
 
127
 
/* The definition of GL_LINK_WARNING is copied here.  */
128
 
 
129
149
# if @HAVE_WINSOCK2_H@
130
150
/* Include headers needed by the emulation code.  */
131
151
#  include <sys/types.h>
135
155
 
136
156
# endif
137
157
 
138
 
# ifdef __cplusplus
139
 
extern "C" {
140
 
# endif
 
158
#endif
141
159
 
142
 
# if @HAVE_WINSOCK2_H@
 
160
#if @HAVE_WINSOCK2_H@
143
161
 
144
162
/* Re-define FD_ISSET to avoid a WSA call while we are not using
145
163
   network sockets.  */
157
175
  return 0;
158
176
}
159
177
 
160
 
#  undef FD_ISSET
161
 
#  define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
 
178
# undef FD_ISSET
 
179
# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
162
180
 
163
 
# endif
 
181
#endif
164
182
 
165
183
/* Wrap everything else to use libc file descriptors for sockets.  */
166
184
 
167
 
# if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
 
185
#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
 
186
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
168
187
#  undef close
169
188
#  define close close_used_without_including_unistd_h
 
189
# else
 
190
   _GL_WARN_ON_USE (close,
 
191
                    "close() used without including <unistd.h>");
170
192
# endif
 
193
#endif
171
194
 
172
 
# if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
 
195
#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
 
196
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
173
197
#  undef gethostname
174
198
#  define gethostname gethostname_used_without_including_unistd_h
 
199
# else
 
200
   _GL_WARN_ON_USE (gethostname,
 
201
                    "gethostname() used without including <unistd.h>");
175
202
# endif
 
203
#endif
176
204
 
177
 
# if @GNULIB_SOCKET@
178
 
#  if @HAVE_WINSOCK2_H@
 
205
#if @GNULIB_SOCKET@
 
206
# if @HAVE_WINSOCK2_H@
 
207
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
179
208
#   undef socket
180
 
#   define socket               rpl_socket
181
 
extern int rpl_socket (int, int, int protocol);
 
209
#   define socket rpl_socket
182
210
#  endif
183
 
# elif @HAVE_WINSOCK2_H@
184
 
#  undef socket
185
 
#  define socket socket_used_without_requesting_gnulib_module_socket
186
 
# elif defined GNULIB_POSIXCHECK
187
 
#  undef socket
188
 
#  define socket(d,t,p) \
189
 
     (GL_LINK_WARNING ("socket is not always POSIX compliant - " \
190
 
                       "use gnulib module socket for portability"), \
191
 
      socket (d, t, p))
192
 
# endif
 
211
_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol));
 
212
_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
 
213
# else
 
214
_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
 
215
# endif
 
216
_GL_CXXALIASWARN (socket);
 
217
#elif @HAVE_WINSOCK2_H@
 
218
# undef socket
 
219
# define socket socket_used_without_requesting_gnulib_module_socket
 
220
#elif defined GNULIB_POSIXCHECK
 
221
# undef socket
 
222
# if HAVE_RAW_DECL_SOCKET
 
223
_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
 
224
                 "use gnulib module socket for portability");
 
225
# endif
 
226
#endif
193
227
 
194
 
# if @GNULIB_CONNECT@
195
 
#  if @HAVE_WINSOCK2_H@
 
228
#if @GNULIB_CONNECT@
 
229
# if @HAVE_WINSOCK2_H@
 
230
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
196
231
#   undef connect
197
 
#   define connect              rpl_connect
198
 
extern int rpl_connect (int, struct sockaddr *, int);
 
232
#   define connect rpl_connect
199
233
#  endif
200
 
# elif @HAVE_WINSOCK2_H@
201
 
#  undef connect
202
 
#  define connect socket_used_without_requesting_gnulib_module_connect
203
 
# elif defined GNULIB_POSIXCHECK
204
 
#  undef connect
205
 
#  define connect(s,a,l) \
206
 
     (GL_LINK_WARNING ("connect is not always POSIX compliant - " \
207
 
                       "use gnulib module connect for portability"), \
208
 
      connect (s, a, l))
209
 
# endif
 
234
_GL_FUNCDECL_RPL (connect, int,
 
235
                  (int fd, const struct sockaddr *addr, socklen_t addrlen)
 
236
                  _GL_ARG_NONNULL ((2)));
 
237
_GL_CXXALIAS_RPL (connect, int,
 
238
                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
 
239
# else
 
240
_GL_CXXALIAS_SYS (connect, int,
 
241
                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
 
242
# endif
 
243
_GL_CXXALIASWARN (connect);
 
244
#elif @HAVE_WINSOCK2_H@
 
245
# undef connect
 
246
# define connect socket_used_without_requesting_gnulib_module_connect
 
247
#elif defined GNULIB_POSIXCHECK
 
248
# undef connect
 
249
# if HAVE_RAW_DECL_CONNECT
 
250
_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
 
251
                 "use gnulib module connect for portability");
 
252
# endif
 
253
#endif
210
254
 
211
 
# if @GNULIB_ACCEPT@
212
 
#  if @HAVE_WINSOCK2_H@
 
255
#if @GNULIB_ACCEPT@
 
256
# if @HAVE_WINSOCK2_H@
 
257
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
213
258
#   undef accept
214
 
#   define accept               rpl_accept
215
 
extern int rpl_accept (int, struct sockaddr *, int *);
 
259
#   define accept rpl_accept
216
260
#  endif
217
 
# elif @HAVE_WINSOCK2_H@
218
 
#  undef accept
219
 
#  define accept accept_used_without_requesting_gnulib_module_accept
220
 
# elif defined GNULIB_POSIXCHECK
221
 
#  undef accept
222
 
#  define accept(s,a,l) \
223
 
     (GL_LINK_WARNING ("accept is not always POSIX compliant - " \
224
 
                       "use gnulib module accept for portability"), \
225
 
      accept (s, a, l))
226
 
# endif
 
261
_GL_FUNCDECL_RPL (accept, int,
 
262
                  (int fd, struct sockaddr *addr, socklen_t *addrlen));
 
263
_GL_CXXALIAS_RPL (accept, int,
 
264
                  (int fd, struct sockaddr *addr, socklen_t *addrlen));
 
265
# else
 
266
/* Need to cast, because on Solaris 10 systems, the third parameter is
 
267
                                                       void *addrlen.  */
 
268
_GL_CXXALIAS_SYS_CAST (accept, int,
 
269
                       (int fd, struct sockaddr *addr, socklen_t *addrlen));
 
270
# endif
 
271
_GL_CXXALIASWARN (accept);
 
272
#elif @HAVE_WINSOCK2_H@
 
273
# undef accept
 
274
# define accept accept_used_without_requesting_gnulib_module_accept
 
275
#elif defined GNULIB_POSIXCHECK
 
276
# undef accept
 
277
# if HAVE_RAW_DECL_ACCEPT
 
278
_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
 
279
                 "use gnulib module accept for portability");
 
280
# endif
 
281
#endif
227
282
 
228
 
# if @GNULIB_BIND@
229
 
#  if @HAVE_WINSOCK2_H@
 
283
#if @GNULIB_BIND@
 
284
# if @HAVE_WINSOCK2_H@
 
285
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
230
286
#   undef bind
231
 
#   define bind                 rpl_bind
232
 
extern int rpl_bind (int, struct sockaddr *, int);
 
287
#   define bind rpl_bind
233
288
#  endif
234
 
# elif @HAVE_WINSOCK2_H@
235
 
#  undef bind
236
 
#  define bind bind_used_without_requesting_gnulib_module_bind
237
 
# elif defined GNULIB_POSIXCHECK
238
 
#  undef bind
239
 
#  define bind(s,a,l) \
240
 
     (GL_LINK_WARNING ("bind is not always POSIX compliant - " \
241
 
                       "use gnulib module bind for portability"), \
242
 
      bind (s, a, l))
243
 
# endif
 
289
_GL_FUNCDECL_RPL (bind, int,
 
290
                  (int fd, const struct sockaddr *addr, socklen_t addrlen)
 
291
                  _GL_ARG_NONNULL ((2)));
 
292
_GL_CXXALIAS_RPL (bind, int,
 
293
                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
 
294
# else
 
295
_GL_CXXALIAS_SYS (bind, int,
 
296
                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
 
297
# endif
 
298
_GL_CXXALIASWARN (bind);
 
299
#elif @HAVE_WINSOCK2_H@
 
300
# undef bind
 
301
# define bind bind_used_without_requesting_gnulib_module_bind
 
302
#elif defined GNULIB_POSIXCHECK
 
303
# undef bind
 
304
# if HAVE_RAW_DECL_BIND
 
305
_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
 
306
                 "use gnulib module bind for portability");
 
307
# endif
 
308
#endif
244
309
 
245
 
# if @GNULIB_GETPEERNAME@
246
 
#  if @HAVE_WINSOCK2_H@
 
310
#if @GNULIB_GETPEERNAME@
 
311
# if @HAVE_WINSOCK2_H@
 
312
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
247
313
#   undef getpeername
248
 
#   define getpeername          rpl_getpeername
249
 
extern int rpl_getpeername (int, struct sockaddr *, int *);
 
314
#   define getpeername rpl_getpeername
250
315
#  endif
251
 
# elif @HAVE_WINSOCK2_H@
252
 
#  undef getpeername
253
 
#  define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
254
 
# elif defined GNULIB_POSIXCHECK
255
 
#  undef getpeername
256
 
#  define getpeername(s,a,l) \
257
 
     (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \
258
 
                       "use gnulib module getpeername for portability"), \
259
 
      getpeername (s, a, l))
260
 
# endif
 
316
_GL_FUNCDECL_RPL (getpeername, int,
 
317
                  (int fd, struct sockaddr *addr, socklen_t *addrlen)
 
318
                  _GL_ARG_NONNULL ((2, 3)));
 
319
_GL_CXXALIAS_RPL (getpeername, int,
 
320
                  (int fd, struct sockaddr *addr, socklen_t *addrlen));
 
321
# else
 
322
/* Need to cast, because on Solaris 10 systems, the third parameter is
 
323
                                                       void *addrlen.  */
 
324
_GL_CXXALIAS_SYS_CAST (getpeername, int,
 
325
                       (int fd, struct sockaddr *addr, socklen_t *addrlen));
 
326
# endif
 
327
_GL_CXXALIASWARN (getpeername);
 
328
#elif @HAVE_WINSOCK2_H@
 
329
# undef getpeername
 
330
# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
 
331
#elif defined GNULIB_POSIXCHECK
 
332
# undef getpeername
 
333
# if HAVE_RAW_DECL_GETPEERNAME
 
334
_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
 
335
                 "use gnulib module getpeername for portability");
 
336
# endif
 
337
#endif
261
338
 
262
 
# if @GNULIB_GETSOCKNAME@
263
 
#  if @HAVE_WINSOCK2_H@
 
339
#if @GNULIB_GETSOCKNAME@
 
340
# if @HAVE_WINSOCK2_H@
 
341
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
264
342
#   undef getsockname
265
 
#   define getsockname          rpl_getsockname
266
 
extern int rpl_getsockname (int, struct sockaddr *, int *);
 
343
#   define getsockname rpl_getsockname
267
344
#  endif
268
 
# elif @HAVE_WINSOCK2_H@
269
 
#  undef getsockname
270
 
#  define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
271
 
# elif defined GNULIB_POSIXCHECK
272
 
#  undef getsockname
273
 
#  define getsockname(s,a,l) \
274
 
     (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \
275
 
                       "use gnulib module getsockname for portability"), \
276
 
      getsockname (s, a, l))
277
 
# endif
 
345
_GL_FUNCDECL_RPL (getsockname, int,
 
346
                  (int fd, struct sockaddr *addr, socklen_t *addrlen)
 
347
                  _GL_ARG_NONNULL ((2, 3)));
 
348
_GL_CXXALIAS_RPL (getsockname, int,
 
349
                  (int fd, struct sockaddr *addr, socklen_t *addrlen));
 
350
# else
 
351
/* Need to cast, because on Solaris 10 systems, the third parameter is
 
352
                                                       void *addrlen.  */
 
353
_GL_CXXALIAS_SYS_CAST (getsockname, int,
 
354
                       (int fd, struct sockaddr *addr, socklen_t *addrlen));
 
355
# endif
 
356
_GL_CXXALIASWARN (getsockname);
 
357
#elif @HAVE_WINSOCK2_H@
 
358
# undef getsockname
 
359
# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
 
360
#elif defined GNULIB_POSIXCHECK
 
361
# undef getsockname
 
362
# if HAVE_RAW_DECL_GETSOCKNAME
 
363
_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
 
364
                 "use gnulib module getsockname for portability");
 
365
# endif
 
366
#endif
278
367
 
279
 
# if @GNULIB_GETSOCKOPT@
280
 
#  if @HAVE_WINSOCK2_H@
 
368
#if @GNULIB_GETSOCKOPT@
 
369
# if @HAVE_WINSOCK2_H@
 
370
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
281
371
#   undef getsockopt
282
 
#   define getsockopt           rpl_getsockopt
283
 
extern int rpl_getsockopt (int, int, int, void *, socklen_t *);
 
372
#   define getsockopt rpl_getsockopt
284
373
#  endif
285
 
# elif @HAVE_WINSOCK2_H@
286
 
#  undef getsockopt
287
 
#  define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
288
 
# elif defined GNULIB_POSIXCHECK
289
 
#  undef getsockopt
290
 
#  define getsockopt(s,lvl,o,v,l) \
291
 
     (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \
292
 
                       "use gnulib module getsockopt for portability"), \
293
 
      getsockopt (s, lvl, o, v, l))
294
 
# endif
 
374
_GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname,
 
375
                                    void *optval, socklen_t *optlen)
 
376
                                   _GL_ARG_NONNULL ((4, 5)));
 
377
_GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname,
 
378
                                    void *optval, socklen_t *optlen));
 
379
# else
 
380
/* Need to cast, because on Solaris 10 systems, the fifth parameter is
 
381
                                                       void *optlen.  */
 
382
_GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname,
 
383
                                         void *optval, socklen_t *optlen));
 
384
# endif
 
385
_GL_CXXALIASWARN (getsockopt);
 
386
#elif @HAVE_WINSOCK2_H@
 
387
# undef getsockopt
 
388
# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
 
389
#elif defined GNULIB_POSIXCHECK
 
390
# undef getsockopt
 
391
# if HAVE_RAW_DECL_GETSOCKOPT
 
392
_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
 
393
                 "use gnulib module getsockopt for portability");
 
394
# endif
 
395
#endif
295
396
 
296
 
# if @GNULIB_LISTEN@
297
 
#  if @HAVE_WINSOCK2_H@
 
397
#if @GNULIB_LISTEN@
 
398
# if @HAVE_WINSOCK2_H@
 
399
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
298
400
#   undef listen
299
 
#   define listen               rpl_listen
300
 
extern int rpl_listen (int, int);
 
401
#   define listen rpl_listen
301
402
#  endif
302
 
# elif @HAVE_WINSOCK2_H@
303
 
#  undef listen
304
 
#  define listen listen_used_without_requesting_gnulib_module_listen
305
 
# elif defined GNULIB_POSIXCHECK
306
 
#  undef listen
307
 
#  define listen(s,b) \
308
 
     (GL_LINK_WARNING ("listen is not always POSIX compliant - " \
309
 
                       "use gnulib module listen for portability"), \
310
 
      listen (s, b))
311
 
# endif
 
403
_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog));
 
404
_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
 
405
# else
 
406
_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
 
407
# endif
 
408
_GL_CXXALIASWARN (listen);
 
409
#elif @HAVE_WINSOCK2_H@
 
410
# undef listen
 
411
# define listen listen_used_without_requesting_gnulib_module_listen
 
412
#elif defined GNULIB_POSIXCHECK
 
413
# undef listen
 
414
# if HAVE_RAW_DECL_LISTEN
 
415
_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
 
416
                 "use gnulib module listen for portability");
 
417
# endif
 
418
#endif
312
419
 
313
 
# if @GNULIB_RECV@
314
 
#  if @HAVE_WINSOCK2_H@
 
420
#if @GNULIB_RECV@
 
421
# if @HAVE_WINSOCK2_H@
 
422
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
315
423
#   undef recv
316
 
#   define recv                 rpl_recv
317
 
extern int rpl_recv (int, void *, int, int);
 
424
#   define recv rpl_recv
318
425
#  endif
319
 
# elif @HAVE_WINSOCK2_H@
320
 
#  undef recv
321
 
#  define recv recv_used_without_requesting_gnulib_module_recv
322
 
# elif defined GNULIB_POSIXCHECK
323
 
#  undef recv
324
 
#  define recv(s,b,n,f) \
325
 
     (GL_LINK_WARNING ("recv is not always POSIX compliant - " \
326
 
                       "use gnulib module recv for portability"), \
327
 
      recv (s, b, n, f))
328
 
# endif
 
426
_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
 
427
                                 _GL_ARG_NONNULL ((2)));
 
428
_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
 
429
# else
 
430
_GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
 
431
# endif
 
432
_GL_CXXALIASWARN (recv);
 
433
#elif @HAVE_WINSOCK2_H@
 
434
# undef recv
 
435
# define recv recv_used_without_requesting_gnulib_module_recv
 
436
#elif defined GNULIB_POSIXCHECK
 
437
# undef recv
 
438
# if HAVE_RAW_DECL_RECV
 
439
_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
 
440
                 "use gnulib module recv for portability");
 
441
# endif
 
442
#endif
329
443
 
330
 
# if @GNULIB_SEND@
331
 
#  if @HAVE_WINSOCK2_H@
 
444
#if @GNULIB_SEND@
 
445
# if @HAVE_WINSOCK2_H@
 
446
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
332
447
#   undef send
333
 
#   define send                 rpl_send
334
 
extern int rpl_send (int, const void *, int, int);
 
448
#   define send rpl_send
335
449
#  endif
336
 
# elif @HAVE_WINSOCK2_H@
337
 
#  undef send
338
 
#  define send send_used_without_requesting_gnulib_module_send
339
 
# elif defined GNULIB_POSIXCHECK
340
 
#  undef send
341
 
#  define send(s,b,n,f) \
342
 
     (GL_LINK_WARNING ("send is not always POSIX compliant - " \
343
 
                       "use gnulib module send for portability"), \
344
 
      send (s, b, n, f))
345
 
# endif
 
450
_GL_FUNCDECL_RPL (send, ssize_t,
 
451
                  (int fd, const void *buf, size_t len, int flags)
 
452
                  _GL_ARG_NONNULL ((2)));
 
453
_GL_CXXALIAS_RPL (send, ssize_t,
 
454
                  (int fd, const void *buf, size_t len, int flags));
 
455
# else
 
456
_GL_CXXALIAS_SYS (send, ssize_t,
 
457
                  (int fd, const void *buf, size_t len, int flags));
 
458
# endif
 
459
_GL_CXXALIASWARN (send);
 
460
#elif @HAVE_WINSOCK2_H@
 
461
# undef send
 
462
# define send send_used_without_requesting_gnulib_module_send
 
463
#elif defined GNULIB_POSIXCHECK
 
464
# undef send
 
465
# if HAVE_RAW_DECL_SEND
 
466
_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
 
467
                 "use gnulib module send for portability");
 
468
# endif
 
469
#endif
346
470
 
347
 
# if @GNULIB_RECVFROM@
348
 
#  if @HAVE_WINSOCK2_H@
 
471
#if @GNULIB_RECVFROM@
 
472
# if @HAVE_WINSOCK2_H@
 
473
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
349
474
#   undef recvfrom
350
 
#   define recvfrom             rpl_recvfrom
351
 
extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *);
 
475
#   define recvfrom rpl_recvfrom
352
476
#  endif
353
 
# elif @HAVE_WINSOCK2_H@
354
 
#  undef recvfrom
355
 
#  define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
356
 
# elif defined GNULIB_POSIXCHECK
357
 
#  undef recvfrom
358
 
#  define recvfrom(s,b,n,f,a,l) \
359
 
     (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \
360
 
                       "use gnulib module recvfrom for portability"), \
361
 
      recvfrom (s, b, n, f, a, l))
362
 
# endif
 
477
_GL_FUNCDECL_RPL (recvfrom, ssize_t,
 
478
                  (int fd, void *buf, size_t len, int flags,
 
479
                   struct sockaddr *from, socklen_t *fromlen)
 
480
                  _GL_ARG_NONNULL ((2)));
 
481
_GL_CXXALIAS_RPL (recvfrom, ssize_t,
 
482
                  (int fd, void *buf, size_t len, int flags,
 
483
                   struct sockaddr *from, socklen_t *fromlen));
 
484
# else
 
485
/* Need to cast, because on Solaris 10 systems, the sixth parameter is
 
486
                                               void *fromlen.  */
 
487
_GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
 
488
                       (int fd, void *buf, size_t len, int flags,
 
489
                        struct sockaddr *from, socklen_t *fromlen));
 
490
# endif
 
491
_GL_CXXALIASWARN (recvfrom);
 
492
#elif @HAVE_WINSOCK2_H@
 
493
# undef recvfrom
 
494
# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
 
495
#elif defined GNULIB_POSIXCHECK
 
496
# undef recvfrom
 
497
# if HAVE_RAW_DECL_RECVFROM
 
498
_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
 
499
                 "use gnulib module recvfrom for portability");
 
500
# endif
 
501
#endif
363
502
 
364
 
# if @GNULIB_SENDTO@
365
 
#  if @HAVE_WINSOCK2_H@
 
503
#if @GNULIB_SENDTO@
 
504
# if @HAVE_WINSOCK2_H@
 
505
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
366
506
#   undef sendto
367
 
#   define sendto               rpl_sendto
368
 
extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int);
 
507
#   define sendto rpl_sendto
369
508
#  endif
370
 
# elif @HAVE_WINSOCK2_H@
371
 
#  undef sendto
372
 
#  define sendto sendto_used_without_requesting_gnulib_module_sendto
373
 
# elif defined GNULIB_POSIXCHECK
374
 
#  undef sendto
375
 
#  define sendto(s,b,n,f,a,l) \
376
 
     (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \
377
 
                       "use gnulib module sendto for portability"), \
378
 
      sendto (s, b, n, f, a, l))
379
 
# endif
 
509
_GL_FUNCDECL_RPL (sendto, ssize_t,
 
510
                  (int fd, const void *buf, size_t len, int flags,
 
511
                   const struct sockaddr *to, socklen_t tolen)
 
512
                  _GL_ARG_NONNULL ((2)));
 
513
_GL_CXXALIAS_RPL (sendto, ssize_t,
 
514
                  (int fd, const void *buf, size_t len, int flags,
 
515
                   const struct sockaddr *to, socklen_t tolen));
 
516
# else
 
517
_GL_CXXALIAS_SYS (sendto, ssize_t,
 
518
                  (int fd, const void *buf, size_t len, int flags,
 
519
                   const struct sockaddr *to, socklen_t tolen));
 
520
# endif
 
521
_GL_CXXALIASWARN (sendto);
 
522
#elif @HAVE_WINSOCK2_H@
 
523
# undef sendto
 
524
# define sendto sendto_used_without_requesting_gnulib_module_sendto
 
525
#elif defined GNULIB_POSIXCHECK
 
526
# undef sendto
 
527
# if HAVE_RAW_DECL_SENDTO
 
528
_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
 
529
                 "use gnulib module sendto for portability");
 
530
# endif
 
531
#endif
380
532
 
381
 
# if @GNULIB_SETSOCKOPT@
382
 
#  if @HAVE_WINSOCK2_H@
 
533
#if @GNULIB_SETSOCKOPT@
 
534
# if @HAVE_WINSOCK2_H@
 
535
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
383
536
#   undef setsockopt
384
 
#   define setsockopt           rpl_setsockopt
385
 
extern int rpl_setsockopt (int, int, int, const void *, socklen_t);
 
537
#   define setsockopt rpl_setsockopt
386
538
#  endif
387
 
# elif @HAVE_WINSOCK2_H@
388
 
#  undef setsockopt
389
 
#  define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
390
 
# elif defined GNULIB_POSIXCHECK
391
 
#  undef setsockopt
392
 
#  define setsockopt(s,lvl,o,v,l) \
393
 
     (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \
394
 
                       "use gnulib module setsockopt for portability"), \
395
 
      setsockopt (s, lvl, o, v, l))
396
 
# endif
 
539
_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
 
540
                                    const void * optval, socklen_t optlen)
 
541
                                   _GL_ARG_NONNULL ((4)));
 
542
_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
 
543
                                    const void * optval, socklen_t optlen));
 
544
# else
 
545
_GL_CXXALIAS_SYS (setsockopt, int, (int fd, int level, int optname,
 
546
                                    const void * optval, socklen_t optlen));
 
547
# endif
 
548
_GL_CXXALIASWARN (setsockopt);
 
549
#elif @HAVE_WINSOCK2_H@
 
550
# undef setsockopt
 
551
# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
 
552
#elif defined GNULIB_POSIXCHECK
 
553
# undef setsockopt
 
554
# if HAVE_RAW_DECL_SETSOCKOPT
 
555
_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
 
556
                 "use gnulib module setsockopt for portability");
 
557
# endif
 
558
#endif
397
559
 
398
 
# if @GNULIB_SHUTDOWN@
399
 
#  if @HAVE_WINSOCK2_H@
 
560
#if @GNULIB_SHUTDOWN@
 
561
# if @HAVE_WINSOCK2_H@
 
562
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
400
563
#   undef shutdown
401
 
#   define shutdown             rpl_shutdown
402
 
extern int rpl_shutdown (int, int);
 
564
#   define shutdown rpl_shutdown
403
565
#  endif
404
 
# elif @HAVE_WINSOCK2_H@
405
 
#  undef shutdown
406
 
#  define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
407
 
# elif defined GNULIB_POSIXCHECK
408
 
#  undef shutdown
409
 
#  define shutdown(s,h) \
410
 
     (GL_LINK_WARNING ("shutdown is not always POSIX compliant - " \
411
 
                       "use gnulib module shutdown for portability"), \
412
 
      shutdown (s, h))
413
 
# endif
 
566
_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how));
 
567
_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
 
568
# else
 
569
_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
 
570
# endif
 
571
_GL_CXXALIASWARN (shutdown);
 
572
#elif @HAVE_WINSOCK2_H@
 
573
# undef shutdown
 
574
# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
 
575
#elif defined GNULIB_POSIXCHECK
 
576
# undef shutdown
 
577
# if HAVE_RAW_DECL_SHUTDOWN
 
578
_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
 
579
                 "use gnulib module shutdown for portability");
 
580
# endif
 
581
#endif
414
582
 
415
 
# if @HAVE_WINSOCK2_H@
 
583
#if @HAVE_WINSOCK2_H@
 
584
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
416
585
#  undef select
417
 
#  define select                select_used_without_including_sys_select_h
418
 
# endif
419
 
 
420
 
# ifdef __cplusplus
421
 
}
422
 
# endif
423
 
 
424
 
#endif /* HAVE_SYS_SOCKET_H */
425
 
 
426
 
#endif /* _GL_SYS_SOCKET_H */
427
 
#endif /* _GL_SYS_SOCKET_H */
 
586
#  define select select_used_without_including_sys_select_h
 
587
# else
 
588
   _GL_WARN_ON_USE (select,
 
589
                    "select() used without including <sys/select.h>");
 
590
# endif
 
591
#endif
 
592
 
 
593
#if @GNULIB_ACCEPT4@
 
594
/* Accept a connection on a socket, with specific opening flags.
 
595
   The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
 
596
   and O_TEXT, O_BINARY (defined in "binary-io.h").
 
597
   See also the Linux man page at
 
598
   <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>.  */
 
599
# if @HAVE_ACCEPT4@
 
600
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
601
#   define accept4 rpl_accept4
 
602
#  endif
 
603
_GL_FUNCDECL_RPL (accept4, int,
 
604
                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
 
605
                   int flags));
 
606
_GL_CXXALIAS_RPL (accept4, int,
 
607
                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
 
608
                   int flags));
 
609
# else
 
610
_GL_FUNCDECL_SYS (accept4, int,
 
611
                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
 
612
                   int flags));
 
613
_GL_CXXALIAS_SYS (accept4, int,
 
614
                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
 
615
                   int flags));
 
616
# endif
 
617
_GL_CXXALIASWARN (accept4);
 
618
#elif defined GNULIB_POSIXCHECK
 
619
# undef accept4
 
620
# if HAVE_RAW_DECL_ACCEPT4
 
621
_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
 
622
                 "use gnulib module accept4 for portability");
 
623
# endif
 
624
#endif
 
625
 
 
626
#endif /* _GL_SYS_SOCKET_H */
 
627
#endif /* _GL_SYS_SOCKET_H */
 
628
#endif