X-Recipient: archive-cygwin@delorie.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:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=uSq3iN+U9Wnku+1F
	OmQDuybyzypzMxyqf+3HgoXAhZEXOblyC5Fbr5DLeJrccS43nBN16EJvgfonW3fm
	Sz7ax51S4iGbn4xLIQ2vwFpCqONU8xOvMgapdm3YlP4wpBA/FaPUnv76lef62+VZ
	JJDpOcn3xeiQ/FYKQN3hetddjk0=
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:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=tDvFESHqpQd1fyxH6B38Zi
	kMDJ4=; b=sex0uwwmtiWefGZhwTq3RUDqTL06ZRdrQLtZ1ZfMjmzPaYQed/BU7i
	XQe4nSkwn+VehCMQbgvpk8KUwLuIL+XcxJKORWaPmdD5fmlTCnalvJrg0coaY2kw
	B+x7czVp8qThAdDO750a1wE6MAb2NY4mT0IuSAIPjL0VL76dzHS84=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=3.6 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=secondly, H*RU:sk:relay.m, Hx-spam-relays-external:0.0.0.0, H*RU:2500
X-HELO: burlywood.birch.relay.mailchannels.net
X-Sender-Id: totalchoicehosting|x-authuser|lee@dilkie.com
X-Sender-Id: totalchoicehosting|x-authuser|lee@dilkie.com
X-MC-Relay: Neutral
X-MailChannels-SenderId: totalchoicehosting|x-authuser|lee@dilkie.com
X-MailChannels-Auth-Id: totalchoicehosting
X-MC-Loop-Signature: 1466681551291:1896951563
X-MC-Ingress-Time: 1466681551291
Subject: Re: FD_SETSIZE and sizeof(fd_set)
To: cygwin@cygwin.com
References: <DM3PR18MB084148FC4EFA327DA33DB267DB2C0@DM3PR18MB0841.namprd18.prod.outlook.com> <nkf6f4$304$1@ger.gmane.org> <nkfenq$n3h$1@ger.gmane.org> <DM3PR18MB0841BD59B02E2CDAE372F2CCDB2D0@DM3PR18MB0841.namprd18.prod.outlook.com>
From: Lee Dilkie <lee.dilkie@mitel.com>
Message-ID: <59cb34fb-3173-4af9-1b6d-17cef98b7934@mitel.com>
Date: Thu, 23 Jun 2016 07:32:33 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1
MIME-Version: 1.0
In-Reply-To: <DM3PR18MB0841BD59B02E2CDAE372F2CCDB2D0@DM3PR18MB0841.namprd18.prod.outlook.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-AuthUser: lee@dilkie.com



On 6/23/2016 6:54 AM, 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=%d\n", FD_SETSIZE);
>         fprintf(stdout, "sizeof(fd_set)=%d\n", sizeof(fd_set));
> }
>
> Steve Bardwell
>
>

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.

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.

I can't speak for the cygwin implementations, but if they offer poll() or, better, epoll(), use those.

-lee

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

