Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 1997 18:58:34 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-current@FreeBSD.ORG, j@uriah.heep.sax.de
Cc:        ircadmin@shellnet.co.uk
Subject:   Re: Where can I get help ?
Message-ID:  <199712100758.SAA13693@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>My current limits look like:
>
>j@uriah 439% limit -h descriptors
>descriptors     680 

Using a real shell:

$ limit -h descriptors
limit: not found
$ ulimit
$ ulimit -Hn
360

>(That's the `hard' limit.)
>
>This number is NPROC*2, with NPROC being computed in /sys/conf/param.c
>as 20 + 16 * MAXUSERS.  So basically, by bumping `maxusers' (in your
>kernel config file) to (1024 / 2 - 20) / 16 (= 30.75 :-), you'd get a
>default of 1024.
>
>Actually, you can change it at runtime using sysctl, it's the sysctl
>variable kern.maxfilesperproc (you probably want kern.maxfiles to be
>larger then).  Thus, no kernel recompilation needed.  (Disclaimer: i

Have you tried it? :-)  It only works for login classes that set the
hard limit (in the current login.conf, these are root (value infinity),
daemon (1024), news (256) and dialer (32)).  Everything else inherits
the old hard limits from init.  This is just one of the reasons why
kern.maxfilesperproc should not exist.  It only works to restrict
(break) the limits advertised by getrlimit().  It just gets in the
way of expanding the limits.

>don't know offhand when this tunable variable has been introduced, so
>it depends on your FreeBSD version.)

kern.maxfiles was introduced in FreeBSD-2.0 (actually in 4.4BSD-Lite).
kern.maxfilesperproc was introduced in FreeBSD-2.0.5 (kern_descrip.c
rev.1.8 1995/02/20).  It was broken (read-only) in -current between
rev.1.19  (1995/12/04) and rev.1.32 (1996/09/28).  It should have been
removed when login classes were introduced.  Login classes make it
possible for increasing it to work (all classes just need to set a
hard limit to pick up the new limit), but they also make it redundant.

Bruce



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