*BSD News Article 16324


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!agate.berkeley.edu!cgd
From: cgd@gaia.CS.Berkeley.EDU (Chris G. Demetriou)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: wd stops on update
Date: 20 May 93 07:29:18
Organization: Kernel Hackers 'r' Us
Lines: 50
Message-ID: <CGD.93May20072918@gaia.CS.Berkeley.EDU>
References: <cproto.737791950@marsh> <1tde5tINN6i@hrd769.brooks.af.mil>
	<CGD.93May19172153@eden.CS.Berkeley.EDU>
	<1tg1heINN169@hrd769.brooks.af.mil>
NNTP-Posting-Host: gaia.cs.berkeley.edu
In-reply-to: burgess@hrd769.brooks.af.mil's message of 20 May 1993 08:36:32 -0500

[ sorry this is a bit pedantic; it'd make a good FAQ entry!  8-]

In article <1tg1heINN169@hrd769.brooks.af.mil> burgess@hrd769.brooks.af.mil (Dave Burgess) writes:
>If that is the case, then even 512 seems to my simple mind to be too many.
>Would someone care to suggest a reasonable limit.  

for the "unlimited" case, 2048 is not really unreasonable...
but it's an arbitrary limit, which is why we made it a config option!  8-)

>Actually, a brief description of this new feature would be cool.

ok.  Under NetBSD there's a kernel paramater "maxfdescs"

you can configure it to have a given value by putting the line:
maxfdescs	512
for insstance, in the same way as you'd say "maxusers 10"

the standard "openfiles" soft limit will remain at 64 (and for various
reasons, this is a good number to default to), but when "unlimit"ed,
the maximum will number of open files will be the value of
the maxfdescs paramater, rather than RLIM_INFINITY.

having a value as large as RLIM_INFINITY for the max # of open files
when "unlimit"ed is a good way to crash the system, as some programs
(e.g sendmail 5.67) will attempt to close all of the file descriptors
they can, by finding that number with getdtablesize(), and others
(e.g. bash) will try to, for example, dup2() to the -1th file descriptor.
these programs cause the kernel to allocate a gigantic number of
file descriptors, if the openfiles limit is RLIM_INFINITY (0x7fffffff),
and thereby crash the system.

this will crash a 386BSD 0.1+patchkit system in literally the blink
of an eye (i belive it's an instant reboot) if, for example, you say
from csh:
	unlimit
	bash

>For example, is this the value that will be used as 'unlimited'?  If not, 
>is there a way to set the max file descriptors higher than this, just in case?

yes, that's the value that's used by "unlimit"ed.
as stated above, the standard value for the max # of open files is 64.


chris
--
Chris G. Demetriou                                    cgd@cs.berkeley.edu

   "386bsd as depth first search: whenever you go to fix something you
       find that 3 more things are actually broken." -- Adam Glass