This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 1.1.4 select and poll false positive past 32 descriptors


On Tue, Aug 08, 2000 at 07:54:23PM -0400, Ted Soo-Hoo wrote:
>Chris Faylor wrote:
>
>> From the linux man page on select:
>>        n is the highest-numbered descriptor in any of  the  three
>>        sets, plus 1.
>
>I understand everything you're telling me. Please let me explain
>some more (citing source) and perhaps this will clarify my point.
>It's possible I'm way off, but we're miscommunicating right now.
>
>> What is allocated in select.cc reflects the maxiumum number of fds
>> that can be operated on.  It's essentially a bit mask.  I don't know
>> why you are mentioning this.  If your maximum fd is something like
>> 64, then the fd_set's allocated should be at least that large.
>
>I think that was its intent. I suspect that is not what it's doing.
>The strace output for recv_fd_max = 42 (so select was given 43) is:
>
>18931 1299283 [main] selectbug 1327 select_stuff::wait: n 2, ms 4294967295
>
>I agree that the select.cc allocation should hold the specified fds,
>but I think it's allocating based on that "n 2". I'll explain later.

The 'n == 2' has to do with the number of things that the
WaitForMultipleObjects is waiting for.  In the case that you cited, that
is probably "two threads".  This is completely unrelated to the argument
to the select call.

>I'm not setting FD_SETSIZE because the default of 64 is enough here.
>You can see from the printing based on sizeof that it's eight bytes.
>
>> I don't know what "the expected value to copy out" might be or what
>> you mean by "not work too hard beyond that".
>
>Copy out refers to the copy_fdset at "out:" below to return the fd_set.
>The "expected value to copy out" is the number of bits, 43 in the test.
>
>Working too hard refers to the complex count loop in the sources below.
>Just looking superficially, it looks like it's counting something with
>wait objects and "active fds" in mind. It then allocates based on that.
>My guess is that in terms of filling out the w4 array, it's doing fine,
>but it then uses the same value later to allocate and return an fd_set.

Yep.  You're right.  You've identified a bug.

Thanks for the extra details.  I'll fix this.

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]