1 /* Substitute for <sys/select.h>.
2 Copyright (C) 2007-2010 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 @PRAGMA_SYSTEM_HEADER@
22 /* On OSF/1, <sys/types.h> and <sys/time.h> include <sys/select.h>.
23 Simply delegate to the system's header in this case. */
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
26 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
27 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
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
31 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
32 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
36 #ifndef _GL_SYS_SELECT_H
38 #if @HAVE_SYS_SELECT_H@
40 /* On many platforms, <sys/select.h> assumes prior inclusion of
42 # include <sys/types.h>
44 /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
45 of 'struct timeval', and no definition of this type.
46 But avoid namespace pollution on glibc systems. */
48 # include <sys/time.h>
51 /* On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
52 that relies on memset(), but without including <string.h>.
53 But avoid namespace pollution on glibc systems. */
58 /* The include_next requires a split double-inclusion guard. */
59 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
63 #ifndef _GL_SYS_SELECT_H
64 #define _GL_SYS_SELECT_H
66 #if !@HAVE_SYS_SELECT_H@ || @REPLACE_SELECT@
67 /* A platform that lacks <sys/select.h>. */
68 # include <sys/socket.h>
71 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
73 /* The definition of _GL_WARN_ON_USE is copied here. */
77 # if @HAVE_WINSOCK2_H@ || @REPLACE_SELECT@
78 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
80 # define select rpl_select
82 _GL_FUNCDECL_RPL (select, int,
83 (int, fd_set *, fd_set *, fd_set *, struct timeval *));
84 _GL_CXXALIAS_RPL (select, int,
85 (int, fd_set *, fd_set *, fd_set *, struct timeval *));
87 _GL_CXXALIAS_SYS (select, int,
88 (int, fd_set *, fd_set *, fd_set *, struct timeval *));
90 _GL_CXXALIASWARN (select);
91 #elif @HAVE_WINSOCK2_H@
93 # define select select_used_without_requesting_gnulib_module_select
94 #elif defined GNULIB_POSIXCHECK
96 # if HAVE_RAW_DECL_SELECT
97 _GL_WARN_ON_USE (select, "select is not always POSIX compliant - "
98 "use gnulib module select for portability");
103 #endif /* _GL_SYS_SELECT_H */
104 #endif /* _GL_SYS_SELECT_H */