summaryrefslogtreecommitdiff
path: root/sys/compat/linux32/common/linux32_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux32/common/linux32_misc.c')
-rw-r--r--sys/compat/linux32/common/linux32_misc.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/sys/compat/linux32/common/linux32_misc.c b/sys/compat/linux32/common/linux32_misc.c
index 82f92e022e7..41dd48f12eb 100644
--- a/sys/compat/linux32/common/linux32_misc.c
+++ b/sys/compat/linux32/common/linux32_misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_misc.c,v 1.32 2021/09/20 00:09:02 thorpej Exp $ */
+/* $NetBSD: linux32_misc.c,v 1.33 2021/09/20 02:20:03 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_misc.c,v 1.32 2021/09/20 00:09:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_misc.c,v 1.33 2021/09/20 02:20:03 thorpej Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -380,3 +380,53 @@ linux32_sys_eventfd2(struct lwp *l, const struct linux32_sys_eventfd2_args *uap,
return linux_sys_eventfd2(l, &ua, retval);
}
+
+static inline off_t
+linux32_hilo_to_off_t(unsigned long hi, unsigned long lo)
+{
+ return (((off_t)hi) << 32) | lo;
+}
+
+int
+linux32_sys_preadv(struct lwp *l, const struct linux32_sys_preadv_args *uap,
+ register_t *retval)
+{
+ /* {
+ syscallarg(int) fd;
+ syscallarg(const netbsd32_iovecp_t) iovp;
+ syscallarg(int) iovcnt;
+ syscallarg(netbsd32_u_long) off_lo;
+ syscallarg(netbsd32_u_long) off_hi;
+ } */
+ struct netbsd32_preadv_args ua;
+
+ SCARG(&ua, fd) = SCARG(uap, fd);
+ SCARG(&ua, iovp) = SCARG(uap, iovp);
+ SCARG(&ua, iovcnt) = SCARG(uap, iovcnt);
+ SCARG(&ua, PAD) = 0;
+ SCARG(&ua, offset) = linux32_hilo_to_off_t(SCARG(uap, off_hi),
+ SCARG(uap, off_lo));
+ return netbsd32_preadv(l, &ua, retval);
+}
+
+int
+linux32_sys_pwritev(struct lwp *l, const struct linux32_sys_pwritev_args *uap,
+ register_t *retval)
+{
+ /* {
+ syscallarg(int) fd;
+ syscallarg(const netbsd32_iovecp_t) iovp;
+ syscallarg(int) iovcnt;
+ syscallarg(netbsd32_u_long) off_lo;
+ syscallarg(netbsd32_u_long) off_hi;
+ } */
+ struct netbsd32_pwritev_args ua;
+
+ SCARG(&ua, fd) = SCARG(uap, fd);
+ SCARG(&ua, iovp) = SCARG(uap, iovp);
+ SCARG(&ua, iovcnt) = SCARG(uap, iovcnt);
+ SCARG(&ua, PAD) = 0;
+ SCARG(&ua, offset) = linux32_hilo_to_off_t(SCARG(uap, off_hi),
+ SCARG(uap, off_lo));
+ return netbsd32_pwritev(l, &ua, retval);
+}