*BSD News Article 61206


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!zombie.ncsc.mil!cs.umd.edu!not-for-mail
From: torek@elf.bsdi.com (Chris Torek)
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Re: More than 256 open files with select() ?
Date: 3 Feb 1996 22:15:37 -0800
Organization: Berkeley Software Design, Inc.
Lines: 40
Message-ID: <4f1iu9$k3p@elf.bsdi.com>
References: <4en03h$qcf@news3.cts.com> <DM650r.5An@wiz.com>
Reply-To: torek@bsdi.com
NNTP-Posting-Host: elf.bsdi.com

In article <DM650r.5An@wiz.com> Marc Wiz <marc@wiz.com> wrote:
>I knew there was a reason I kept this stuff around!  :-) Anyway here
>is a message from Chris Torek that was on the bsdi-users mailing list.
>Granted it's back from 1994 but I don't see why it should not apply.

As of 2.1, a lot of this is still true but easier to fiddle with,
and the known bugs are all fixed:

>You can define FD_SETSIZE yourself before including <sys/types.h> ...

>[The per-process openfiles limit] can be raised by anyone simply
>by using the C-shell's built-in `limit' command.

... up to the maximum imposed on the user, which is either the
maximum the administrator has chosen in the logincap file, or the
system limit, whichever is smaller.

sh, bash, and probably ksh all have similar built-ins (spelled
`limit' in sh and `ulimit', with different options, in bash).

>If you use select() in a process that has more than 256 files open,
>you will need to recompile your kernel's sys_generic.c ...

This is now fixed.

>[the] system-wide limit on the total number of open files [is set by
>the] variable `maxfiles' in your kernel's param.c

... and is now adjustable via `sysctl kern.maxfiles'.  If the files in
question use vnodes, the kern.maxvnodes limit also applies.  (Files
are either vnodes or sockets, with pipes being a form of socket,
so vnodes make up all the other files.  The `pstat' utility will,
with -T, show active files.  For efficiency, however, vnodes are
not recycled immediately; whatever kern.maxvnodes is set to will
generally equal the number of vnodes allocated.  Perhaps pstat
should count up `releasable' vs. `in-use' vnodes.  With -v, pstat
shows `releasable' vnodes with zero `USE' and `HOLD' counts.)
-- 
In-Real-Life: Chris Torek, Berkeley Software Design Inc
El Cerrito, CA	Domain:	torek@bsdi.com	+1 510 234 3167