Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Nov 1998 17:37:14 -0500
From:      Bakul Shah <bakul@torrentnet.com>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Supporting more than FD_SETSIZE fd's 
Message-ID:  <199811162237.RAA02348@chai.torrentnet.com>
In-Reply-To: Your message of "Mon, 16 Nov 1998 21:09:41 GMT." <199811162109.OAA03119@usr08.primenet.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > 	    memcpy(tmp_readfds, readfds, fd_tablesize*sizeof(fd_mask));
> > 	    int nfds = select(maxfd_in_use+1, tmp_readfds, 0, 0, timeout);


> Right.

> The problem that normally occurs in naieve net code is this:

> 	cnt = getdtablesize();
> 	select( cnt + 1, ...)

If you read carefully this is not what I am advocating.  As
in my example the first arg to select should be the highest
fd in use + 1; *not* the highest fd that is allocatable
(which, BTW, would be cnt - 1, not cnt!).

> > Basically fd_set should have never been defined.

> Definitely agree.  But... it's *still* stupid to call select with
> a count that includes unallocated descriptors.

You are preaching to the converted :-)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811162237.RAA02348>