This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC v2 09/20] sysdeps/getrlimit: Use prlimit64 if avaliable
- From: Alistair Francis <alistair dot francis at wdc dot com>
- To: libc-alpha at sourceware dot org
- Cc: arnd at arndb dot de, adhemerval dot zanella at linaro dot org, fweimer at redhat dot com, palmer at sifive dot com, macro at wdc dot com, zongbox at gmail dot com, zong at andestech dot com, alistair dot francis at wdc dot com, alistair23 at gmail dot com
- Date: Mon, 24 Jun 2019 17:09:10 -0700
- Subject: [RFC v2 09/20] sysdeps/getrlimit: Use prlimit64 if avaliable
- Ironport-sdr: R2FpMz04/sTjsX3jU4fs+ssYUa4o8Ynnfc+BCXuGvoEy/DYEk17f1ISxuEz1F55d740A4BWHFy DJ6SjtAZHNK936Q1tnZioaQ2fMjFHN5wM0fSEBux1pmNxmysWgTpjkkVIDClM1Cg+YD7UIa0dT XbpnvQQ36OWawqVTdCi366/3FmeWrEuzS68PQHfG+Mi2KxgQ5qle7qBiPTJt5f5/AvygLmlZTQ /rg38bqrcOGCwIpt5rSztqpxqmBeUESy5yUxFTpcgq6CFKQKQbYJ7ftcXQI1ezGbAgpGegXys7 YWQgA05dyw74E99yqRFyCEh6
- Ironport-sdr: uGFUSsaafGV7VfI//GflATwZ78gyZoeX4+ljnEKkh2KcfMY9kNi3ep9Ibk7A9MtGMI5DkJaPq4 tHfunHiaU2aNtkRUd//SF9Xo4G89IDXmd0i0KESd74quJ5pISxMddzk0uw7zuBFUMHjeYVPXlo u7VIGpdoX4oMgB+mfyTgE1EFnn4uooW4KPibMsTo8Z/w0UasJp49qzpguai/jgTC6MvpJvFdSe iUbedefwUmAclOoYwRpw8/x7TdHyMm1sqNJz+gZWcVgYN+1ZkfaMSLxGevCZVB3J+bJtddJyru u9A=
- References: <cover.1561421042.git.alistair.francis@wdc.com>
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 <alistair.francis@wdc.com>
---
ChangeLog | 1 +
sysdeps/unix/sysv/linux/getrlimit.c | 9 +++++++++
2 files changed, 10 insertions(+)
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 <ldv@altlinux.org>
Florian Weimer <fweimer@redhat.com>
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)
--
2.22.0