summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/getrlimit.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-02-10 04:17:33 +0000
committerMike Frysinger <vapier@gentoo.org>2006-02-10 04:17:33 +0000
commitef25eef9a18839cfd26eb5810296c62e4165b631 (patch)
tree6f06384abb0034d802f5babd2e2dbc7b0af5d9c2 /libc/sysdeps/linux/common/getrlimit.c
parentc7dec4ce777a04faffdc5f36500474118f854550 (diff)
only check for rlimit stuff if the target doesnt support the newer function call, and dont bother with 64bit versions on 64bit hosts as the regular one works fine (should fix the setrlimit ltp tests)
Diffstat (limited to 'libc/sysdeps/linux/common/getrlimit.c')
-rw-r--r--libc/sysdeps/linux/common/getrlimit.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c
index 70d038a76..dfaedb3e5 100644
--- a/libc/sysdeps/linux/common/getrlimit.c
+++ b/libc/sysdeps/linux/common/getrlimit.c
@@ -7,25 +7,37 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
+#define getrlimit64 __hide_getrlimit64
#include "syscalls.h"
#include <unistd.h>
#include <sys/resource.h>
+#undef getrlimit64
libc_hidden_proto(getrlimit)
-#ifdef __NR_ugetrlimit
-# define __NR___ugetrlimit __NR_ugetrlimit
-static inline
-_syscall2(int, __ugetrlimit, enum __rlimit_resource, resource,
- struct rlimit *, rlim);
+/* Only wrap getrlimit if the new ugetrlimit is not present and getrlimit sucks */
+
+#if defined(__NR_ugetrlimit)
+
+/* just call ugetrlimit() */
+# define __NR___syscall_ugetrlimit __NR_ugetrlimit
+static always_inline
+_syscall2(int, __syscall_ugetrlimit, enum __rlimit_resource, resource,
+ struct rlimit *, rlim);
int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
{
- return (__ugetrlimit(resource, rlimits));
+ return (__syscall_ugetrlimit(resource, rlimits));
}
-#else /* __NR_ugetrlimit */
+#elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__)
+
+/* We don't need to wrap getrlimit() */
+_syscall2(int, getrlimit, __rlimit_resource_t, resource,
+ struct rlimit *, rlim);
-/* Only include the old getrlimit if the new one (ugetrlimit) is not around */
+#else
+
+/* we have to handle old style getrlimit() */
# define __NR___syscall_getrlimit __NR_getrlimit
static inline
_syscall2(int, __syscall_getrlimit, int, resource, struct rlimit *, rlim);
@@ -48,4 +60,9 @@ int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
return result;
}
#endif
+
libc_hidden_def(getrlimit)
+
+#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
+strong_alias(getrlimit, getrlimit64)
+#endif