Mercurial > gnulib
annotate lib/sys_select.in.h @ 11398:2de4c4d41f01
Work around select() bug on Interix 3.5.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Thu, 12 Mar 2009 11:46:05 +0100 |
parents | 3c51cf16c4fa |
children | 1bc3a28e8169 |
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>. |
11398
2de4c4d41f01
Work around select() bug on Interix 3.5.
Bruno Haible <bruno@clisp.org>
parents:
10882
diff
changeset
|
2 Copyright (C) 2007-2009 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 |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 along with this program; if not, write to the Free Software Foundation, |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 |
10882
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
18 # if __GNUC__ >= 3 |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
19 @PRAGMA_SYSTEM_HEADER@ |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
20 # endif |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
21 |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
22 /* On OSF/1, <sys/types.h> and <sys/time.h> include <sys/select.h>. |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
23 Simply delegate to the system's header in this case. */ |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
24 #if @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TYPES_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H) && defined _OSF_SOURCE |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
25 |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
26 # 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
|
27 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
28 |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
29 #elif @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TIME_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H) && defined _OSF_SOURCE |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
30 |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
31 # 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
|
32 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ |
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 #else |
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
35 |
9265
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 #ifndef _GL_SYS_SELECT_H |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 #if @HAVE_SYS_SELECT_H@ |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 /* On many platforms, <sys/select.h> assumes prior inclusion of |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 <sys/types.h>. */ |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 # include <sys/types.h> |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 |
10541
142140ec3db8
strengthen self-containedness check for sys/select.h
Paolo Bonzini <bonzini@gnu.org>
parents:
10539
diff
changeset
|
44 /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration |
142140ec3db8
strengthen self-containedness check for sys/select.h
Paolo Bonzini <bonzini@gnu.org>
parents:
10539
diff
changeset
|
45 of 'struct timeval', and no definition of this type.. */ |
142140ec3db8
strengthen self-containedness check for sys/select.h
Paolo Bonzini <bonzini@gnu.org>
parents:
10539
diff
changeset
|
46 # include <sys/time.h> |
142140ec3db8
strengthen self-containedness check for sys/select.h
Paolo Bonzini <bonzini@gnu.org>
parents:
10539
diff
changeset
|
47 |
9265
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 /* 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
|
49 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 #endif |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 #ifndef _GL_SYS_SELECT_H |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 #define _GL_SYS_SELECT_H |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 #if !@HAVE_SYS_SELECT_H@ |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 /* A platform that lacks <sys/select.h>. */ |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 # include <sys/socket.h> |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 |
10591
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
62 /* The definition of GL_LINK_WARNING is copied here. */ |
10539
affb655993ea
Make the headers usable in C++.
Bruno Haible <bruno@clisp.org>
parents:
10474
diff
changeset
|
63 |
10591
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
64 # ifdef __cplusplus |
10539
affb655993ea
Make the headers usable in C++.
Bruno Haible <bruno@clisp.org>
parents:
10474
diff
changeset
|
65 extern "C" { |
10591
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
66 # endif |
10539
affb655993ea
Make the headers usable in C++.
Bruno Haible <bruno@clisp.org>
parents:
10474
diff
changeset
|
67 |
10591
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
68 # if @GNULIB_SELECT@ |
11398
2de4c4d41f01
Work around select() bug on Interix 3.5.
Bruno Haible <bruno@clisp.org>
parents:
10882
diff
changeset
|
69 # if @HAVE_WINSOCK2_H@ || @REPLACE_SELECT@ |
10586 | 70 # undef select |
71 # define select rpl_select | |
10539
affb655993ea
Make the headers usable in C++.
Bruno Haible <bruno@clisp.org>
parents:
10474
diff
changeset
|
72 extern int rpl_select (int, fd_set *, fd_set *, fd_set *, struct timeval *); |
10586 | 73 # endif |
10591
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
74 # elif @HAVE_WINSOCK2_H@ |
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
75 # undef select |
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
76 # define select select_used_without_requesting_gnulib_module_select |
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
77 # elif defined GNULIB_POSIXCHECK |
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
78 # undef select |
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
79 # define select(n,r,w,e,t) \ |
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
80 (GL_LINK_WARNING ("select is not always POSIX compliant - " \ |
10592 | 81 "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
|
82 select (n, r, w, e, t)) |
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
83 # endif |
10474
5fc74f43b3d6
implement full-blown select(2) for winsock
Paolo Bonzini <bonzini@gnu.org>
parents:
10375
diff
changeset
|
84 |
10591
9a7657d2031f
Add a link warning when the 'select' module is not used.
Bruno Haible <bruno@clisp.org>
parents:
10586
diff
changeset
|
85 # ifdef __cplusplus |
10539
affb655993ea
Make the headers usable in C++.
Bruno Haible <bruno@clisp.org>
parents:
10474
diff
changeset
|
86 } |
10474
5fc74f43b3d6
implement full-blown select(2) for winsock
Paolo Bonzini <bonzini@gnu.org>
parents:
10375
diff
changeset
|
87 # endif |
5fc74f43b3d6
implement full-blown select(2) for winsock
Paolo Bonzini <bonzini@gnu.org>
parents:
10375
diff
changeset
|
88 |
9265
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
89 #endif |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
90 |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
91 #endif /* _GL_SYS_SELECT_H */ |
6c8579ddc19d
Rename sys_select_.h to sys_select.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
92 #endif /* _GL_SYS_SELECT_H */ |
10882
3c51cf16c4fa
Fix compilation error on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
10655
diff
changeset
|
93 #endif /* OSF/1 */ |