delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/07/05/11:05:43

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C3AB03858280
Authentication-Results: sourceware.org;
dmarc=pass (p=none dis=none) header.from=yandex.ru
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru
X-Yandex-Fwd: 2
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
t=1657033502; bh=anKa2pYOdcyh0X9Zix3GG3lhBHvdUVar5np3nruaQ2Y=;
h=In-Reply-To:Subject:To:From:Message-ID:References:Date:Reply-To;
b=gF7guYsVgRP8Qw0kqx1Ktqtf0AGxYlvow0kSpAqwtKV+GeXWLRVJMlOT/PZ1AD3nV
W/YLG4Zz7A9d+C1Nehpm2RxrQmmzxXqscEUr8+aRlHp7TLmNPjfMlNJHsYN0mFv/KV
GiioP7Wwz49ov7471NFLWsY+eLkRiS99FQNzJsIM=
Authentication-Results: iva7-6894b5479337.qloud-c.yandex.net;
dkim=pass header.i=@yandex.ru
Date: Tue, 5 Jul 2022 17:55:19 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
X-Mailer: The Bat! (v9.3.4) Professional
Message-ID: <1147442891.20220705175519@yandex.ru>
To: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr AT ncbi DOT nlm DOT nih DOT gov>,
cygwin AT cygwin DOT com
Subject: Re: Typo in <sys/select.h>?
In-Reply-To: <DM8PR09MB70954B30D740E778EB65BA41A5819@DM8PR09MB7095.namprd09.prod.outlook.com>
References: <DM8PR09MB70954B30D740E778EB65BA41A5819 AT DM8PR09MB7095 DOT namprd09 DOT prod DOT outlook DOT com>
MIME-Version: 1.0
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_ASCII_DIVIDERS,
KAM_THEBAT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=no 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>

Greetings, Lavrentiev, Anton (NIH/NLM/NCBI) [C]!

> There's some inconsistency between <sys/select.h> and <sys/param.h>:

> sys/select.h has this:
> -----------------------
> /*
>  * Select uses bit masks of file descriptors in longs.
>  * These macros manipulate such bit fields (the filesystem macros use chars).
>  * FD_SETSIZE may be defined by the user, but the default here
>  * should be >= NOFILE (param.h).
>  */
> #ifndef FD_SETSIZE
> #define FD_SETSIZE      64
> #endif
> ----------------------

> Now, this is the relevant part of sys/param.h looks like this:
> ----------------------
> /* Max number of open files.  The Posix version is OPEN_MAX.  */
> /* Number of fds is virtually unlimited in cygwin, but we must provide
>    some reasonable value for Posix conformance */
> #define NOFILE          8192
> ----------------------

> So it's either "<= NOFILE" that was actually meant to be there in the comment (or,
> an equivalent "should NOT be > NOFILE"), or FD_SETSIZE should have been defined as 8192,
> if the comment is actually correct.  Or maybe I'm missing something here :-)

> I understand that if I redefined FD_SETSIZE in my code before including <sys/select.h>,
> it'd work with whatever large (or small) fd_set I need, but that's not what I'm after.

I'm no expert, but it seems the FD_SETSIZE should have been 128.
Long is 8 bytes, 64 bits. One bit if one open file, 64 * 64 = 4096.


-- 
With best regards,
Andrey Repin
Tuesday, July 5, 2022 17:52:26

Sorry for my terrible english...


-- 
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