annotate lib/sys_select.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 0e38241a3d05
children 344018b6e5d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Substitute for <sys/select.h>.
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 17050
diff changeset
2 Copyright (C) 2007-2013 Free Software Foundation, Inc.
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 2, or (at your option)
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 any later version.
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 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: 16348
diff changeset
15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
10882
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
17 # if __GNUC__ >= 3
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
18 @PRAGMA_SYSTEM_HEADER@
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
19 # endif
13761
a19ace3ba849 Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents: 12944
diff changeset
20 @PRAGMA_COLUMNS@
10882
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
21
17303
0e38241a3d05 sys_time: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
22 /* On OSF/1 and Solaris 2.6, <sys/types.h> and <sys/time.h>
0e38241a3d05 sys_time: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
23 both include <sys/select.h>.
17363
5a51fb7777a9 sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Paul Eggert <eggert@cs.ucla.edu>
parents: 17303
diff changeset
24 On Cygwin, <sys/time.h> includes <sys/select.h>.
10882
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
25 Simply delegate to the system's header in this case. */
17303
0e38241a3d05 sys_time: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
26 #if (@HAVE_SYS_SELECT_H@ \
17363
5a51fb7777a9 sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Paul Eggert <eggert@cs.ucla.edu>
parents: 17303
diff changeset
27 && ((defined __osf__ && defined _SYS_TYPES_H_ \
5a51fb7777a9 sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Paul Eggert <eggert@cs.ucla.edu>
parents: 17303
diff changeset
28 && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
5a51fb7777a9 sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Paul Eggert <eggert@cs.ucla.edu>
parents: 17303
diff changeset
29 && defined _OSF_SOURCE) \
17303
0e38241a3d05 sys_time: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
30 || (defined __sun && defined _SYS_TYPES_H \
0e38241a3d05 sys_time: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
31 && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
17363
5a51fb7777a9 sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Paul Eggert <eggert@cs.ucla.edu>
parents: 17303
diff changeset
32 || defined __EXTENSIONS__))))
10882
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
33
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
34 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
35 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
36
17303
0e38241a3d05 sys_time: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
37 #elif (@HAVE_SYS_SELECT_H@ \
17363
5a51fb7777a9 sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Paul Eggert <eggert@cs.ucla.edu>
parents: 17303
diff changeset
38 && (defined _CYGWIN_SYS_TIME_H \
5a51fb7777a9 sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Paul Eggert <eggert@cs.ucla.edu>
parents: 17303
diff changeset
39 || (defined __osf__ && defined _SYS_TIME_H_ \
5a51fb7777a9 sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Paul Eggert <eggert@cs.ucla.edu>
parents: 17303
diff changeset
40 && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
5a51fb7777a9 sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Paul Eggert <eggert@cs.ucla.edu>
parents: 17303
diff changeset
41 && defined _OSF_SOURCE) \
17303
0e38241a3d05 sys_time: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
42 || (defined __sun && defined _SYS_TIME_H \
0e38241a3d05 sys_time: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
43 && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
17363
5a51fb7777a9 sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
Paul Eggert <eggert@cs.ucla.edu>
parents: 17303
diff changeset
44 || defined __EXTENSIONS__))))
10882
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
45
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
46 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
47 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
48
15546
265302827911 sys_select: Avoid a syntax error regarding timespec_t on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 15355
diff changeset
49 /* On IRIX 6.5, <sys/timespec.h> includes <sys/types.h>, which includes
265302827911 sys_select: Avoid a syntax error regarding timespec_t on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 15355
diff changeset
50 <sys/bsd_types.h>, which includes <sys/select.h>. At this point we cannot
265302827911 sys_select: Avoid a syntax error regarding timespec_t on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 15355
diff changeset
51 include <signal.h>, because that includes <internal/signal_core.h>, which
265302827911 sys_select: Avoid a syntax error regarding timespec_t on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 15355
diff changeset
52 gives a syntax error because <sys/timespec.h> has not been completely
265302827911 sys_select: Avoid a syntax error regarding timespec_t on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 15355
diff changeset
53 processed. Simply delegate to the system's header in this case. */
265302827911 sys_select: Avoid a syntax error regarding timespec_t on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 15355
diff changeset
54 #elif @HAVE_SYS_SELECT_H@ && defined __sgi && (defined _SYS_BSD_TYPES_H && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H)
265302827911 sys_select: Avoid a syntax error regarding timespec_t on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 15355
diff changeset
55
265302827911 sys_select: Avoid a syntax error regarding timespec_t on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 15355
diff changeset
56 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H
265302827911 sys_select: Avoid a syntax error regarding timespec_t on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 15355
diff changeset
57 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
265302827911 sys_select: Avoid a syntax error regarding timespec_t on IRIX 6.5.
Bruno Haible <bruno@clisp.org>
parents: 15355
diff changeset
58
16348
b854ad995083 * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is
Bruno Haible <bruno@clisp.org>
parents: 16347
diff changeset
59 /* On OpenBSD 5.0, <pthread.h> includes <sys/types.h>, which includes
b854ad995083 * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is
Bruno Haible <bruno@clisp.org>
parents: 16347
diff changeset
60 <sys/select.h>. At this point we cannot include <signal.h>, because that
b854ad995083 * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is
Bruno Haible <bruno@clisp.org>
parents: 16347
diff changeset
61 includes gnulib's pthread.h override, which gives a syntax error because
b854ad995083 * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is
Bruno Haible <bruno@clisp.org>
parents: 16347
diff changeset
62 /usr/include/pthread.h has not been completely processed. Simply delegate
b854ad995083 * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is
Bruno Haible <bruno@clisp.org>
parents: 16347
diff changeset
63 to the system's header in this case. */
b854ad995083 * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is
Bruno Haible <bruno@clisp.org>
parents: 16347
diff changeset
64 #elif @HAVE_SYS_SELECT_H@ && defined __OpenBSD__ && (defined _PTHREAD_H_ && !defined PTHREAD_MUTEX_INITIALIZER)
b854ad995083 * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is
Bruno Haible <bruno@clisp.org>
parents: 16347
diff changeset
65
b854ad995083 * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is
Bruno Haible <bruno@clisp.org>
parents: 16347
diff changeset
66 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
b854ad995083 * lib/sys_select.in.h [OpenBSD]: When /usr/include/pthread.h is
Bruno Haible <bruno@clisp.org>
parents: 16347
diff changeset
67
10882
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
68 #else
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
69
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14789
diff changeset
70 #ifndef _@GUARD_PREFIX@_SYS_SELECT_H
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71
15350
f61aaaf49e43 sys_select: define sigset_t more portably
Paul Eggert <eggert@cs.ucla.edu>
parents: 15329
diff changeset
72 /* On many platforms, <sys/select.h> assumes prior inclusion of
f61aaaf49e43 sys_select: define sigset_t more portably
Paul Eggert <eggert@cs.ucla.edu>
parents: 15329
diff changeset
73 <sys/types.h>. Also, mingw defines sigset_t there, instead of
f61aaaf49e43 sys_select: define sigset_t more portably
Paul Eggert <eggert@cs.ucla.edu>
parents: 15329
diff changeset
74 in <signal.h> where it belongs. */
f61aaaf49e43 sys_select: define sigset_t more portably
Paul Eggert <eggert@cs.ucla.edu>
parents: 15329
diff changeset
75 #include <sys/types.h>
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76
15350
f61aaaf49e43 sys_select: define sigset_t more portably
Paul Eggert <eggert@cs.ucla.edu>
parents: 15329
diff changeset
77 #if @HAVE_SYS_SELECT_H@
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78
10541
142140ec3db8 strengthen self-containedness check for sys/select.h
Paolo Bonzini <bonzini@gnu.org>
parents: 10539
diff changeset
79 /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
12497
e2d59f164e76 Avoid future namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 11797
diff changeset
80 of 'struct timeval', and no definition of this type.
16935
498a2211d839 Write "Mac OS X" instead of "MacOS X".
Bruno Haible <bruno@clisp.org>
parents: 16366
diff changeset
81 Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select()
14011
68009ff4e161 sys_select: Ensure all necessary types on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 14010
diff changeset
82 in <sys/time.h>.
12497
e2d59f164e76 Avoid future namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 11797
diff changeset
83 But avoid namespace pollution on glibc systems. */
e2d59f164e76 Avoid future namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 11797
diff changeset
84 # ifndef __GLIBC__
e2d59f164e76 Avoid future namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 11797
diff changeset
85 # include <sys/time.h>
e2d59f164e76 Avoid future namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 11797
diff changeset
86 # endif
10541
142140ec3db8 strengthen self-containedness check for sys/select.h
Paolo Bonzini <bonzini@gnu.org>
parents: 10539
diff changeset
87
14865
a2e884bebbb5 sys_select: Ensure memset is declared also on AIX 7.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
88 /* On AIX 7 and Solaris 10, <sys/select.h> provides an FD_ZERO implementation
12497
e2d59f164e76 Avoid future namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 11797
diff changeset
89 that relies on memset(), but without including <string.h>.
13773
d06d8f66d2bd string, sys_select: Avoid #including large headers unless necessary.
Bruno Haible <bruno@clisp.org>
parents: 13761
diff changeset
90 But in any case avoid namespace pollution on glibc systems. */
14865
a2e884bebbb5 sys_select: Ensure memset is declared also on AIX 7.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
91 # if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __osf__ || defined __BEOS__) \
13773
d06d8f66d2bd string, sys_select: Avoid #including large headers unless necessary.
Bruno Haible <bruno@clisp.org>
parents: 13761
diff changeset
92 && ! defined __GLIBC__
12497
e2d59f164e76 Avoid future namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 11797
diff changeset
93 # include <string.h>
e2d59f164e76 Avoid future namespace pollution on glibc systems.
Bruno Haible <bruno@clisp.org>
parents: 11797
diff changeset
94 # endif
11797
1bc3a28e8169 Make <sys/select.h> really self-contained, also on Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 11398
diff changeset
95
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 /* The include_next requires a split double-inclusion guard. */
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 #endif
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100
16347
a813bd88fc8d sys_select: Avoid syntax error on OpenBSD 5.0.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
101 /* Get definition of 'sigset_t'.
a813bd88fc8d sys_select: Avoid syntax error on OpenBSD 5.0.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
102 But avoid namespace pollution on glibc systems.
a813bd88fc8d sys_select: Avoid syntax error on OpenBSD 5.0.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
103 Do this after the include_next (for the sake of OpenBSD 5.0) but before
a813bd88fc8d sys_select: Avoid syntax error on OpenBSD 5.0.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
104 the split double-inclusion guard (for the sake of Solaris). */
a813bd88fc8d sys_select: Avoid syntax error on OpenBSD 5.0.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
105 #if !(defined __GLIBC__ && !defined __UCLIBC__)
a813bd88fc8d sys_select: Avoid syntax error on OpenBSD 5.0.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
106 # include <signal.h>
a813bd88fc8d sys_select: Avoid syntax error on OpenBSD 5.0.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
107 #endif
a813bd88fc8d sys_select: Avoid syntax error on OpenBSD 5.0.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
108
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14789
diff changeset
109 #ifndef _@GUARD_PREFIX@_SYS_SELECT_H
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14789
diff changeset
110 #define _@GUARD_PREFIX@_SYS_SELECT_H
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111
14010
fd62a5de1a49 sys_select: Remove unneeded include.
Bruno Haible <bruno@clisp.org>
parents: 13783
diff changeset
112 #if !@HAVE_SYS_SELECT_H@
12944
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
113 /* A platform that lacks <sys/select.h>. */
14011
68009ff4e161 sys_select: Ensure all necessary types on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 14010
diff changeset
114 /* Get the 'struct timeval' and 'fd_set' types and the FD_* macros
68009ff4e161 sys_select: Ensure all necessary types on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 14010
diff changeset
115 on most platforms. */
68009ff4e161 sys_select: Ensure all necessary types on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 14010
diff changeset
116 # include <sys/time.h>
14062
a9b8cdb01be3 sys_select: Avoid warning about missing memset declaration on HP-UX 11.
Bruno Haible <bruno@clisp.org>
parents: 14011
diff changeset
117 /* On HP-UX 11, <sys/time.h> provides an FD_ZERO implementation
a9b8cdb01be3 sys_select: Avoid warning about missing memset declaration on HP-UX 11.
Bruno Haible <bruno@clisp.org>
parents: 14011
diff changeset
118 that relies on memset(), but without including <string.h>. */
a9b8cdb01be3 sys_select: Avoid warning about missing memset declaration on HP-UX 11.
Bruno Haible <bruno@clisp.org>
parents: 14011
diff changeset
119 # if defined __hpux
a9b8cdb01be3 sys_select: Avoid warning about missing memset declaration on HP-UX 11.
Bruno Haible <bruno@clisp.org>
parents: 14011
diff changeset
120 # include <string.h>
a9b8cdb01be3 sys_select: Avoid warning about missing memset declaration on HP-UX 11.
Bruno Haible <bruno@clisp.org>
parents: 14011
diff changeset
121 # endif
14010
fd62a5de1a49 sys_select: Remove unneeded include.
Bruno Haible <bruno@clisp.org>
parents: 13783
diff changeset
122 /* On native Windows platforms:
15822
c1b5752b5e8d sys_select: Fix compilation error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 15546
diff changeset
123 Get the 'fd_set' type.
c1b5752b5e8d sys_select: Fix compilation error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 15546
diff changeset
124 Get the close() declaration before we override it. */
c1b5752b5e8d sys_select: Fix compilation error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 15546
diff changeset
125 # if @HAVE_WINSOCK2_H@
c1b5752b5e8d sys_select: Fix compilation error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 15546
diff changeset
126 # if !defined _GL_INCLUDING_WINSOCK2_H
c1b5752b5e8d sys_select: Fix compilation error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 15546
diff changeset
127 # define _GL_INCLUDING_WINSOCK2_H
c1b5752b5e8d sys_select: Fix compilation error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 15546
diff changeset
128 # include <winsock2.h>
c1b5752b5e8d sys_select: Fix compilation error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 15546
diff changeset
129 # undef _GL_INCLUDING_WINSOCK2_H
c1b5752b5e8d sys_select: Fix compilation error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 15546
diff changeset
130 # endif
c1b5752b5e8d sys_select: Fix compilation error on mingw.
Bruno Haible <bruno@clisp.org>
parents: 15546
diff changeset
131 # include <io.h>
15328
c7ae1577bd26 sys_select: don't depend on sys_socket
Paul Eggert <eggert@cs.ucla.edu>
parents: 14865
diff changeset
132 # endif
12944
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
133 #endif
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134
12944
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
135 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
137 /* The definition of _GL_WARN_ON_USE is copied here. */
10539
affb655993ea Make the headers usable in C++.
Bruno Haible <bruno@clisp.org>
parents: 10474
diff changeset
138
affb655993ea Make the headers usable in C++.
Bruno Haible <bruno@clisp.org>
parents: 10474
diff changeset
139
15355
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
140 /* 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: 15350
diff changeset
141
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
142 #if @HAVE_WINSOCK2_H@
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
143
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
144 # if !GNULIB_defined_rpl_fd_isset
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
145
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
146 /* Re-define FD_ISSET to avoid a WSA call while we are not using
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
147 network sockets. */
17050
5a5080681d6c sys_select: avoid 'static inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16935
diff changeset
148 static int
15355
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
149 rpl_fd_isset (SOCKET fd, fd_set * set)
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
150 {
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
151 u_int i;
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
152 if (set == NULL)
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
153 return 0;
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
154
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
155 for (i = 0; i < set->fd_count; i++)
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
156 if (set->fd_array[i] == fd)
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
157 return 1;
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
158
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
159 return 0;
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
160 }
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
161
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
162 # define GNULIB_defined_rpl_fd_isset 1
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
163 # endif
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
164
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
165 # undef FD_ISSET
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
166 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
167
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
168 #endif
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
169
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
170 /* Hide some function declarations from <winsock2.h>. */
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
171
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
172 #if @HAVE_WINSOCK2_H@
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
173 # 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: 15350
diff changeset
174 # 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: 15350
diff changeset
175 # undef close
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
176 # 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: 15350
diff changeset
177 # else
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
178 _GL_WARN_ON_USE (close,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
179 "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: 15350
diff changeset
180 # endif
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
181 # 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: 15350
diff changeset
182 # undef gethostname
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
183 # 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: 15350
diff changeset
184 # else
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
185 _GL_WARN_ON_USE (gethostname,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
186 "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: 15350
diff changeset
187 # endif
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
188 # endif
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
189 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
190 # 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: 15350
diff changeset
191 # undef socket
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
192 # define socket socket_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
193 # undef connect
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
194 # define connect connect_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
195 # undef accept
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
196 # define accept accept_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
197 # undef bind
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
198 # define bind bind_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
199 # undef getpeername
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
200 # define getpeername getpeername_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
201 # undef getsockname
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
202 # define getsockname getsockname_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
203 # undef getsockopt
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
204 # define getsockopt getsockopt_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
205 # undef listen
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
206 # define listen listen_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
207 # undef recv
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
208 # define recv recv_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
209 # undef send
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
210 # define send send_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
211 # undef recvfrom
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
212 # define recvfrom recvfrom_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
213 # undef sendto
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
214 # define sendto sendto_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
215 # undef setsockopt
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
216 # define setsockopt setsockopt_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
217 # undef shutdown
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
218 # define shutdown shutdown_used_without_including_sys_socket_h
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
219 # else
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
220 _GL_WARN_ON_USE (socket,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
221 "socket() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
222 _GL_WARN_ON_USE (connect,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
223 "connect() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
224 _GL_WARN_ON_USE (accept,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
225 "accept() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
226 _GL_WARN_ON_USE (bind,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
227 "bind() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
228 _GL_WARN_ON_USE (getpeername,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
229 "getpeername() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
230 _GL_WARN_ON_USE (getsockname,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
231 "getsockname() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
232 _GL_WARN_ON_USE (getsockopt,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
233 "getsockopt() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
234 _GL_WARN_ON_USE (listen,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
235 "listen() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
236 _GL_WARN_ON_USE (recv,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
237 "recv() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
238 _GL_WARN_ON_USE (send,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
239 "send() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
240 _GL_WARN_ON_USE (recvfrom,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
241 "recvfrom() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
242 _GL_WARN_ON_USE (sendto,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
243 "sendto() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
244 _GL_WARN_ON_USE (setsockopt,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
245 "setsockopt() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
246 _GL_WARN_ON_USE (shutdown,
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
247 "shutdown() used without including <sys/socket.h>");
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
248 # endif
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
249 # endif
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
250 #endif
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
251
c403e287a49e sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
Bruno Haible <bruno@clisp.org>
parents: 15350
diff changeset
252
15329
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
253 #if @GNULIB_PSELECT@
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
254 # if @REPLACE_PSELECT@
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
255 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
256 # undef pselect
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
257 # define pselect rpl_pselect
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
258 # endif
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
259 _GL_FUNCDECL_RPL (pselect, int,
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
260 (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
261 struct timespec const *restrict, const sigset_t *restrict));
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
262 _GL_CXXALIAS_RPL (pselect, int,
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
263 (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
264 struct timespec const *restrict, const sigset_t *restrict));
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
265 # else
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
266 # if !@HAVE_PSELECT@
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
267 _GL_FUNCDECL_SYS (pselect, int,
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
268 (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
269 struct timespec const *restrict, const sigset_t *restrict));
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
270 # endif
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
271 _GL_CXXALIAS_SYS (pselect, int,
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
272 (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
273 struct timespec const *restrict, const sigset_t *restrict));
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
274 # endif
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
275 _GL_CXXALIASWARN (pselect);
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
276 #elif defined GNULIB_POSIXCHECK
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
277 # undef pselect
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
278 # if HAVE_RAW_DECL_PSELECT
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
279 _GL_WARN_ON_USE (pselect, "pselect is not portable - "
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
280 "use gnulib module pselect for portability");
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
281 # endif
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
282 #endif
e121c7cef4a9 pselect: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 15328
diff changeset
283
12944
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
284 #if @GNULIB_SELECT@
14789
0e87a6225f1a select: Simplify replacement idiom.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
285 # if @REPLACE_SELECT@
12944
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
286 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
10586
ca7f9b88efc1 New module 'select'.
Bruno Haible <bruno@clisp.org>
parents: 10541
diff changeset
287 # undef select
ca7f9b88efc1 New module 'select'.
Bruno Haible <bruno@clisp.org>
parents: 10541
diff changeset
288 # define select rpl_select
ca7f9b88efc1 New module 'select'.
Bruno Haible <bruno@clisp.org>
parents: 10541
diff changeset
289 # endif
12944
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
290 _GL_FUNCDECL_RPL (select, int,
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
291 (int, fd_set *, fd_set *, fd_set *, struct timeval *));
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
292 _GL_CXXALIAS_RPL (select, int,
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
293 (int, fd_set *, fd_set *, fd_set *, struct timeval *));
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
294 # else
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
295 _GL_CXXALIAS_SYS (select, int,
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
296 (int, fd_set *, fd_set *, fd_set *, struct timeval *));
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
297 # endif
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
298 _GL_CXXALIASWARN (select);
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
299 #elif @HAVE_WINSOCK2_H@
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
300 # undef select
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
301 # define select select_used_without_requesting_gnulib_module_select
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
302 #elif defined GNULIB_POSIXCHECK
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
303 # undef select
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
304 # if HAVE_RAW_DECL_SELECT
12766
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
305 _GL_WARN_ON_USE (select, "select is not always POSIX compliant - "
2c14f1e449e5 warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
306 "use gnulib module select for portability");
10591
9a7657d2031f Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents: 10586
diff changeset
307 # endif
12944
e105c6e52c5d sys_select: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12875
diff changeset
308 #endif
10474
5fc74f43b3d6 implement full-blown select(2) for winsock
Paolo Bonzini <bonzini@gnu.org>
parents: 10375
diff changeset
309
9265
6c8579ddc19d Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
310
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14789
diff changeset
311 #endif /* _@GUARD_PREFIX@_SYS_SELECT_H */
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14789
diff changeset
312 #endif /* _@GUARD_PREFIX@_SYS_SELECT_H */
10882
3c51cf16c4fa Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents: 10655
diff changeset
313 #endif /* OSF/1 */