Article View: news.software.nntp
Article #36483Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
From: Arthur Hagen
Date: Mon, 12 Apr 1999 00:00
Date: Mon, 12 Apr 1999 00:00
103 lines
4198 bytes
4198 bytes
In article <ylvhf2fr7c.fsf@windlord.stanford.edu>, Russ Allbery <rra@stanford.edu> writes:
> 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 rlim_cur applies to the running task, and my wild guess is that
HP-UX will only let you change the behaviour of future tasks.
I should try to fork/vfork off a few tasks to see what happens to them.
> 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.)
Doing two setrlimit calls won't help much. A small test program to
verify this:
--- cut here ---
#include <sys/resource.h> /* setrlimit */
#include <errno.h>
int main(int argc, char **argv)
{
struct rlimit rl;
puts("\nRLIMIT_DATA:");
getrlimit(RLIMIT_DATA,&rl);
printf("rlim_cur: %x\n",rl.rlim_cur);
printf("rlim_max: %x\n",rl.rlim_max);
rl.rlim_max = RLIM_INFINITY;
puts("\nsetrlimit(RLIMIT_DATA,&rl) for rlimit_max=RLIM_INFINITY:");
if (setrlimit(RLIMIT_DATA, &rl) == -1)
printf("failed: %s\n",strerror(errno));
else
puts("ok");
puts("\nRLIMIT_DATA:");
getrlimit(RLIMIT_DATA,&rl);
printf("rlim_cur: %x\n",rl.rlim_cur);
printf("rlim_max: %x\n",rl.rlim_max);
rl.rlim_cur = RLIM_INFINITY;
puts("\nsetrlimit(RLIMIT_DATA,&rl) for rlimit_cur=RLIM_INFINITY:");
if (setrlimit(RLIMIT_DATA, &rl) == -1)
printf("failed: %s\n",strerror(errno));
else
puts("ok");
puts("\nRLIMIT_DATA:");
getrlimit(RLIMIT_DATA,&rl);
printf("rlim_cur: %x\n",rl.rlim_cur);
printf("rlim_max: %x\n",rl.rlim_max);
exit(0);
}
--- cut here ---
The program output is as follows (when run as root):
RLIMIT_DATA:
rlim_cur: 4000000
rlim_max: 4000000
setrlimit(RLIMIT_DATA,&rl) for rlimit_max=RLIM_INFINITY:
ok
RLIMIT_DATA:
rlim_cur: 4000000
rlim_max: 7fffffff
setrlimit(RLIMIT_DATA,&rl) for rlimit_cur=RLIM_INFINITY:
failed: Invalid argument
RLIMIT_DATA:
rlim_cur: 4000000
rlim_max: 7fffffff
Same thing happens if you try to set both cur and max at once (as in
innstart), and with any value of rlim_cur higher than the one returned
from getrlimit. You won't be allowed to raise it in any way.
HP-UX 10.20, latest recommended patches all installed.
Regards,
--
*Art
Technical Details
Message-ID:
<fpkte7.vrm3.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-mailReferences:
<7er2ol$qtg$1@news1.guiware.com> <yllnfykc9c.fsf@windlord.stanford.edu> <hlmre7.bcs3.ln@flying.broomstick.com> <ylvhf2fr7c.fsf@windlord.stanford.edu>Show Full Headers
Complete Article Headers
Message-ID: <fpkte7.vrm3.ln@flying.broomstick.com> Subject: Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2) Date: Mon, 12 Apr 1999 00:00:00 +0000 From: art@flying.broomstick.com (Arthur Hagen) References: <7er2ol$qtg$1@news1.guiware.com> <yllnfykc9c.fsf@windlord.stanford.edu> <hlmre7.bcs3.ln@flying.broomstick.com> <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 X-Deja-AN: 465610416 X-Complaints-To: abuse@globalone.no X-Trace: bone.globalone.no 923949492 22057 194.52.172.70 (12 Apr 1999 20:38:12 GMT) Organization: Broomstick Net Services Reply-To: art@broomstick.com NNTP-Posting-Date: 12 Apr 1999 20:38:12 GMT Newsgroups: news.software.nntp