Module Name: src
Committed By: thorpej
Date: Sun Jan 3 16:12:44 UTC 2021
Modified Files:
src/sys/compat/linux32/arch/amd64 [thorpej-futex]: syscalls.master
src/sys/compat/linux32/common [thorpej-futex]: linux32_misc.c
Log Message:
Add preadv(2) and pwritev(2).
To generate a diff of this commit:
cvs rdiff -u -r1.71.2.2 -r1.71.2.3 \
src/sys/compat/linux32/arch/amd64/syscalls.master
cvs rdiff -u -r1.30.2.2 -r1.30.2.3 \
src/sys/compat/linux32/common/linux32_misc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/linux32/arch/amd64/syscalls.master
diff -u src/sys/compat/linux32/arch/amd64/syscalls.master:1.71.2.2 src/sys/compat/linux32/arch/amd64/syscalls.master:1.71.2.3
--- src/sys/compat/linux32/arch/amd64/syscalls.master:1.71.2.2 Thu Dec 17 03:05:32 2020
+++ src/sys/compat/linux32/arch/amd64/syscalls.master Sun Jan 3 16:12:43 2021
@@ -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
Index: src/sys/compat/linux32/common/linux32_misc.c
diff -u src/sys/compat/linux32/common/linux32_misc.c:1.30.2.2 src/sys/compat/linux32/common/linux32_misc.c:1.30.2.3
--- src/sys/compat/linux32/common/linux32_misc.c:1.30.2.2 Thu Dec 17 03:02:06 2020
+++ src/sys/compat/linux32/common/linux32_misc.c Sun Jan 3 16:12:44 2021
@@ -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>
@@ -380,3 +380,53 @@ linux32_sys_eventfd2(struct lwp *l, cons
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);
+}