[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: interix 3.5 select bug
From: |
Jim Meyering |
Subject: |
Re: interix 3.5 select bug |
Date: |
Thu, 12 Mar 2009 13:29:02 +0100 |
Bruno Haible wrote:
> Simon Josefsson wrote:
>> > It seems that another solution would be to
>> > detect this problem, and to replace select if the system's select
>> > doesn't work.
>
> Good point. Using 0 as nfd argument is common; try searching for
> " = select (0, " on http://www.google.com/codesearch/.
>
>> I haven't studied the spec enough to say
>
> That's easy to do:
> <http://www.opengroup.org/onlinepubs/9699919799/functions/select.html>
> says:
> "The nfds argument specifies the range of descriptors to be tested.
> The first nfds descriptors shall be checked in each set; that is,
> the descriptors from zero through nfds-1 in the descriptor sets shall
> be examined."
> In other words, there is no requirement that nfds be > 0. nfds = 0 is valid.
>
>> However, technically the configure-time test would have
>> to be one that runs a binary, to determine if select fails
>> like that. and that's ugly...
>
> Sure it will be a test with AC_TRY_RUN. What is ugly about it? For
> cross-compiling we can use AC_CANONICAL_HOST and dispatch on that,
> as usual.
>
> Here is a series of two proposed patches to provide a workaround.
> Simon, is that OK to commit?
>
>
> 2009-03-12 Bruno Haible <address@hidden>
>
> * lib/select.c: Renamed from lib/winsock-select.c.
> * modules/select (Files): Add lib/select.c, remove
> lib/winsock-select.c.
> (configure.ac): Update.
Thanks for doing the work!
Only one question:
> --- lib/select.c.orig 2009-03-12 11:36:40.000000000 +0100
...
> +int
> +rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
> + struct timeval *timeout)
> +{
> + /* Interix 3.5 has a bug: it does not support nfds == 0. */
> + if (nfds == 0)
> + {
> + nfds = 1;
> + rfds = NULL;
> + wfds = NULL;
> + xfds = NULL;
> + }
Did you consider doing the above only when all three input pointers
are NULL? I have a slight preference not to map the suspicious
combination of nfds==0 and one or more non-NULL pointer arg.
to arguments that provoke no diagnostic on that system.
- Re: interix 3.5 select bug, Pádraig Brady, 2009/03/11
- Re: interix 3.5 select bug, Jim Meyering, 2009/03/11
- Re: interix 3.5 select bug, Simon Josefsson, 2009/03/11
- Re: interix 3.5 select bug, Jim Meyering, 2009/03/11
- Re: interix 3.5 select bug, Bruno Haible, 2009/03/12
- Re: interix 3.5 select bug,
Jim Meyering <=
- Re: interix 3.5 select bug, Bruno Haible, 2009/03/12
- Re: interix 3.5 select bug, Jim Meyering, 2009/03/13
- Re: interix 3.5 select bug, Bruno Haible, 2009/03/13
- RE: interix 3.5 select bug, Markus Duft, 2009/03/13
- Re: interix 3.5 select bug, Simon Josefsson, 2009/03/16
Re: interix 3.5 select bug, Paolo Bonzini, 2009/03/11
RE: interix 3.5 select bug, Markus Duft, 2009/03/12