This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: setrlimit change to prlimit change in behavior?
- From: Andreas Schwab <schwab at suse dot de>
- To: Mark Wielaard <mark at klomp dot org>
- Cc: libc-alpha at sourceware dot org, "Michael Kerrisk \(man-pages\)" <mtk dot manpages at gmail dot com>
- Date: Wed, 18 Oct 2017 16:13:39 +0200
- Subject: Re: setrlimit change to prlimit change in behavior?
- Authentication-results: sourceware.org; auth=none
- References: <1508334375.3073.9.camel@klomp.org>
On Okt 18 2017, Mark Wielaard <mark@klomp.org> wrote:
> The valgrind testsuite has a testcase that checks that
> setrlimit (RLIMIT_NOFILE, NULL)
> returns failure and sets errno to EFAULT.
In general, you cannot count on EFAULT. The call has undefined
behaviour, thus unbounded effect (a crash would be ok too). If you want
to check the effect of a syscall you have to call it directly, not via a
libc function.
> The man page http://man7.org/linux/man-pages/man2/prlimit.2.html
> doesn't really make clear what happens if both old_limit and new_limit
> are NULL. But apparently the kernel interprets that as a NOP.
Similar to sigaction, if an operand is NULL then the respective
operation is not performed, which implies that if both are NULL there is
nothing to do.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."