summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common/linux_misc.c
diff options
context:
space:
mode:
authordsl <dsl@NetBSD.org>2007-05-12 21:07:02 +0000
committerdsl <dsl@NetBSD.org>2007-05-12 21:07:02 +0000
commit8beba9d093587d883cd696f665d83fdadb4718f4 (patch)
tree4e77a22ecdd9f77ec98c07ba3755457379ae1ad1 /sys/compat/linux/common/linux_misc.c
parent058554bbc481c4923cf9b10c02cc3bf5fa98f666 (diff)
There is no need to use the stackgap for get/setrlimit.
Diffstat (limited to 'sys/compat/linux/common/linux_misc.c')
-rw-r--r--sys/compat/linux/common/linux_misc.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c
index 7ab86e4efae..79d4ae0cd77 100644
--- a/sys/compat/linux/common/linux_misc.c
+++ b/sys/compat/linux/common/linux_misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.c,v 1.175 2007/05/10 21:30:15 christos Exp $ */
+/* $NetBSD: linux_misc.c,v 1.176 2007/05/12 21:07:02 dsl Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.175 2007/05/10 21:30:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.176 2007/05/12 21:07:02 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ptrace.h"
@@ -1550,26 +1550,18 @@ linux_sys_getrlimit(l, v, retval)
syscallarg(struct orlimit *) rlp;
# endif
} */ *uap = v;
- struct proc *p = l->l_proc;
- void *sg = stackgap_init(p, 0);
- struct sys_getrlimit_args ap;
- struct rlimit rl;
# ifdef LINUX_LARGEFILE64
struct rlimit orl;
# else
struct orlimit orl;
# endif
- int error;
+ int which;
- SCARG(&ap, which) = linux_to_bsd_limit(SCARG(uap, which));
- if ((error = SCARG(&ap, which)) < 0)
- return -error;
- SCARG(&ap, rlp) = stackgap_alloc(p, &sg, sizeof rl);
- if ((error = sys_getrlimit(l, &ap, retval)) != 0)
- return error;
- if ((error = copyin(SCARG(&ap, rlp), &rl, sizeof(rl))) != 0)
- return error;
- bsd_to_linux_rlimit(&orl, &rl);
+ which = linux_to_bsd_limit(SCARG(uap, which));
+ if (which < 0)
+ return -which;
+
+ bsd_to_linux_rlimit(&orl, &l->l_proc->p_rlimit[which]);
return copyout(&orl, SCARG(uap, rlp), sizeof(orl));
}
@@ -1588,9 +1580,6 @@ linux_sys_setrlimit(l, v, retval)
syscallarg(struct orlimit *) rlp;
# endif
} */ *uap = v;
- struct proc *p = l->l_proc;
- void *sg = stackgap_init(p, 0);
- struct sys_getrlimit_args ap;
struct rlimit rl;
# ifdef LINUX_LARGEFILE64
struct rlimit orl;
@@ -1598,17 +1587,17 @@ linux_sys_setrlimit(l, v, retval)
struct orlimit orl;
# endif
int error;
+ int which;
- SCARG(&ap, which) = linux_to_bsd_limit(SCARG(uap, which));
- SCARG(&ap, rlp) = stackgap_alloc(p, &sg, sizeof rl);
- if ((error = SCARG(&ap, which)) < 0)
- return -error;
if ((error = copyin(SCARG(uap, rlp), &orl, sizeof(orl))) != 0)
return error;
+
+ which = linux_to_bsd_limit(SCARG(uap, which));
+ if (which < 0)
+ return -which;
+
linux_to_bsd_rlimit(&rl, &orl);
- if ((error = copyout(&rl, SCARG(&ap, rlp), sizeof(rl))) != 0)
- return error;
- return sys_setrlimit(l, &ap, retval);
+ return dosetrlimit(l, l->l_proc, which, &rl);
}
# if !defined(__mips__) && !defined(__amd64__)