summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common/linux_file.c
diff options
context:
space:
mode:
authordsl <dsl@NetBSD.org>2007-05-12 23:02:49 +0000
committerdsl <dsl@NetBSD.org>2007-05-12 23:02:49 +0000
commit701496b5c6f310fa1320146eabe9ef149cf5cac9 (patch)
treec29d099c695547e9006c3672a7c3d053285db601 /sys/compat/linux/common/linux_file.c
parent374def6c7e14b8a7ef2c9776d4a52667238307d6 (diff)
Split the fcntl locking code out from its copyin/out.
Use to avoid all the stackgap stuff in compat code.
Diffstat (limited to 'sys/compat/linux/common/linux_file.c')
-rw-r--r--sys/compat/linux/common/linux_file.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/sys/compat/linux/common/linux_file.c b/sys/compat/linux/common/linux_file.c
index 0c8f811b5f6..72ba0ea5a53 100644
--- a/sys/compat/linux/common/linux_file.c
+++ b/sys/compat/linux/common/linux_file.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_file.c,v 1.82 2007/04/22 08:29:57 dsl Exp $ */
+/* $NetBSD: linux_file.c,v 1.83 2007/05/12 23:02:49 dsl Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.82 2007/04/22 08:29:57 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.83 2007/05/12 23:02:49 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -288,9 +288,9 @@ linux_sys_fcntl(l, v, retval)
struct proc *p = l->l_proc;
int fd, cmd, error;
u_long val;
- void *arg, *sg;
+ void *arg;
struct linux_flock lfl;
- struct flock *bfp, bfl;
+ struct flock bfl;
struct sys_fcntl_args fca;
struct filedesc *fdp;
struct file *fp;
@@ -376,19 +376,11 @@ linux_sys_fcntl(l, v, retval)
return (error);
}
case LINUX_F_GETLK:
- sg = stackgap_init(p, 0);
- bfp = (struct flock *) stackgap_alloc(p, &sg, sizeof *bfp);
if ((error = copyin(arg, &lfl, sizeof lfl)))
return error;
linux_to_bsd_flock(&lfl, &bfl);
- if ((error = copyout(&bfl, bfp, sizeof bfl)))
- return error;
- SCARG(&fca, fd) = fd;
- SCARG(&fca, cmd) = F_GETLK;
- SCARG(&fca, arg) = bfp;
- if ((error = sys_fcntl(l, &fca, retval)))
- return error;
- if ((error = copyin(bfp, &bfl, sizeof bfl)))
+ error = do_fcntl_lock(l, fd, F_GETLK, &bfl);
+ if (error)
return error;
bsd_to_linux_flock(&bfl, &lfl);
return copyout(&lfl, arg, sizeof lfl);
@@ -399,12 +391,7 @@ linux_sys_fcntl(l, v, retval)
if ((error = copyin(arg, &lfl, sizeof lfl)))
return error;
linux_to_bsd_flock(&lfl, &bfl);
- sg = stackgap_init(p, 0);
- bfp = (struct flock *) stackgap_alloc(p, &sg, sizeof *bfp);
- if ((error = copyout(&bfl, bfp, sizeof bfl)))
- return error;
- arg = (void *)bfp;
- break;
+ return do_fcntl_lock(l, fd, cmd, &bfl);
case LINUX_F_SETOWN:
case LINUX_F_GETOWN: