delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/06/23/07:53:16

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=h0hSMfjKLcptjlDrEu28mzUErhrQ/U95hcQShzVCuNbCVLCUzgnBx
KGchdz4i8Grxm73O7Jwvq+MCknBoSKYxfgG2w+F63muyG0Z/926/AZ7PsnD8XHiq
miLbM5sLrui7Knvi7aelSvqaPddub6w8xCuypgnRrVD6CQSH/tZ4ek=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=MU8Af06TaYPPFKlm//qXfkt783g=; b=ugaHD/ejWp+6Hzk+vBErT+ALvqej
TlUe/lLN/Y26PnnKTSFqFuAryTjy/gVwVgQKW2Ai96t+68KeOhbfmu70THfj5xI9
qkewqAth3iKgxmD0cOwE9trD5gTq9tawMLnlMqqiHw3VlZFQ7r7aq65FJ+Liwvst
yW3heq6cyMsQ9Is=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-96.3 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=historical, sua, offer, lee
X-HELO: calimero.vinschen.de
Date: Thu, 23 Jun 2016 13:52:49 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: FD_SETSIZE and sizeof(fd_set)
Message-ID: <20160623115249.GF15373@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <DM3PR18MB084148FC4EFA327DA33DB267DB2C0 AT DM3PR18MB0841 DOT namprd18 DOT prod DOT outlook DOT com> <nkf6f4$304$1 AT ger DOT gmane DOT org> <nkfenq$n3h$1 AT ger DOT gmane DOT org> <DM3PR18MB0841BD59B02E2CDAE372F2CCDB2D0 AT DM3PR18MB0841 DOT namprd18 DOT prod DOT outlook DOT com> <59cb34fb-3173-4af9-1b6d-17cef98b7934 AT mitel DOT com> <DM3PR18MB08415ECB5C8AD931556363A8DB2D0 AT DM3PR18MB0841 DOT namprd18 DOT prod DOT outlook DOT com>
MIME-Version: 1.0
In-Reply-To: <DM3PR18MB08415ECB5C8AD931556363A8DB2D0@DM3PR18MB0841.namprd18.prod.outlook.com>
User-Agent: Mutt/1.6.1 (2016-04-27)

--ALfTUftag+2gvp1h
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jun 23 11:36, Steven Bardwell wrote:
> > >
> > > Here is a "program" that shows the issue I am worried about. It is so=
 simple
> > that I must be overlooking something really obvious:
> > >
> > > #include <stdio.h>
> > > #undef FD_SETSIZE
> > > #define FD_SETSIZE 256
> > > #include <sys/types.h>
> > > #include <sys/select.h>
> > >
> > > main()
> > > {
> > >         fd_set rfds;
> > >         fprintf(stdout, "FD_SETSIZE=3D%d\n", FD_SETSIZE);
> > >         fprintf(stdout, "sizeof(fd_set)=3D%d\n", sizeof(fd_set));
> > > }
> > >
> > > Steve Bardwell
> > >
> > >
> >=20
> > I don't know if this is still the case, but when I looked into this yea=
rs ago I
> > found that it was not possible to change the size of the fd set in linu=
x, it's
> > fixed at 1024 (generally), unless you rebuild the kernel.
> >=20
> > Secondly, in the windows api, their version of an fd_set is more like a=
 poll()
> > implementation, you can fake out any size you want since the size of the
> > array is the first entry.
> >=20
> > I can't speak for the cygwin implementations, but if they offer poll() =
or,
> > better, epoll(), use those.
> >=20
> > -lee
>=20
> For what it's worth, this 'program' works as expected in SUA. The size
> of the fd_set changes depending on the value of FD_SETSIZE.

In my case it prints 'sizeof(fd_set)=3D8', which is correct.  For
historical reasons and an ill-advised compatibility with old cruft,
fd_set is an array of bit per descriptor.  8 * 8 =3D 256.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--ALfTUftag+2gvp1h
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXa82RAAoJEPU2Bp2uRE+gDUgP/1tzZAVPh6ZHsbNE9u9/qgsf
jCRUsKbMjTz2o3Et7uvKPBaPre+N/Yhc+jdvMxprjNvhNJ8aKcbeo5vjWC8yb+g3
viR0CtOlwzmnZI1LaaAH/xzuBMI2Z0ly1jLttMq2mg+2k8AYhRuFLIbfWdw2k/jK
vjNpF99aQKohDxc3W0f3tNbHR7YEocF4neYEkDYQVPESR4KXUkO8CDFrWrzraAe4
W2321zmPIpK3LfqX80J069UVMw7FtsK1Abmh9de+O035cmYPU/jahiLQ+aSzZyHp
uMuFWmSjxFRJKQ1Uhmio9bzMHQ6HutWjkirQ8NO7KVczTXRjzjavbuO5p1WY30FS
XjYRL2SiLNL15KhrSH6f/UliqdHzDj4Snwta9SHzuB0ICna/c8O+AyETpPHLoCOP
rN6q2XhbGehoWNKg/RrbFAkBX0vBbVPjGlWHllj14DDYeuLYIOQuL63O15fSuP/v
TgJNIEXOFPQKqfuj8VMutWpy0PQK65EEkWREtTGDQ8sfy0MAjFWsR2FIZ1xKQAnR
G0yKSI/kAIbW8HKvptxsKE7aS2Ax9tLgHG3V+8+2eaojHS1idqpmoKV6dhMyL+3M
QoWCwsfyyjf8qvd7PEnxldW1q4m/E5yDMMQmRx+zs5/+F3aD7UhpRafWi10JRiSa
KkOXUikjLLpB9yTm4xow
=VOAC
-----END PGP SIGNATURE-----

--ALfTUftag+2gvp1h--

- Raw text -


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