|Summary:||Defining RLIM_SAVED_MAX and RLIM_SAVED_CUR in sys/sys/resource.h according to POSIX.|
|Product:||Base System||Reporter:||Bulat <bltsrc>|
|Component:||standards||Assignee:||freebsd-standards (Nobody) <standards>|
|Severity:||Affects Many People||CC:||gonzo, kib, rhurlin|
Description Bulat 2016-05-24 08:00:11 UTC
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
Comment 1 Konstantin Belousov 2016-05-26 06:38:53 UTC
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.
Comment 2 Rainer Hurling 2017-02-09 15:48:56 UTC
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.  https://github.com/wch/r-source/commit/d42b03bff5b3c8f8c956542c44bbb9070d05c783
Comment 3 Konstantin Belousov 2017-02-10 15:32:49 UTC
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.
Comment 4 commit-hook 2017-02-14 17:44:37 UTC
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: firstname.lastname@example.org Exp-run done by: antoine MFC after: 2 weeks Changes: head/sys/sys/resource.h
Comment 5 Oleksandr Tymoshenko 2019-01-21 18:51:57 UTC
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