bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with sys_select on Cygwin


From: Ken Brown
Subject: Re: Problem with sys_select on Cygwin
Date: Sun, 20 Mar 2016 14:48:24 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0

On 3/20/2016 7:14 AM, Ken Brown wrote:
> On 3/19/2016 10:44 PM, Paul Eggert wrote:
>> Ken Brown wrote:
>>> Cygwin is changing its headers as of the next release so that 
>>> sys/types.h
>>> includes sys/select.h....
>>> Can sys_select be changed so that it doesn't try to include other
>>> headers before
>>> it has finished including sys/types.h?  Or is there some other way to
>>> solve this
>>> problem?
>>
>> Probably the latter. Why is Cygwin changing its headers? What is it
>> changing? This may help us to provide a special case in Gnulib to solve
>> the problem.  For example, we might be able to add Cygwin to the
>> existing mess of code near the start of lib/sys_select.in.h that does
>> something special for __osf__ and/or for __sun.
> 
> Eric can probably explain this better than I can, but I'll give it a 
> try.  Newlib, which provides Cygwin's libc, has just had a complete 
> overhaul of its feature test macros, with the goal of increasing 
> compatibility with Glibc and/or BSD.  The relevant change to sys/types.h 
> is simply
> 
> --- a/newlib/libc/include/sys/types.h
> +++ b/newlib/libc/include/sys/types.h
> @@ -87,5 +87,7 @@
>   # if    __BSD_VISIBLE
> 
> +#include <sys/select.h>
> +
>   #  define    physadr        physadr_t
>   #  define    quad        quad_t
> 
> I gather that __BSD_VISIBLE is similar to Glibc's __USE_MISC, which 
> Glibc uses to guard the inclusion of sys/select.h.

Treating Cygwin the same as Glibc with respect to inclusion of system headers 
seems to solve the problem:

diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index f7b260d..beb341a 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -81,8 +81,8 @@
    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__
+   But avoid namespace pollution on glibc systems and Cygwin.  */
+# if !(defined __GLIBC__ || defined __CYGWIN__)
 #  include <sys/time.h>
 # endif
 
@@ -100,10 +100,10 @@
 #endif
 
 /* Get definition of 'sigset_t'.
-   But avoid namespace pollution on glibc systems.
+   But avoid namespace pollution on glibc systems and Cygwin.
    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__)
+#if !((defined __GLIBC__ || defined __CYGWIN__) && !defined __UCLIBC__)
 # include <signal.h>
 #endif

Ken



reply via email to

[Prev in Thread] Current Thread [Next in Thread]