@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.71.2.2 2020/12/17 03:05:32 thorpej Exp $
+ $NetBSD: syscalls.master,v 1.71.2.3 2021/01/03 16:12:43 thorpej Exp $
; NetBSD i386 COMPAT_LINUX32 system call name/number "master" file.
; (See syscalls.conf to see what it is processed into.)
@@ -567,8 +567,12 @@
330 STD { int|linux32_sys||dup3(int from, int to, int flags); }
331 STD { int|linux32_sys||pipe2(netbsd32_intp fd, int flags); }
332 UNIMPL inotify_init1
-333 UNIMPL preadv
-334 UNIMPL pwritev
+333 STD { int|linux32_sys||preadv(int fd, \
+ const netbsd32_iovecp_t iovp, int iovcnt, \
+ netbsd32_u_long off_lo, netbsd32_u_long off_hi); }
+334 STD { int|linux32_sys||pwritev(int fd, \
+ const netbsd32_iovecp_t iovp, int iovcnt, \
+ netbsd32_u_long off_lo, netbsd32_u_long off_hi); }
335 UNIMPL rt_tgsigqueueinfo
336 UNIMPL perf_counter_open
337 UNIMPL recvmmsg
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_misc.c,v 1.30.2.2 2020/12/17 03:02:06 thorpej Exp $ */
+/* $NetBSD: linux32_misc.c,v 1.30.2.3 2021/01/03 16:12:44 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.30.2.2 2020/12/17 03:02:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_misc.c,v 1.30.2.3 2021/01/03 16:12:44 thorpej Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -379,4 +379,54 @@
NETBSD32TO64_UAP(flags);
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);
}