Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/thorpej-futex]: src/sys/compat/linux32/common Add preadv(2) and pwritev(2).
details: https://anonhg.NetBSD.org/src/rev/12f184f9d703
branches: thorpej-futex
changeset: 961138:12f184f9d703
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Jan 03 16:12:43 2021 +0000
description:
Add preadv(2) and pwritev(2).
diffstat:
sys/compat/linux32/arch/amd64/syscalls.master | 10 +++-
sys/compat/linux32/common/linux32_misc.c | 54 ++++++++++++++++++++++++++-
2 files changed, 59 insertions(+), 5 deletions(-)
diffs (96 lines):
diff -r 6fadff46c88b -r 12f184f9d703 sys/compat/linux32/arch/amd64/syscalls.master
--- a/sys/compat/linux32/arch/amd64/syscalls.master Thu Dec 17 03:14:35 2020 +0000
+++ b/sys/compat/linux32/arch/amd64/syscalls.master Sun Jan 03 16:12:43 2021 +0000
@@ -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
diff -r 6fadff46c88b -r 12f184f9d703 sys/compat/linux32/common/linux32_misc.c
--- a/sys/compat/linux32/common/linux32_misc.c Thu Dec 17 03:14:35 2020 +0000
+++ b/sys/compat/linux32/common/linux32_misc.c Sun Jan 03 16:12:43 2021 +0000
@@ -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 @@
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);
+}
Home |
Main Index |
Thread Index |
Old Index