diff options
author | Ulf Carlsson <md1ulfc@mdstud.chalmers.se> | 2000-03-18 09:02:17 +0000 |
---|---|---|
committer | Ulf Carlsson <md1ulfc@mdstud.chalmers.se> | 2000-03-18 09:02:17 +0000 |
commit | aae30dcc048664bc219817cd69097168e2e69e13 (patch) | |
tree | fe50c8ba498352c90f1d390ee45b807609df7682 /arch/mips64/kernel/linux32.c | |
parent | 60a4cc79b4f42f7062d4d2b545906484e56aef84 (diff) |
o Add sys32_setrlimit and sys32_getrlimit ... bash#
Diffstat (limited to 'arch/mips64/kernel/linux32.c')
-rw-r--r-- | arch/mips64/kernel/linux32.c | 51 |
1 files changed, 50 insertions, 1 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; +} |