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=WhbWw/nhke/U8kc2vVCtwJ8qN+GJwfo8ex2tKiK05MnLBuBiSFzp2 4tBuIX2oADejuQY5vowKHqB0MAVLppLrnRsZrfbkmOVyyg+5b0yK2uWdSmrNSea2 jlog/600DoD3UF6qdreW3IvQvf4vSf88+oMqbNqedSRY/VZ3UGEXiQ= 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=9gWBiBBvSzXfiHAdF2oSnDvlJIs=; b=qtehW0hWuLotrkb6Inv07rCP/4H9 mBAfDMEeLGNCdDXxiaQdmKpfOgz7gdPHGC4iH3GgLvT2Sj5Jd0ziCMtpf2Qg0jjO UkIg/dUPyIZs8lNVdOY31+TirWoC4qPd+3tGC7bZm+Dy/NSoKwyhrj/RewE2Xbku tliVU8/RROVb1y8= 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=Hx-languages-length:2273, sua, offer, school X-HELO: calimero.vinschen.de Date: Thu, 23 Jun 2016 14:01:59 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: FD_SETSIZE and sizeof(fd_set) Message-ID: <20160623120159.GB5996@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> <20160623115538 DOT GA5996 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oC1+HKm2/end4ao3" Content-Disposition: inline In-Reply-To: <20160623115538.GA5996@calimero.vinschen.de> User-Agent: Mutt/1.6.1 (2016-04-27) --oC1+HKm2/end4ao3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Jun 23 13:55, Corinna Vinschen wrote: > 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 i= s 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= years ago I > > > > found that it was not possible to change the size of the fd set in = linux, 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 li= ke a poll() > > > > implementation, you can fake out any size you want since the size o= f the > > > > array is the first entry. > > > >=20 > > > > I can't speak for the cygwin implementations, but if they offer pol= l() 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. >=20 > Now that's embarassing. I guess I shgould go to primary school again. >=20 > Hang on, I 'll have a nother look while I'nm trying to get the red out of > my face... Oh yeah, the inclusion of stdio.h also includes sys/select.h so the first (default) definition of FD_SETSIZE to 64 rules. In theory it shouldn't do that so we might have to change it in the newlib headers, but for th time being, just define FD_SETSIZE before including any system header. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --oC1+HKm2/end4ao3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXa8+3AAoJEPU2Bp2uRE+gIwcP/1ybQIF3xO0wiEZ6zy0Pp1QM oJcbsNVELt+iqSUWy6abyILf+eUu9ZENcYKoywxl7LuygX5WJdelyqB9P00jQ97l k3dhDhWaTKDf1Q2KRjzZdoLRIFgpegWzA7iOZ0stNipX6BTLuvS7uTWmkFdhHHvU 79VMSY2g0AgBB/3ANfqaDztHP9yFU0HUWF91b8AqjilTf9idGQtyJdQlT/cJsRPW Sr+Xw3vML3FG6kZzGyBTSc73gkB1zF9W4AYS5+VfiJxM2eCKXzSt6Xdpuqmfyn+W gzG1XL+JTOVIn6htj40RTaOqTu6RwSO/h30GJMtHsjiHH2U4Ex29FIRED8Q/7LZj R0DwyVowKbjcHQLvpvp4PLUwjsLwXzfuCUsiQKkFSfg+IfF9q1bdL7vOgD14j/tC cwU7TSI6bnI0iPPHVGsVLYifUO9Y7HPUJGGdZ+WTYrQlWpsJIrs2nWY8m39dizwp fvY9j9wQVlt57Yq7te+JwWrtZ96KEmQuuroTUQrcte3vVITO+gus42nSW/vHoCrg eukFO+lGV1L+FbEF3pO3nQ5DcmM4dOk6pfVy0cN3os4qR5/alcvenVs07rKXO/6P a9FzXfQCySvpKIgpZhbqKxFQ5huuQkn1kMVWkyUUJQ8KTdrIStD5JaFK2E6wgof6 Jzq4Tlsrc7VqxjyMbcfQ =xABb -----END PGP SIGNATURE----- --oC1+HKm2/end4ao3--