From owner-freebsd-hackers Fri Dec 13 00:27:39 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id AAA01704 for hackers-outgoing; Fri, 13 Dec 1996 00:27:39 -0800 (PST) Received: from blacklodge.c2.net (root@blacklodge.c2.net [140.174.185.21]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id AAA01678; Fri, 13 Dec 1996 00:27:30 -0800 (PST) Received: from atropos.c2.org (atropos.c2.org [140.174.185.14]) by blacklodge.c2.net (8.7.6/8.7.3) with ESMTP id AAA18689; Fri, 13 Dec 1996 00:29:11 -0800 (PST) From: sameer Received: (from sameer@localhost) by atropos.c2.org (8.7.6/8.7.3) id AAA20468; Fri, 13 Dec 1996 00:27:06 -0800 (PST) Message-Id: <199612130827.AAA20468@atropos.c2.org> Subject: Re: getdtablesize, OPEN_MAX, and sysctl To: sameer@blacklodge.c2.org (sameer) Date: Fri, 13 Dec 1996 00:27:06 -0800 (PST) Cc: freebsd-questions@freebsd.org, freebsd-hackers@freebsd.org In-Reply-To: from "sameer" at Dec 12, 96 11:53:25 pm X-Mailer: ELM [version 2.4 PL24 ME8a] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk More information -- on the 2.1-STABLE machine with OPEN_MAX of 256 we tested it by subtracting two from the getdtablesize() result before passing it to select() -- it now works. > So I have a machine (2.1-STABLE) with OPEN_MAX set to 256. > When I do sysctl -a kern.maxfiles is 2088. Is there a relationship > between OPEN_MAX and something that shows up in sysctl? > I have this program, where if I do a getdtablesize (or > sysconf(SC_OPEN_MAX)) it returns 256 at program startup, but returns > *258* on a getdtablesize() call further on in execution. (Right before > a select(), which then subsequently fails with EINVAL) Anyone know how > the getdtablesize() result could have changed by two? > > I have another machine (2.1-STABLE) with OPEN_MAX of > 1024. sysctl kern.maxfiles is 2088. getdtablesize() returns 1024 on > program startup and 1026 right before that select call. > > I have yet another machine (2.1.5-RELEASE) with a default > OPEN_MAX. kern.maxfiles is 4136. When I run this same program, it > works. getdtablesize() returns 64 on startup and 66 right before the > select. > > I have yet another machine (2.1.0-RELEASE) with an OPEN_MAX of > 128 and kern.maxfiles is 360. getdtablesize() at main is 128 at right > before the select it is 130. > > On the last two machines, the select runs fine On the first > two, the select (the result of the getdtablesize() is going to the > first arg of the select() call) returns EINVAL. > > Could someone point me in the direction of a clue? thanks. -- Sameer Parekh Voice: 510-986-8770 President FAX: 510-986-8777 C2Net http://www.c2.net/ sameer@c2.net