From c28cabb17933d98c9046d4b2492e39757bbacf5a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 16 Apr 2011 01:20:21 +0200 Subject: Reorder includes and include only what is necessary Use param.h instead of MIN. Use stddef.h instead of offsetof. Signed-off-by: Peter S. Mazinger Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/setrlimit.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'libc/sysdeps/linux/common/setrlimit.c') diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c index 6817a9c92..d96700aec 100644 --- a/libc/sysdeps/linux/common/setrlimit.c +++ b/libc/sysdeps/linux/common/setrlimit.c @@ -8,8 +8,8 @@ */ #include -#include #include +#include /* Only wrap setrlimit if the new usetrlimit is not present and setrlimit sucks */ @@ -22,7 +22,7 @@ _syscall2(int, __syscall_usetrlimit, enum __rlimit_resource, resource, const struct rlimit *, rlim) int setrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) { - return (__syscall_usetrlimit(resource, rlimits)); + return __syscall_usetrlimit(resource, rlimits); } #elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__) @@ -33,6 +33,11 @@ _syscall2(int, setrlimit, __rlimit_resource_t, resource, #else +# define __need_NULL +# include +# include +# include + /* we have to handle old style setrlimit() */ # define __NR___syscall_setrlimit __NR_setrlimit static __always_inline @@ -49,16 +54,13 @@ int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits) /* We might have to correct the limits values. Since the old values * were signed the new values might be too large. */ -# define RMIN(x, y) ((x) < (y) ? (x) : (y)) - rlimits_small.rlim_cur = RMIN((unsigned long int) rlimits->rlim_cur, + rlimits_small.rlim_cur = MIN((unsigned long int) rlimits->rlim_cur, RLIM_INFINITY >> 1); - rlimits_small.rlim_max = RMIN((unsigned long int) rlimits->rlim_max, + rlimits_small.rlim_max = MIN((unsigned long int) rlimits->rlim_max, RLIM_INFINITY >> 1); -#undef RMIN - return (__syscall_setrlimit(resource, &rlimits_small)); + return __syscall_setrlimit(resource, &rlimits_small); } #endif - libc_hidden_def(setrlimit) #if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64 -- cgit v1.2.3