Created attachment 170590 [details]
Define RLIM_SAVED_MAX and RLIM_SAVED_CUR.
Current sys/sys/resource.h lacks definitions of RLIM_SAVED_MAX RLIM_SAVED_CUR that are defined in POSIX.
I attach my patch which can be applied to r296162 of sys/sys/resource.h.
Patch borrows code from OpenBSD's sys/sys/resource.h
Is there a consensus that the patch is the right thing to do ?
POSIX specifies that RLIM_SAVED_MAX and RLIM_SAVED_CUR can be same as RLIM_INFINITY, if all limit values are represented as rlim_t. Our rlim_t is 64-bit signed (which is already non-conforming), and e.g. RLIMIT_FSIZE file sizes larger than (1ULL<<63) cannot be represented by our rlim_t without some strength of interpretation.
The upcoming version 3.3.3 of math/R will use RLIM_SAVED_MAX and RLIM_SAVED_CUR, to check its limits.
Because this does not work on FreeBSD, an R dev temporarily builts in some conditionals to circumvent this code on FreeBSD.
Is there any chance, to get both definitions RLIM_SAVED_MAX and RLIM_SAVED_CUR in a foreseeable time into FreeBSD? Unfortunately, I have no skills in this and am not able to contribute here, sorry.
After some more consideration, I think that the patch is mostly fine. We do not allow negative rlim_t values, converting them to RLIM_INFINITY. So we can argue that all resource limit values are representable by rlim_t.
I am asking portmgr to exp-run the patch, just in case.
A commit references this bug:
Date: Tue Feb 14 17:44:30 UTC 2017
New revision: 313734
Add RLIM_SAVED_MAX and RLIM_SAVED_CUR symbols.
Define them as RLIM_INFINITY. This is allowed by POSIX in case all
resource limits are representable in an object of type rlim_t. Since
we do not allow negative rlim_t, with some strength this definition is
We are not conforming fully still because POSIX requires rlim_t to be
unsigned type. Fixing this without breaking ABI to redefine
RLIM_INFINITY is impossible.
Submitted by: email@example.com
Exp-run done by: antoine
MFC after: 2 weeks
There is a commit referencing this PR, but it's still not closed and has been inactive for some time. Closing the PR as fixed but feel free to re-open it if the issue hasn't been completely resolved.