From owner-freebsd-hackers Mon Nov 9 10:47:34 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA05841 for freebsd-hackers-outgoing; Mon, 9 Nov 1998 10:47:34 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from alive.znep.com (207-178-54-226.go2net.com [207.178.54.226]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA05834 for ; Mon, 9 Nov 1998 10:47:30 -0800 (PST) (envelope-from marcs@znep.com) Received: from localhost (marcs@localhost) by alive.znep.com (8.9.1/8.9.1) with ESMTP id KAA11645; Mon, 9 Nov 1998 10:42:59 -0800 (PST) (envelope-from marcs@znep.com) Date: Mon, 9 Nov 1998 10:42:58 -0800 (PST) From: Marc Slemko To: Nate Williams cc: hackers@FreeBSD.ORG Subject: Re: Supporting more than FD_SETSIZE fd's In-Reply-To: <199811091826.LAA05253@mt.sri.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, 9 Nov 1998, Nate Williams wrote: > > > I need to support more than the default 255 FD's in an application (the > > > JDK for what it's worth). > ... > > > I looked through the code in Apache, and I don't see how it does this, > > > since I never saw any re-definition of FD_SETSIZE, or use of anything > > > other than fd_setsize. (Although, I did see mention of FD_SETSIZE quite > > > a bit in the comments.) > > > > Apache doesn't use select() on high numbered descriptors so it doesn't > > matter. > > How does it determine if there is data on those FD's w/out select? I It doesn't have to. > would think that if you have more than 255 active FD's (pretty common) > then you'd have a problem. One connection per process at any given time. High descriptor use in Apache only comes in with logfiles, eg. 10000 vhosts with two logfiles for each. > > FD_SETSIZE doesn't limit the number of descriptors, it just limits the > > highest descriptor you can pass to select(). > > Right, hence my question on how other applications deal with the > problem, since select doesn't have inherent limitation. > > > There are various possible workarounds: > > > > - use poll(). Only on 3.0 unfortunately. > > > > - on 3.0, FD_SETSIZE defaults to 1024. > > I'm on 2.2.* > > > - redefine FD_SETSIZE before including sys/types.h. This may seem to be a > > pain, but in most large projects you should have some common header files > > you can use for that anyway. This doesn't fix any libraries that you use > > though, which may use select() internally with a small FD_SETSIZE. > > No external libraries are used except for Motif. I'm not sure if it > uses Select, but I doubt it. In any case, I'm still defaulting to a A lot of X11 stuff will use select(). > larger limit, which is still not a great solution. If you need a generic ability to select() on descriptors above 256, the only real choice you have is to redefine FD_SETSIZE everywhere and hope no other libraries cause problems. Or insist that anyone building or using it changes the global FD_SETSIZE on their system and does a make world. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message