From aae30dcc048664bc219817cd69097168e2e69e13 Mon Sep 17 00:00:00 2001 From: Ulf Carlsson Date: Sat, 18 Mar 2000 09:02:17 +0000 Subject: o Add sys32_setrlimit and sys32_getrlimit ... bash# --- arch/mips64/kernel/linux32.c | 51 +++++++++++++++++++++++++++++++++++++++++- arch/mips64/kernel/scall_o32.S | 8 +++---- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/arch/mips64/kernel/linux32.c b/arch/mips64/kernel/linux32.c index 9484ed907..b8f65a7d2 100644 --- a/arch/mips64/kernel/linux32.c +++ b/arch/mips64/kernel/linux32.c @@ -1,4 +1,4 @@ -/* $Id: linux32.c,v 1.11 2000/03/17 22:42:13 kanoj Exp $ +/* $Id: linux32.c,v 1.12 2000/03/18 07:38:32 ulfc Exp $ * * Conversion between 32-bit and 64-bit native system calls. * @@ -562,3 +562,52 @@ sys32_waitpid(__kernel_pid_t32 pid, unsigned int *stat_addr, int options) return sys32_wait4(pid, stat_addr, options, NULL); } +#define RLIM_INFINITY32 0x7fffffff +#define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x) + +struct rlimit32 { + int rlim_cur; + int rlim_max; +}; + +extern asmlinkage int sys_getrlimit(unsigned int resource, struct rlimit *rlim); + +asmlinkage int +sys32_getrlimit(unsigned int resource, struct rlimit32 *rlim) +{ + struct rlimit r; + int ret; + mm_segment_t old_fs = get_fs (); + + set_fs (KERNEL_DS); + ret = sys_old_getrlimit(resource, &r); + set_fs (old_fs); + if (!ret) { + ret = put_user (RESOURCE32(r.rlim_cur), &rlim->rlim_cur); + ret |= __put_user (RESOURCE32(r.rlim_max), &rlim->rlim_max); + } + return ret; +} + +extern asmlinkage int sys_setrlimit(unsigned int resource, struct rlimit *rlim); + +asmlinkage int +sys32_setrlimit(unsigned int resource, struct rlimit32 *rlim) +{ + struct rlimit r; + int ret; + mm_segment_t old_fs = get_fs (); + + if (resource >= RLIM_NLIMITS) return -EINVAL; + if (get_user (r.rlim_cur, &rlim->rlim_cur) || + __get_user (r.rlim_max, &rlim->rlim_max)) + return -EFAULT; + if (r.rlim_cur == RLIM_INFINITY32) + r.rlim_cur = RLIM_INFINITY; + if (r.rlim_max == RLIM_INFINITY32) + r.rlim_max = RLIM_INFINITY; + set_fs (KERNEL_DS); + ret = sys_setrlimit(resource, &r); + set_fs (old_fs); + return ret; +} diff --git a/arch/mips64/kernel/scall_o32.S b/arch/mips64/kernel/scall_o32.S index ff26ad70e..a04be8b06 100644 --- a/arch/mips64/kernel/scall_o32.S +++ b/arch/mips64/kernel/scall_o32.S @@ -1,4 +1,4 @@ -/* $Id: scall_o32.S,v 1.9 2000/02/29 22:13:07 kanoj Exp $ +/* $Id: scall_o32.S,v 1.11 2000/03/17 22:42:13 kanoj Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -35,7 +35,7 @@ NESTED(handle_sys, PT_SIZE, sp) SAVE_SOME STI .set at -#if 0 +#if 1 SAVE_ALL ld a1, PT_R2(sp) PRINT("Got syscall %d\n") @@ -267,8 +267,8 @@ illegal_syscall: sys sys32_sigsuspend 0 sys sys32_sigpending 1 sys sys_sethostname 2 - sys sys_setrlimit 2 /* 4075 */ - sys sys_old_getrlimit 2 + sys sys32_setrlimit 2 /* 4075 */ + sys sys32_getrlimit 2 sys sys_getrusage 2 sys sys_gettimeofday 2 sys sys_settimeofday 2 -- cgit v1.2.3