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=d5a/FdjNPeajO03NU/L2xSSh5zBeoHJgCKpweS2d0YHqW6E5nXJ+1 GI23CpSeh3U1IM3M47aF++SgpKOK8A89kXZGg/XuUmkale1tsEI3c6vYtWWjswBy SQYOEw7z4y6ae0ETuzrftARj/AETIIwAF5dGUSK1hUBeRWinCBUtp8= 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=PIkGg5Q9FgPlrYfAjDEli2tIf4A=; b=akv3yGdKxQTZoc4xnICCW+CfAOqu Jlo7pG6wCCvz7ogu/5C7Z94LsJVLglwEYA09V6VotiK80dTgqLyKr0SAMkShBkTm YgvsBbyOd3BfLsgrXpNdZvVMy+4zMtiZ0igE1bkjD57oVN0SIZwu6S9yy2NuEDEq CJCK6BXvEsdUPUI= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=sua, offer, school, face X-HELO: calimero.vinschen.de Date: Thu, 23 Jun 2016 13:55:38 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: FD_SETSIZE and sizeof(fd_set) Message-ID: <20160623115538.GA5996@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <59cb34fb-3173-4af9-1b6d-17cef98b7934 AT mitel DOT com> <20160623115249 DOT GF15373 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="TB36FDmn/VVEgNH/" Content-Disposition: inline In-Reply-To: <20160623115249.GF15373@calimero.vinschen.de> User-Agent: Mutt/1.6.1 (2016-04-27) --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Jun 23 13:52, Corinna Vinschen wrote: > 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 > > > > #undef FD_SETSIZE > > > > #define FD_SETSIZE 256 > > > > #include > > > > #include > > > > > > > > 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 y= ears ago I > > > found that it was not possible to change the size of the fd set in li= nux, 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. >=20 > 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. Now that's embarassing. I guess I shgould go to primary school again. Hang on, I 'll have a nother look while I'nm trying to get the red out of my face... Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --TB36FDmn/VVEgNH/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXa846AAoJEPU2Bp2uRE+gQ/oP/Aw5smwGIJziEtvhHSKK2mAY MvPK6NMarxAvhr/MblnLBd1lWTvEaVWl6EtQMVSnrliaK7Jdh8wKWNUdF5FOj+xq brLlhal8cMW4X/IN+2N8EuAGrMibxHvEe6SFnF7OG0S2BIl0SlQaKo/ctNUst36E 2yIt16VO7lx7Mzx1Rm/ryMlvyaf9pvEyUYqBk52vwCskpbX0TaWoWpkim650euua vScfgyHyzDVk4TXGfzdOWI8K5t03tXbZ15nvy+EJLDQKKBYnTr1pxhdtaXSTbHNw inprfWxvEfV1JGuCYacEz43LbiKJRZiJ0GIlFMQfDxisjJdT7Q2z3xxmI9PbI7Uk G60w9nSt+Yrwgb7YwNPSAyXoyloEAIbcYjUCx7WHYy4oEXuwZ0jYB0XlMBqhD+F6 XIkx6yClJM0vWQn9i30eea63AltoXxLp8FWQD+P9+35L29dwRcm/EwoWHsp0yHZ1 JGzGftYUt+oyRn9VbqaiCP/p/wqQAO2QGufdAC15FPdf5k4pHC0+eUi0MtpOSNqJ NoCcsBrU1+8Gq1w6LGzv++8KaOrhjLnwNMF27KO3kPKJE2blQMMPh4HArex480jC rhs05JxJLJA0T31IbOR5JF2so6BO+Kas1wbfUDKZ5iSKrWpXwAX9SmE40YVITtw7 YIV2oLX/HyNcLh2tLu67 =S9s0 -----END PGP SIGNATURE----- --TB36FDmn/VVEgNH/--