On Thu, Sep 29, 2016 at 12:10:47AM +0300, Evgeny Grin wrote:
> Hi!
>
> I configured freshly installed OpenBSD 6.0-release with
>
> kern.maxfiles=131072
>
> in /etc/sysctl.conf
> and
>
> :openfiles-max=40960:openfiles-cur=40960:
>
> for daemon in /etc/login.conf
>
> And at each boot I see message:
> kern.maxfiles: 7030 -> 131072
> /etc/rc: ulimit: bad -n limit: Invalid argument
>
> I looked at /etc/rc and found that script at first step call 'ulimit -S
> -n ' for value found for '-cur' and at second step call 'ulimit -H -n '
> for value found for '-max'. That is incorrect as soft limit can't be set
> to higher value than hard limit. Moreover, I can't just use
> ":openfiles=40960:" for daemon class because "default" class has both
> "-max" and "-cur" values - as result: at first step "40960" used for
> both hard and soft limit, but immediately lowered by using "-cur" and
> "-max" values from "default" class (getcap return them for "daemon"
> class as well).
>
> As current workaround I use
>
> :openfiles=40960:openfiles-max=40960:openfiles-cur=40960:
>
> but it is not really elegant solution.
>
>
> I this that at least order of suffix checking in /etc/rc must be changed
> from
> "for _suffix in {,-cur,-max}; do"
> to
> "for _suffix in {,-max,-cur}; do"
>
>
> Am I right? Or I missed something?
>
> --
> Best Wishes,
> Evgeny Grin
First setting max and then cur should be enough.
Moving this to tech@
-Otto
Index: rc
===================================================================
RCS file: /cvs/src/etc/rc,v
retrieving revision 1.486
diff -u -p -r1.486 rc
--- rc 10 Jul 2016 09:08:18 -0000 1.486
+++ rc 29 Sep 2016 05:05:13 -0000
@@ -31,7 +31,7 @@ update_limit() {
local _cap=$2 _val # login.conf capability and its value
local _suffix
- for _suffix in {,-cur,-max}; do
+ for _suffix in {,-max,-cur}; do
_val=$(getcap -f /etc/login.conf -s ${_cap}${_suffix} daemon
2>/dev/null)
[[ -n $_val ]] || continue
[[ $_val == infinity ]] && _val=unlimited