This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setrlimit change to prlimit change in behavior?


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."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]