From patchwork Tue Jun 25 00:09:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC,v2,09/20] sysdeps/getrlimit: Use prlimit64 if avaliable X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 20152 Message-Id: <895e17d7b3fe3d689f8803a5541c75e7fdfcbd59.1561421042.git.alistair.francis@wdc.com> To: libc-alpha@sourceware.org Cc: arnd@arndb.de, adhemerval.zanella@linaro.org, fweimer@redhat.com, palmer@sifive.com, macro@wdc.com, zongbox@gmail.com, zong@andestech.com, alistair.francis@wdc.com, alistair23@gmail.com Date: Mon, 24 Jun 2019 17:09:10 -0700 From: Alistair Francis List-Id: If the prlimit64 syscall is avaliable let's use that instead of ugetrlimit as it isn't always avaliable (they aren't avaliable on RV32). Signed-off-by: Alistair Francis --- ChangeLog | 1 + sysdeps/unix/sysv/linux/getrlimit.c | 9 +++++++++ 2 files changed, 10 insertions(+) -- 2.22.0 diff --git a/ChangeLog b/ChangeLog index 9ed9bea8b1..1f1070ebc3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 Florian Weimer diff --git a/sysdeps/unix/sysv/linux/getrlimit.c b/sysdeps/unix/sysv/linux/getrlimit.c index 10c0176619..741b065b25 100644 --- a/sysdeps/unix/sysv/linux/getrlimit.c +++ b/sysdeps/unix/sysv/linux/getrlimit.c @@ -35,7 +35,16 @@ int __new_getrlimit (enum __rlimit_resource resource, struct rlimit *rlim) { +#ifdef __ASSUME_RLIM64_SYSCALLS + return INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlim, NULL); +#else +# ifdef __NR_prlimit64 + long int ret = INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlim, NULL); + if (ret == 0 || errno != ENOSYS) + return ret; +# endif return INLINE_SYSCALL_CALL (ugetrlimit, resource, rlim); +#endif } weak_alias (__new_getrlimit, __getrlimit) hidden_weak (__getrlimit)