[RFC,v1,05/16] sysdeps/getrlimit: Use __NR_prlimit64 if avaliable
Commit Message
If the __NR_prlimit64 syscall is avaliable let's use that instead of
__NR_ugetrlimit as it isn't always avaliable (they aren't avaliable
on RV32).
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
ChangeLog | 1 +
sysdeps/unix/sysv/linux/getrlimit.c | 4 ++++
2 files changed, 5 insertions(+)
Comments
On Sat, Jun 22, 2019 at 6:47 AM Alistair Francis
<alistair.francis@wdc.com> wrote:
> diff --git a/sysdeps/unix/sysv/linux/getrlimit.c b/sysdeps/unix/sysv/linux/getrlimit.c
> index 10c0176619..2917029afd 100644
> --- a/sysdeps/unix/sysv/linux/getrlimit.c
> +++ b/sysdeps/unix/sysv/linux/getrlimit.c
> @@ -35,7 +35,11 @@
> int
> __new_getrlimit (enum __rlimit_resource resource, struct rlimit *rlim)
> {
> +#ifdef __NR_prlimit64
> + return INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlim, NULL);
> +#else
> return INLINE_SYSCALL_CALL (ugetrlimit, resource, rlim);
> +#endif
> }
> weak_alias (__new_getrlimit, __getrlimit)
> hidden_weak (__getrlimit)
This breaks all other 32-bit architectures, since glibc traditionally uses
32-bit limits even on architectures that always supported the 64-bit
interface.
Arnd
On Sun, Jun 23, 2019 at 12:48 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Sat, Jun 22, 2019 at 6:47 AM Alistair Francis
> <alistair.francis@wdc.com> wrote:
>
> > diff --git a/sysdeps/unix/sysv/linux/getrlimit.c b/sysdeps/unix/sysv/linux/getrlimit.c
> > index 10c0176619..2917029afd 100644
> > --- a/sysdeps/unix/sysv/linux/getrlimit.c
> > +++ b/sysdeps/unix/sysv/linux/getrlimit.c
> > @@ -35,7 +35,11 @@
> > int
> > __new_getrlimit (enum __rlimit_resource resource, struct rlimit *rlim)
> > {
> > +#ifdef __NR_prlimit64
> > + return INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlim, NULL);
> > +#else
> > return INLINE_SYSCALL_CALL (ugetrlimit, resource, rlim);
> > +#endif
> > }
> > weak_alias (__new_getrlimit, __getrlimit)
> > hidden_weak (__getrlimit)
>
> This breaks all other 32-bit architectures, since glibc traditionally uses
> 32-bit limits even on architectures that always supported the 64-bit
> interface.
If we just mask out the high bits will that fix the problem?
Alistair
>
> Arnd
@@ -8,6 +8,7 @@
* sysdeps/unix/sysv/linux/wait.c: Use __NR_waitid if avaliable.
* sysdeps/unix/sysv/linux/waitpid.c: Likewise.
* sysdeps/unix/sysv/linux/waitpid_nocancel.c: Likewise.
+ * sysdeps/unix/sysv/linux/getrlimit.c: Use __NR_prlimit64 if avaliable
2019-06-20 Dmitry V. Levin <ldv@altlinux.org>
Florian Weimer <fweimer@redhat.com>
@@ -35,7 +35,11 @@
int
__new_getrlimit (enum __rlimit_resource resource, struct rlimit *rlim)
{
+#ifdef __NR_prlimit64
+ return INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlim, NULL);
+#else
return INLINE_SYSCALL_CALL (ugetrlimit, resource, rlim);
+#endif
}
weak_alias (__new_getrlimit, __getrlimit)
hidden_weak (__getrlimit)