🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #36455

Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)

#36455
From: Russ Allbery
Date: Sun, 11 Apr 1999 00:00
40 lines
2731 bytes
Arthur Hagen <art@flying.broomstick.com> writes:

> Even with startinnfeed suid root, you'll get this error on HP-UX unless
> you've patched the source (or patched the kernel).  You can change the
> rlim_max parameter, but not the rlim_cur parameter.  So the rlim_cur
> parameter should be set to the value of getrlimit() on HP-UX.

Well, that makes no sense whatsoever.  What good does it do to raise the
hard limit if you can't raise the soft limit?  And why would an operating
system keep you from raising the soft limit when it lets you raise the
soft limit?

The man page certainly doesn't reflect this; it says:

      Each call to either getrlimit() or setrlimit() identifies a specific
      resource to be operated upon as well as a resource limit.  A
      resource limit is represented by an rlimit structure.  The rlim_cur
      member specifies the current or soft limit and the rlim_max member
      specifies the maximum or hard limit.  Soft limits may be changed by
      a process to any value that is less than or equal to the hard limit.
      A process may (irreversibly) lower its hard limit to any value that
      is greater than or equal to the soft limit.  Only a process with
      appropriate privileges can raise a hard limit.  Both hard and soft
      limits can be changed in a single call to setrlimit() subject to the
      constraints described above.

So you should be able to raise them both to INFINITY, if you're root, and
do it in the same call.  If you just raise the hard limit without raising
the soft limit, you're not actually accomplishing anything worthwhile.

Is it because you can't actually set a limit of INFINITY for file
descriptors and instead it gets set to something smaller and then the
INFINITY soft limit is higher than the hard limit?  (If so, the right fix
is to do two setrlimit() calls, the first setting the max and then the
second setting the soft limit to whatever the max ends up being.)

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>

Technical Details
Message-ID: <ylvhf2fr7c.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <7er2ol$qtg$1@news1.guiware.com> <yllnfykc9c.fsf@windlord.stanford.edu> <hlmre7.bcs3.ln@flying.broomstick.com>

Show Full Headers
Complete Article Headers
Message-ID: <ylvhf2fr7c.fsf@windlord.stanford.edu>
Subject: Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Date: Sun, 11 Apr 1999 00:00:00 +0000
From: Russ Allbery <rra@stanford.edu>
References: <7er2ol$qtg$1@news1.guiware.com> <yllnfykc9c.fsf@windlord.stanford.edu> <hlmre7.bcs3.ln@flying.broomstick.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 465329486
Organization: The Eyrie
Newsgroups: news.software.nntp