From 556cb45061f0c89831972fc6c8554d3b108c3009 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 1 Apr 2002 10:22:31 +0000 Subject: Patch from Miles Bader to fix the spots I'd messed up. --- libc/sysdeps/linux/common/syscalls.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'libc/sysdeps/linux') diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c index 974cf5f70..d612f5da1 100644 --- a/libc/sysdeps/linux/common/syscalls.c +++ b/libc/sysdeps/linux/common/syscalls.c @@ -3,7 +3,7 @@ * Syscalls for uClibc * * Copyright (C) 2000 by Lineo, inc - * Copyright (C) 2001 by Erik Andersen + * Copyright (C) 2001, 2002 by Erik Andersen * Written by Erik Andersen * * This program is free software; you can redistribute it and/or modify it @@ -572,18 +572,20 @@ _syscall2(int, sethostname, const char *, name, size_t, len); #define __NR___setrlimit __NR_setrlimit #include #include +#define RMIN(x, y) ((x) < (y) ? (x) : (y)) _syscall2(int, __setrlimit, int, resource, const struct rlimit *, rlim); -int setrlimit (enum __rlimit_resource resource, const struct rlimit *rlimits) +int setrlimit (__rlimit_resource_t resource, const struct rlimit *rlimits) { struct rlimit rlimits_small; /* We might have to correct the limits values. Since the old values * were signed the new values might be too large. */ - rlimits_small.rlim_cur = MIN ((unsigned long int) rlimits->rlim_cur, - RLIM_INFINITY >> 1); - rlimits_small.rlim_max = MIN ((unsigned long int) rlimits->rlim_max, - RLIM_INFINITY >> 1); + rlimits_small.rlim_cur = RMIN ((unsigned long int) rlimits->rlim_cur, + RLIM_INFINITY >> 1); + rlimits_small.rlim_max = RMIN ((unsigned long int) rlimits->rlim_max, + RLIM_INFINITY >> 1); return(__setrlimit(resource, &rlimits_small)); } +#undef RMIN #endif #else /* We don't need to wrap setrlimit */ #ifdef L_setrlimit @@ -601,10 +603,10 @@ _syscall2(int, setrlimit, int, resource, const struct rlimit *, rlim); #include #include _syscall2(int, __getrlimit, int, resource, struct rlimit *, rlim); -int getrlimit (enum __rlimit_resource resource, struct rlimit *rlim) +int getrlimit (__rlimit_resource_t resource, struct rlimit *rlimits) { int result; - result = __getrlimit(resource, rlim); + result = __getrlimit(resource, rlimits); if (result == -1) return result; @@ -1446,6 +1448,7 @@ _syscall4(ssize_t,sendfile, int, out_fd, int, in_fd, __off_t *, offset, size_t, //#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ #ifdef L___ugetrlimit +#ifdef __NR_ugetrlimit #define __NR___ugetrlimit __NR_ugetrlimit #include #include @@ -1454,8 +1457,10 @@ int getrlimit (__rlimit_resource_t resource, struct rlimit *rlimits) { return(__ugetrlimit(resource, rlimits)); } +#endif /* __NR_ugetrlimit */ #endif + //#define __NR_mmap2 192 -- cgit v1.2.3