All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] getrlimit.2: old_getrlimit/ugetrlimit and RLIM_INFINITY discrepancies
@ 2021-07-08 12:17 Eugene Syromyatnikov
  2021-07-08 13:10 ` Jakub Wilk
  0 siblings, 1 reply; 3+ messages in thread
From: Eugene Syromyatnikov @ 2021-07-08 12:17 UTC (permalink / raw)
  To: linux-man

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
---
 man2/getrlimit.2 | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/man2/getrlimit.2 b/man2/getrlimit.2
index 648fd3c..f80c63d 100644
--- a/man2/getrlimit.2
+++ b/man2/getrlimit.2
@@ -646,6 +646,37 @@ The name of the glibc wrapper function is
 .BR prlimit ();
 the underlying system call is
 .BR prlimit64 ().
+The corresponding infinity value constant is provided in
+.I <linux/resource.h>
+as
+.BR RLIM64_INFINITY.
+.PP
+Original Linux implementation used signed types for limits; that was changed
+(along with the value of the
+.B RLIM_INFINITY
+constant)
+.\" http://repo.or.cz/davej-history.git/blobdiff/129f8758d8c41e0378ace0b6e2f56bbb8a1ec694..15305d2e69c3a838bacd78962c07077d2821f255:/include/linux/resource.h
+during 2.4 development cycle, as it wasn't compatible
+with Single UNIX Specification.
+However, in order to preserve backward compatibility, the routine
+.IR sys_old_getrlimit
+has been implemented under
+.B __NR_getrlimit
+syscall slot, with infinity checks being performed against hard-coded 0x7fffffff
+value, and the routine
+.I sys_getrlimit
+has been exposed under a new name,
+.BR ugetrlimit ().
+Note that most newer architectures don't have the latter, with
+.BR getrlimit ()
+providing proper implementation.
+Also worth noting that Several architectures decided not to change
+.B RLIM_INFINITY
+value: 32-bit mips and sparc (but not 64-bit variants, that switched
+to the new value of (~0UL)) retained the old 0x7fffffff value,
+and alpha retained 0x7ffffffffffffffful.
+.\" ...along with a request to call when one runs into it:
+.\" https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/alpha/include/uapi/asm/resource.h#n15
 .SH BUGS
 In older Linux kernels, the
 .B SIGXCPU
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] getrlimit.2: old_getrlimit/ugetrlimit and RLIM_INFINITY discrepancies
  2021-07-08 12:17 [PATCH v2] getrlimit.2: old_getrlimit/ugetrlimit and RLIM_INFINITY discrepancies Eugene Syromyatnikov
@ 2021-07-08 13:10 ` Jakub Wilk
  2021-07-29 15:24   ` Alejandro Colomar (man-pages)
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Wilk @ 2021-07-08 13:10 UTC (permalink / raw)
  To: linux-man; +Cc: Eugene Syromyatnikov

* Eugene Syromyatnikov <evgsyr@gmail.com>, 2021-07-08, 14:17:
>+Original Linux implementation used signed types for limits; that was changed
>+(along with the value of the
>+.B RLIM_INFINITY
>+constant)
>+.\" http://repo.or.cz/davej-history.git/blobdiff/129f8758d8c41e0378ace0b6e2f56bbb8a1ec694..15305d2e69c3a838bacd78962c07077d2821f255:/include/linux/resource.h
>+during 2.4 development cycle, as it wasn't compatible

Oh, interesting.

That would explain why the man page incorrectly claims the upper limit 
for RLIMIT_AS is 2 GiB on 32-bit systems.

>+Also worth noting that Several architectures decided not to change

s/Several/several/;
or maybe s/Also worth noting that //.

-- 
Jakub Wilk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] getrlimit.2: old_getrlimit/ugetrlimit and RLIM_INFINITY discrepancies
  2021-07-08 13:10 ` Jakub Wilk
@ 2021-07-29 15:24   ` Alejandro Colomar (man-pages)
  0 siblings, 0 replies; 3+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-07-29 15:24 UTC (permalink / raw)
  To: Eugene Syromyatnikov; +Cc: linux-man, Jakub Wilk

Hi Eugene,

On 7/8/21 3:10 PM, Jakub Wilk wrote:
> * Eugene Syromyatnikov <evgsyr@gmail.com>, 2021-07-08, 14:17:
>> +Original Linux implementation used signed types for limits; that was 
>> changed
>> +(along with the value of the
>> +.B RLIM_INFINITY
>> +constant)
>> +.\" 
>> http://repo.or.cz/davej-history.git/blobdiff/129f8758d8c41e0378ace0b6e2f56bbb8a1ec694..15305d2e69c3a838bacd78962c07077d2821f255:/include/linux/resource.h 
>>
>> +during 2.4 development cycle, as it wasn't compatible
> 
> Oh, interesting.
> 
> That would explain why the man page incorrectly claims the upper limit 
> for RLIMIT_AS is 2 GiB on 32-bit systems.
> 
>> +Also worth noting that Several architectures decided not to change
> 
> s/Several/several/;
> or maybe s/Also worth noting that //.
> 

When you send a v2 of this, please add me to CC or TO, so that it's 
easier for me to notice it.

Thanks,

Alex


-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-29 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 12:17 [PATCH v2] getrlimit.2: old_getrlimit/ugetrlimit and RLIM_INFINITY discrepancies Eugene Syromyatnikov
2021-07-08 13:10 ` Jakub Wilk
2021-07-29 15:24   ` Alejandro Colomar (man-pages)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.