On 01/21/2013 12:53 PM, Tom G. Christensen wrote: > It works for Solaris 7-10 but still fails in the same way on Solaris 2.6.
OK, thanks, how about this slightly-revised patch? diff --git a/ChangeLog b/ChangeLog index 8218eb3..32c371a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2013-01-20 Paul Eggert <egg...@cs.ucla.edu> + + sys_select: port to Solaris 2.6 + * lib/sys_select.in.h: Redo to resemble sys_time.in.h, which + delegates to the system's header when being invoked recursively, + and doesn't have split double-inclusion guards. This breaks + a circularity problem on Solaris 2.6, where <time.h> includes + <sys/time.h> for struct timespec. The include nesting is gnulib + <time.h>, system <time.h>, gnulib <sys/time.h>, system + <sys/time.h>, gnulib <sys/types.h>, system <sys/types.h>, gnulib + <sys/select.h>, gnulib <signal.h>, system <sys/signal.h>, system + <sys/siginfo.h>; the last, innermost file needs struct + timestruc_t, which is defined in <sys/time.h>, which has not been + fully parsed. Problem reported by Tom G. Christensen in + <http://lists.gnu.org/archive/html/bug-gnulib/2013-01/msg00113.html>. + * lib/sys_types.in.h: Temporarily define _GL_INCLUDING_SYS_TYPES_H, + for sys_select.in.h's benefit. + 2013-01-16 Paul Eggert <egg...@cs.ucla.edu> unistd: port to recent mingw diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index b48c1bb..49894cc 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -19,91 +19,44 @@ # endif @PRAGMA_COLUMNS@ -/* On OSF/1, <sys/types.h> and <sys/time.h> include <sys/select.h>. - Simply delegate to the system's header in this case. */ -#if @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TYPES_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H) && defined _OSF_SOURCE +#if defined _@GUARD_PREFIX@_SYS_SELECT_H || defined _GL_INCLUDING_SYS_TYPES_H -# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H -# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ - -#elif @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TIME_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H) && defined _OSF_SOURCE - -# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H -# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ - -/* On IRIX 6.5, <sys/timespec.h> includes <sys/types.h>, which includes - <sys/bsd_types.h>, which includes <sys/select.h>. At this point we cannot - include <signal.h>, because that includes <internal/signal_core.h>, which - gives a syntax error because <sys/timespec.h> has not been completely - processed. Simply delegate to the system's header in this case. */ -#elif @HAVE_SYS_SELECT_H@ && defined __sgi && (defined _SYS_BSD_TYPES_H && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H) - -# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H -# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ - -/* On OpenBSD 5.0, <pthread.h> includes <sys/types.h>, which includes - <sys/select.h>. At this point we cannot include <signal.h>, because that - includes gnulib's pthread.h override, which gives a syntax error because - /usr/include/pthread.h has not been completely processed. Simply delegate - to the system's header in this case. */ -#elif @HAVE_SYS_SELECT_H@ && defined __OpenBSD__ && (defined _PTHREAD_H_ && !defined PTHREAD_MUTEX_INITIALIZER) - -# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ +/* Simply delegate to the system's header, without adding anything. */ +# if @HAVE_SYS_SELECT_H@ +# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ +# endif #else -#ifndef _@GUARD_PREFIX@_SYS_SELECT_H +#define _@GUARD_PREFIX@_SYS_SELECT_H /* On many platforms, <sys/select.h> assumes prior inclusion of <sys/types.h>. Also, mingw defines sigset_t there, instead of in <signal.h> where it belongs. */ #include <sys/types.h> -#if @HAVE_SYS_SELECT_H@ +/* Get the 'struct timeval' and 'fd_set' types and the FD_* macros + on many platforms. But avoid namespace pollution on glibc systems. */ +#ifndef __GLIBC__ /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration of 'struct timeval', and no definition of this type. - Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select() - in <sys/time.h>. - But avoid namespace pollution on glibc systems. */ -# ifndef __GLIBC__ -# include <sys/time.h> -# endif - -/* On AIX 7 and Solaris 10, <sys/select.h> provides an FD_ZERO implementation - that relies on memset(), but without including <string.h>. - But in any case avoid namespace pollution on glibc systems. */ -# if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __osf__ || defined __BEOS__) \ - && ! defined __GLIBC__ -# include <string.h> -# endif - -/* The include_next requires a split double-inclusion guard. */ -# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ + Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select + in <sys/time.h>. */ +# include <sys/time.h> +/* On AIX 7 and Solaris 10, <sys/select.h>'s FD_ZERO + implementation relies on memset, but without including <string.h>. + HP-UX 11 has a similar problem with <sys/time.h>'s FD_ZERO. */ +# include <string.h> #endif -/* Get definition of 'sigset_t'. - But avoid namespace pollution on glibc systems. - Do this after the include_next (for the sake of OpenBSD 5.0) but before - the split double-inclusion guard (for the sake of Solaris). */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <signal.h> -#endif +#if @HAVE_SYS_SELECT_H@ -#ifndef _@GUARD_PREFIX@_SYS_SELECT_H -#define _@GUARD_PREFIX@_SYS_SELECT_H +# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ + +#else -#if !@HAVE_SYS_SELECT_H@ -/* A platform that lacks <sys/select.h>. */ -/* Get the 'struct timeval' and 'fd_set' types and the FD_* macros - on most platforms. */ -# include <sys/time.h> -/* On HP-UX 11, <sys/time.h> provides an FD_ZERO implementation - that relies on memset(), but without including <string.h>. */ -# if defined __hpux -# include <string.h> -# endif /* On native Windows platforms: Get the 'fd_set' type. Get the close() declaration before we override it. */ @@ -117,6 +70,13 @@ # endif #endif +/* Get definition of 'sigset_t'. + But avoid namespace pollution on glibc systems. + Do this after the include_next (for the sake of OpenBSD 5.0). */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include <signal.h> +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ @@ -294,5 +254,3 @@ _GL_WARN_ON_USE (select, "select is not always POSIX compliant - " #endif /* _@GUARD_PREFIX@_SYS_SELECT_H */ -#endif /* _@GUARD_PREFIX@_SYS_SELECT_H */ -#endif /* OSF/1 */ diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h index 34293d3..06749a7 100644 --- a/lib/sys_types.in.h +++ b/lib/sys_types.in.h @@ -23,7 +23,9 @@ #ifndef _@GUARD_PREFIX@_SYS_TYPES_H /* The include_next requires a split double-inclusion guard. */ +#define _GL_INCLUDING_SYS_TYPES_H #@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ +#undef _GL_INCLUDING_SYS_TYPES_H #ifndef _@GUARD_PREFIX@_SYS_TYPES_H #define _@GUARD_PREFIX@_SYS_TYPES_H