delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/07/06/10:17:09

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B0D73858435
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1657117028;
bh=6CeX7PHN8PSaFqfx5LnrU68KC8NqFyInYw2LPv24OKY=;
h=Date:From:To:Subject:References:In-Reply-To:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
Reply-To:From;
b=wTHUhNT5w6fnHCinUhrJ1y6/4cBbBDVg7yFkUZJ4aXAQ326FfQ8U/XINSnKVozWZG
TEOHiFhYA9TKrc9ksUvGnt+9A+Ij/GbQPjjBwQw+vzzq1XLekP+QqictRbIuWNXJ+d
KW0mMqFGmuenSabVcRHN3qirCXr4F7l2SrjtAWlA=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5EF713858D39
Authentication-Results: sourceware.org;
dmarc=fail (p=none dis=none) header.from=cygwin.com
Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=cygwin.com
Date: Wed, 6 Jul 2022 16:15:58 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Typo in <sys/select.h>?
Message-ID: <YsWZHryhvF3+WcEv@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <DM8PR09MB70954B30D740E778EB65BA41A5819 AT DM8PR09MB7095 DOT namprd09 DOT prod DOT outlook DOT com>
<1c3256fd-ed7b-8ee3-adcd-b1d8ef2fff84 AT cornell DOT edu>
<YsU9APd87h5vUJtZ AT calimero DOT vinschen DOT de>
<ea3de3f0-ed55-bfcf-f543-a95e38b98599 AT dronecode DOT org DOT uk>
MIME-Version: 1.0
In-Reply-To: <ea3de3f0-ed55-bfcf-f543-a95e38b98599@dronecode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UiLfXWf7aMgYwcbzlwe3IO6l6IkVAs=
X-Spam-Status: No, score=-95.0 required=5.0 tests=BAYES_00,
GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE,
RCVD_IN_MSPIKE_H2, SPF_FAIL, SPF_HELO_NONE, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Jul  6 15:01, Jon Turney wrote:
> On 06/07/2022 08:42, Corinna Vinschen wrote:
> > On Jul  5 17:51, Ken Brown wrote:
> > > On 7/5/2022 10:13 AM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote:
> > 
> > I guess we can change FD_SETSIZE to 1024 as on Linux, albeit this has no
> > real meaning on Cygwin.  On Linux, select(2) is really only capable to
> > handle file descriptors numbers up to descriptor number 1023, but Cygwin
> > doesn't have this problem.  FD_SETSIZE == 64 was only something to save
> > space.  The bigger FD_SETSIZE, the bigger are the default fd_sets,
> > something you don't want on small targets.
> > 
> > So, yeah, something like
> > 
> >    #ifndef FD_SETSIZE
> >    # ifdef __CYGWIN__
> >    #  define FD_SETSIZE      1024
> >    # else
> >    #  define FD_SETSIZE      64
> >    # endif
> >    #endif
> 
> Remember that 64 is MAXIMUM_WAIT_OBJECTS for WaitForMultipleObjects(), the
> underlying Win32 API used to implement select(), so using more than 64 hits
> some complex code to work around that...

This isn't what FD_SETSIZE is about.  FD_SETSIZE does *NOT* define the
maximum count of fd's in an fd_set.

It defines the maximum fd number usable in an fd_set.

So if FD_SETSIZE is defined low enough:

  #define FD_SETSIZE 3
  #include <sys/select.h>

  /* Only fd's 0, 1, and 2 will be allowed in this fd_set */
  fd_set set;

  FD_ZERO (&set);
  /* This will probaly set fd to 3 */
  fd = open ("foo", O_RDONLY); 
  /* So this will (hopefully) fail */
  FD_SET (fd, &set);


Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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