[PATCH] getrlimit: prefer __NR_ugetrlimit over __NR_getrlimit

Enrico Scholz <[email protected]> Sun, 20 Feb 2011 16:16:42 +0100
Newsgroups gmane.linux.lib.dietlibc
Message-ID <1298215004-28546-6-git-send-email-enrico.scholz@informatik.tu-chemnitz.de>
Most architectures in the linux kernel define both __NR_ugetrlimit
and __NR_getrlimit syscalls.  The __NR_ugetrlimit syscall provides a
SuS complient getrlimit() implementation and __NR_getrlimit() an
uncompliant implementation with 2Gi limits.

The patch prefers __NR_ugetrlimit when both syscalls are available and
is required for architectures (e.g. ARM-EABI) where __NR_getrlimit
support was removed.

Signed-off-by: Enrico Scholz <[email protected]>
---
 syscalls.s/getrlimit.S |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/syscalls.s/getrlimit.S b/syscalls.s/getrlimit.S
index 1c63c01..3341add 100644
--- a/syscalls.s/getrlimit.S
+++ b/syscalls.s/getrlimit.S
@@ -1,3 +1,11 @@
 #include "syscalls.h"
 
+#ifdef __NR_ugetrlimit
+
+syscall(ugetrlimit,getrlimit)
+
+#elif defined(__NR_getrlimit)
+
 syscall(getrlimit,getrlimit)
+
+#endif
-- 
1.7.4