diff options
| author | thorpej <thorpej@NetBSD.org> | 2021-09-20 02:20:02 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2021-09-20 02:20:02 +0000 |
| commit | ce1f7c4e8f4ee0cdcfa7972f15dfb6832fa259fd (patch) | |
| tree | 5e896d9a365575353c6597d46dabde81dbdb6fb6 /sys/compat/linux32 | |
| parent | fc6d8cac7f90286072cdb8be99ff04e905aa2efe (diff) | |
Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
Diffstat (limited to 'sys/compat/linux32')
| -rw-r--r-- | sys/compat/linux32/arch/amd64/syscalls.master | 10 | ||||
| -rw-r--r-- | sys/compat/linux32/common/linux32_misc.c | 54 |
2 files changed, 59 insertions, 5 deletions
diff --git a/sys/compat/linux32/arch/amd64/syscalls.master b/sys/compat/linux32/arch/amd64/syscalls.master index 58bba2f6273..2518892c9ff 100644 --- a/sys/compat/linux32/arch/amd64/syscalls.master +++ b/sys/compat/linux32/arch/amd64/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.74 2021/09/20 00:09:02 thorpej Exp $ + $NetBSD: syscalls.master,v 1.75 2021/09/20 02:20:03 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 --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); +} |
