delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/08/08/20:05:47

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
From: Chris Faylor <cgf AT cygnus DOT com>
Date: Tue, 8 Aug 2000 20:04:10 -0400
To: "'cygwin AT sourceware DOT cygnus DOT com'" <cygwin AT sourceware DOT cygnus DOT com>
Subject: Re: 1.1.4 select and poll false positive past 32 descriptors
Message-ID: <20000808200410.A23725@cygnus.com>
Reply-To: cygwin AT sources DOT redhat DOT com
Mail-Followup-To: "'cygwin AT sourceware DOT cygnus DOT com'" <cygwin AT sourceware DOT cygnus DOT com>
References: <410A7080D2D2D11185F800A0C9663B823E894B AT pulse-bdc DOT pulse DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.3.6i
In-Reply-To: <410A7080D2D2D11185F800A0C9663B823E894B@pulse-bdc.pulse.com>; from Ted.Soo-Hoo@go.ecitele.com on Tue, Aug 08, 2000 at 07:54:23PM -0400

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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019