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

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E66DC3858407
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1657113627;
bh=/jLgwXMoyOgaofsR1ObT5QZDMOFfCevHjIhWLbA687k=;
h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=N6UduN7bqkTI2vn627H53aBOPPevMn7YIID0nxV1MMlXvRgZKba+Dcd7Vf1JIu8kk
Xlw4bOnpuEHaN/v76RSnf9OPu49Gz6PKOqbwPM4/DYVfHLZ1AKF6C59iv/Ow2Y33em
REj9mAhiMvnv03F6WzrGueQgxuMa9trLZjeO5Suk=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D5FE6385801A
X-SBRS-Extended: Low
X-IronPortListener: ces-out
X-IronPort-AV: E=Sophos;i="5.92,250,1650945600"; d="scan'208";a="251341911"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=k4Tk7LAadbPaVHjT/r2OQNsQ+a+ko7rLSi5fNkXlssMSoBoyrGdh3GTgwQe1nDvUOR6kJO+hjhUHkZOMWqBX0n38rhprkdAsMpCYatQ+iULpJWCYzRTAjC+OpglkZuOexpX/b5ExcTTkkj+/dn8CboMWUbWZP4JsRNCHu3J9pgCwmbY1MOlNJI02pc06Yk60pUiWld2TpSjJT3rOBnx+gyxxMKTaU7IJVxoiig8NWP31dARNaL79D7UCe6yZUqS8rgDesdiWGa4U1SU5niV4/bVWKi1bOgY3oUL23wxY3a3fhESdRByyvyWTHx7GhjjmDduFrVJN9UWZ9g6OPzdpdg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=r0CIb+I27YAcsFhjHOlQfcEfVksP5HXU7bnnvth1xok=;
b=EIxMtf9nlWcX623DCCJe+kBlxe28iEIfcJ4qM21Wh198ipVRuNJDk2vXAusxlAwzdS9fZ2xqKRZisI+d+SJihyH6R40a1ZNlrcoKmHj+diCkRO3nN1/INvui69wJ25gnm1Jrf+pM4/4hhjArXVoSc7q0bbEKXMx/jNrGrWktyUfiQrmoV6vbvYI+JCO4wExsX7mn6lUGVYMW1MLAy6f2JUCNIHAQ2ZDXjBbNCiLFwo5oX3mCSqD8g0MyH9/bYeXIdJALy9EY/i2CzCSQLQub75bCa/oULwBxpDLukXLeWufUPn6qIhIoWC3DY+QiQ4/K/ujN6DK2L90jVfiBxJkfmA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=ncbi.nlm.nih.gov; dmarc=pass action=none
header.from=ncbi.nlm.nih.gov; dkim=pass header.d=ncbi.nlm.nih.gov; arc=none
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Re: Typo in <sys/select.h>?
Thread-Topic: Typo in <sys/select.h>?
Thread-Index: AdiROvMgsADAZCGEQVCpJBC4tQ+n+g==
Date: Wed, 6 Jul 2022 13:19:02 +0000
Message-ID: <DM8PR09MB70957DF0C3E4AB75B8FCC2D2A5809@DM8PR09MB7095.namprd09.prod.outlook.com>
Accept-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 23527403-f4bf-4752-3a3a-08da5f521835
x-ms-traffictypediagnostic: DM6PR09MB5623:EE_
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: odWD0teGJyDK6fXdqagWD9q7hckUDz7Mc+pI8+WdWvcyZHtHvVOyD3Cftvh1UuzjQXxqBPpf1P8y7TOmJDzhN6rMUyI9ILuQbvklPcD/3Roj3Th4pxudCH+0qYQG/uVPNnzuAMEFbI5sNmrfysTnAPdefnU5f4UDao/aARlbCYzPbyAJqVVzX/qAWoCcYJY/25ieEqjhqqeK6wwmpwlRmWgLjU7egr+2pj2A3i1xVNY8OYou2qItpxCvudc+w1iS92d79DFbsD9Qk2Z45xRUAgOTMn7q9Vq8N7E01vaqiyTX/1idd50zntj4abWlKeER0je+upkgQboAUioHu6JYrcg4EO3z+eqgTkSvtxd7vSZhTr9O7vvMQzh73bZgCIro1w5j9sZ4AMiA5XJ41j5rOtKpvGMv1nd50QCST6Fx6i35vI+js/nyT6lnZwEWctmMrvS6iEjIWdqsdBbk1GVrCI4Ecbp1KYN6d+2lnffoVi7eCKLxOHWoJOqZKAL6f7s2k+9kA6/pkFPOROmOc47vm9jVnDyAY3ZaScNSLvImA3lR/6n3qJdG0/IZ5IGGMB2VCkm8CqLnD2bFtndzwHBaMBwLkKqAwtblRzVbcR5Ayru/GZJ0CRD+HMQn8aV5jizwXyJol+PmagXLufnGehfARFH2AejBzlN/dAvCGzTrtYelLC6RAamSvulOUyXfv+dxNhmGlSc5PqTIQUuYP+RtCdoU6zmnRXZ6DKHlAYGoap5njAamo6BZf6K3NbZclMtledzLrptw+qK1sUS2xo5isSRT6wgxmtjC+mOH1IoYSiZJEnSdoVSjUjJ9DAf+UsA1
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:DM8PR09MB7095.namprd09.prod.outlook.com; PTR:; CAT:NONE;
SFS:(13230016)(4636009)(366004)(38100700002)(26005)(186003)(122000001)(6506007)(7696005)(38070700005)(5660300002)(6916009)(9686003)(8676002)(66476007)(66556008)(76116006)(66946007)(66446008)(64756008)(8936002)(33656002)(52536014)(4744005)(55016003)(2906002)(86362001)(71200400001)(498600001);
DIR:OUT; SFP:1102;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?IuWNrb9HtZUdg4KiZMIFy5ujej51etR4s3Gjk6PXGX3rU/TNO7Rok1V8xWKz?=
=?us-ascii?Q?IUqniXnAn8vySuoQgOtBh1CtqjnU/N/32oV1rnqY5qWZaZJDG/uMoFjqhRfj?=
=?us-ascii?Q?ez8CWDPCplYN4ekyDfbCjlQA2Iphv5jRRLcot4g5yPgAAOdsRXrtMtHodp/8?=
=?us-ascii?Q?QO/50JAnPF1TI/nwadNWVkHt7xLIM4eLYHIJCzOGY28z/eh6QFv8U/mHDBkj?=
=?us-ascii?Q?6UJOUowcmvGkgv9X5ybjijQYt+2GWrJY0dB0eMHvMRM9gaBM8ORf9FSX+yPN?=
=?us-ascii?Q?Y0H0OtkyF7IAOGIrA6/7odIvC9uRjvyG5CzFa6RPgMkZIj5LUgCi5pzGZy+X?=
=?us-ascii?Q?cX8z31vHNis9TFEtL6H5Sl+Df+xsTJFmkBzGmLDUyOFguszFEtMrrTn35kOd?=
=?us-ascii?Q?l9Tt0TanI4rEJIRv5WOZqapAWnyaE2Y7rj0LYTWd+VS08w5iwm+ps9hEMLz+?=
=?us-ascii?Q?dAp+2wuS8AczQBdTJhRd01ErW2eaf3rA9kwNJV37zc6zBfkIAMNXoq/J6qz1?=
=?us-ascii?Q?EgcwYZQbDwBMRQgDiu3rE142NKS/FkYLEKM5JcuS88c2Cinsh8IA6WbNNOGN?=
=?us-ascii?Q?SKYvdKXtBjSX2YwGcYX71eop94Hp9V2ZtohnrrOrDwuisxS5QiifQj/5R44c?=
=?us-ascii?Q?BOPWdF/tdjEJQM59DSs4lHvfZIqfk2FZW8ZSMC2MdlEP0cdD5R5KFjqNOItv?=
=?us-ascii?Q?GSOOX1RBz/z2+t5xjZ2vJ0XpLEv+RNFtEj4aV2YAo0oD8dPFkgTZ/41OjT/W?=
=?us-ascii?Q?27Q9Vvn11boAJmRfsSSn2Kh0JfBoQJIv0zJvhn7nHXXp+OVkbOzySXnWxnLe?=
=?us-ascii?Q?F8wppeRt7T5m5bIRe2BEu8DP++y6ScmMnr8Ugk2y9UhfxKs3U0a0jvsvaFoi?=
=?us-ascii?Q?Uv8yNHbNfmA3gjGPpZ9bUuk1o5lMsTpaogjeymlFYgtXX6j241EQCSRPfRh4?=
=?us-ascii?Q?VDS9yoTpSYpR9bxCfLe3WuZft33JWZm59HhBFm3hPW2bee1tIM93q3mMmcl2?=
=?us-ascii?Q?aEvknaEKWd5Wmi+T1oxHqNWQgclZsrSYnCiiaylP2Z8MXEOrYGgghJPj18h2?=
=?us-ascii?Q?Z1dZHqK7tvBxYDft5jGK9q0HkRuY4GuA+98f7JLkeEyiGI36F3HBKqP5jRcY?=
=?us-ascii?Q?ugKXVF7Mq7rLlpPhnoPsfb8LJuyJfdqanAaQ+McRXEuNSbcq3SpbGyZJFshQ?=
=?us-ascii?Q?6lsA0UOHiyqETVxdtFTk9LRYlxfhg9f45faAhAdm9D4y2927MldOVv+TJrR2?=
=?us-ascii?Q?lkBPEqw2shf0PsHOOSU/KUGKPs556yHrC0ozqcp5qJrg72z9WsU6TLe2hPsv?=
=?us-ascii?Q?W0mPaTbT9l7finIULRfZ3q7ns1zTJzapg/Q8o+TA2T6bA6JxkkMR45MRPyqY?=
=?us-ascii?Q?kXnbSKwijggX4nlREuN/r/arRadLvNR1eo2c4MU+bwVfb+RQFHz5m3Prw468?=
=?us-ascii?Q?X/w5Q5BhXiH9pgGtlmKEQ9FYreR52P2fdT62kvO084FSoUPiJEC4dZUnFTGF?=
=?us-ascii?Q?JKrpdwRhUC7o9r1SXuzWKYGJYFRGoNNiPgRYSGNx5FU6FBNgR5pViUTIrQ26?=
=?us-ascii?Q?aO9w0Ke0b95nbA6ehf4=3D?=
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: DM8PR09MB7095.namprd09.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 23527403-f4bf-4752-3a3a-08da5f521835
X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jul 2022 13:19:02.4132 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 14b77578-9773-42d5-8507-251ca2dc2b06
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR09MB5623
X-OriginatorOrg: ncbi.nlm.nih.gov
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_EF, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE,
T_SPF_HELO_PERMERROR 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-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>
From: "Lavrentiev, Anton \(NIH/NLM/NCBI\) \[C\] via Cygwin" <cygwin AT cygwin DOT com>
Reply-To: "Lavrentiev, Anton \(NIH/NLM/NCBI\) \[C\]" <lavr AT ncbi DOT nlm DOT nih DOT gov>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

> On Linux, select(2) is really only capable to
> handle file descriptors numbers up to descriptor number 1023,

That is not true.  While FD_SETSIZE is defined as a fixed constant,
Linux kernel does not actually "know" (or care) about it.

So you can have an array of fd_sets, like this, in your code:

fd_set r_fds[NFDS];

and then if "fd" is a file descriptor in question, you'd do

FD_SET(fd % FD_SETSIZE, &r_fds[fd / FD_SETSIZE]);

and then

n = select(maxfd + 1, r_fds, ...);

The Linux kernel is guided by the maxfd parameter and assumes the sets are as
large as required to cover that number of file descriptors (obviously checking
that those sets are still within the process reach).

NFDS above is chosen such a way that "NFDS * FD_SETSIZE" covers all your required
file descriptors, if there are more than just FD_SETSIZE.

Anton Lavrentiev
Contractor NIH/NLM/NCBI

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