summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common
diff options
context:
space:
mode:
authortron <tron@NetBSD.org>1999-12-05 21:24:28 +0000
committertron <tron@NetBSD.org>1999-12-05 21:24:28 +0000
commitea2517e20d1633fdbf5881563ddcadfdbbe4185e (patch)
tree4a4a19aa6a041f23eef400295943fc33392ec1e0 /sys/compat/linux/common
parent5985528d02553fd357d5420db63afd5328e902a2 (diff)
Add proper stub code to make emulation of Linux's pread(2) and pwrite(2)
work. Fixes PR kern/8945 by Dave Sainty.
Diffstat (limited to 'sys/compat/linux/common')
-rw-r--r--sys/compat/linux/common/linux_file.c58
1 files changed, 57 insertions, 1 deletions
diff --git a/sys/compat/linux/common/linux_file.c b/sys/compat/linux/common/linux_file.c
index 295809e2485..355aa321e37 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.27 1999/02/09 20:37:19 christos Exp $ */
+/* $NetBSD: linux_file.c,v 1.28 1999/12/05 21:24:30 tron Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -835,3 +835,59 @@ linux_sys_fdatasync(p, v, retval)
#endif
return sys_fsync(p, v, retval);
}
+
+/*
+ * pread(2).
+ */
+int
+linux_sys_pread(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct linux_sys_pread_args /* {
+ syscallarg(int) fd;
+ syscallarg(void *) buf;
+ syscallarg(size_t) nbyte;
+ syscallarg(linux_off_t) offset;
+ } */ *uap = v;
+ struct sys_pread_args pra;
+ caddr_t sg;
+
+ sg = stackgap_init(p->p_emul);
+
+ SCARG(&pra, fd) = SCARG(uap, fd);
+ SCARG(&pra, buf) = SCARG(uap, buf);
+ SCARG(&pra, nbyte) = SCARG(uap, nbyte);
+ SCARG(&pra, offset) = SCARG(uap, offset);
+
+ return sys_read(p, &pra, retval);
+}
+
+/*
+ * pwrite(2).
+ */
+int
+linux_sys_pwrite(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct linux_sys_pwrite_args /* {
+ syscallarg(int) fd;
+ syscallarg(void *) buf;
+ syscallarg(size_t) nbyte;
+ syscallarg(linux_off_t) offset;
+ } */ *uap = v;
+ struct sys_pwrite_args pra;
+ caddr_t sg;
+
+ sg = stackgap_init(p->p_emul);
+
+ SCARG(&pra, fd) = SCARG(uap, fd);
+ SCARG(&pra, buf) = SCARG(uap, buf);
+ SCARG(&pra, nbyte) = SCARG(uap, nbyte);
+ SCARG(&pra, offset) = SCARG(uap, offset);
+
+ return sys_write(p, &pra, retval);
+}