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[1]. 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. [1] https://github.com/wch/r-source/commit/d42b03bff5b3c8f8c956542c44bbb9070d05c783
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: Author: kib Date: Tue Feb 14 17:44:30 UTC 2017 New revision: 313734 URL: https://svnweb.freebsd.org/changeset/base/313734 Log: 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 conforming. 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. PR: 209729 Submitted by: bltsrc@mail.ru Exp-run done by: antoine MFC after: 2 weeks Changes: head/sys/sys/resource.h
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. Thanks