[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 096/108] linux-user: Split out splice, tee, vmspl
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v2 096/108] linux-user: Split out splice, tee, vmsplice |
Date: |
Sat, 9 Jun 2018 17:02:08 -1000 |
All targets define all of these; remove the ifdefs.
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/syscall.c | 117 +++++++++++++++++++++++--------------------
1 file changed, 64 insertions(+), 53 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 0c312cd156..8548f113d1 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -12075,6 +12075,39 @@ IMPL(socketpair)
}
#endif
+#ifdef CONFIG_SPLICE
+IMPL(splice)
+{
+ loff_t loff_in, loff_out;
+ loff_t *ploff_in = NULL, *ploff_out = NULL;
+ abi_long ret;
+
+ if (arg2) {
+ if (get_user_u64(loff_in, arg2)) {
+ return -TARGET_EFAULT;
+ }
+ ploff_in = &loff_in;
+ }
+ if (arg4) {
+ if (get_user_u64(loff_out, arg4)) {
+ return -TARGET_EFAULT;
+ }
+ ploff_out = &loff_out;
+ }
+ ret = get_errno(splice(arg1, ploff_in, arg3, ploff_out, arg5, arg6));
+ if (arg2) {
+ if (put_user_u64(loff_in, arg2)) {
+ return -TARGET_EFAULT;
+ }
+ }
+ if (arg4) {
+ if (put_user_u64(loff_out, arg4)) {
+ return -TARGET_EFAULT;
+ }
+ }
+ return ret;
+}
+#endif
#ifdef TARGET_NR_ssetmask
IMPL(ssetmask)
{
@@ -12324,6 +12357,13 @@ IMPL(syslog)
}
}
+#ifdef CONFIG_SPLICE
+IMPL(tee)
+{
+ return get_errno(tee(arg1, arg2, arg3, arg4));
+}
+#endif
+
IMPL(tgkill)
{
return get_errno(safe_tgkill((int)arg1, (int)arg2,
@@ -12603,6 +12643,21 @@ IMPL(vm86)
}
#endif
+#ifdef CONFIG_SPLICE
+IMPL(vmsplice)
+{
+ struct iovec *vec = lock_iovec(VERIFY_READ, arg2, arg3, 1);
+ abi_long ret;
+
+ if (vec == NULL) {
+ return -host_to_target_errno(errno);
+ }
+ ret = get_errno(vmsplice(arg1, vec, arg3, arg4));
+ unlock_iovec(vec, arg2, arg3, 0);
+ return ret;
+}
+#endif
+
IMPL(wait4)
{
int status;
@@ -12712,59 +12767,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned
num, abi_long arg1,
abi_long ret;
switch(num) {
-#ifdef CONFIG_SPLICE
-#ifdef TARGET_NR_tee
- case TARGET_NR_tee:
- {
- ret = get_errno(tee(arg1,arg2,arg3,arg4));
- }
- return ret;
-#endif
-#ifdef TARGET_NR_splice
- case TARGET_NR_splice:
- {
- loff_t loff_in, loff_out;
- loff_t *ploff_in = NULL, *ploff_out = NULL;
- if (arg2) {
- if (get_user_u64(loff_in, arg2)) {
- return -TARGET_EFAULT;
- }
- ploff_in = &loff_in;
- }
- if (arg4) {
- if (get_user_u64(loff_out, arg4)) {
- return -TARGET_EFAULT;
- }
- ploff_out = &loff_out;
- }
- ret = get_errno(splice(arg1, ploff_in, arg3, ploff_out, arg5,
arg6));
- if (arg2) {
- if (put_user_u64(loff_in, arg2)) {
- return -TARGET_EFAULT;
- }
- }
- if (arg4) {
- if (put_user_u64(loff_out, arg4)) {
- return -TARGET_EFAULT;
- }
- }
- }
- return ret;
-#endif
-#ifdef TARGET_NR_vmsplice
- case TARGET_NR_vmsplice:
- {
- struct iovec *vec = lock_iovec(VERIFY_READ, arg2, arg3, 1);
- if (vec != NULL) {
- ret = get_errno(vmsplice(arg1, vec, arg3, arg4));
- unlock_iovec(vec, arg2, arg3, 0);
- } else {
- ret = -host_to_target_errno(errno);
- }
- }
- return ret;
-#endif
-#endif /* CONFIG_SPLICE */
#ifdef CONFIG_EVENTFD
#if defined(TARGET_NR_eventfd)
case TARGET_NR_eventfd:
@@ -13800,6 +13802,9 @@ static impl_fn *syscall_table(unsigned num)
#ifdef TARGET_NR_socketpair
SYSCALL(socketpair);
#endif
+#ifdef CONFIG_SPLICE
+ SYSCALL(splice);
+#endif
#ifdef TARGET_NR_ssetmask
SYSCALL(ssetmask);
#endif
@@ -13831,6 +13836,9 @@ static impl_fn *syscall_table(unsigned num)
#endif
SYSCALL(sysinfo);
SYSCALL(syslog);
+#ifdef CONFIG_SPLICE
+ SYSCALL(tee);
+#endif
SYSCALL(tgkill);
#ifdef TARGET_NR_time
SYSCALL(time);
@@ -13867,6 +13875,9 @@ static impl_fn *syscall_table(unsigned num)
SYSCALL(vhangup);
#if defined(TARGET_I386) && !defined(TARGET_X86_64)
SYSCALL(vm86);
+#endif
+#ifdef CONFIG_SPLICE
+ SYSCALL(vmsplice);
#endif
SYSCALL(wait4);
SYSCALL(waitid);
--
2.17.1
- [Qemu-devel] [PATCH v2 086/108] linux-user: Split out gettid, readahead, (continued)
- [Qemu-devel] [PATCH v2 086/108] linux-user: Split out gettid, readahead, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 087/108] linux-user: Split out xattr syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 089/108] linux-user: Split out clock syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 090/108] linux-user: Fix clock_nanosleep, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 088/108] linux-user: Split out getdomainname, get_thread_area, set_thread_area, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 091/108] linux-user: Split out set_tid_address, tgkill, tkill, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 092/108] linux-user: Split out futex, utimensat, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 093/108] linux-user: Remove sys_futex, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 094/108] linux-user: Split out inotify syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 095/108] linux-user: Split out mq syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 096/108] linux-user: Split out splice, tee, vmsplice,
Richard Henderson <=
- [Qemu-devel] [PATCH v2 097/108] linux-user: Split out eventfd, eventfd2, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 099/108] linux-user: Split out signalfd, signalfd4, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 098/108] linux-user: Split out fallocate, sync_file_range/2, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 100/108] linux-user: Split out epoll syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 101/108] linux-user: Split out prlimit64, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 102/108] linux-user: Split out atomic_barrier, gethostname, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 103/108] linux-user: Split out atomic_cmpxchg_32, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 104/108] linux-user: Split out timer syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 105/108] linux-user: Split out timerfd syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 106/108] linux-user: Split out ioprio_get, ioprio_set, kcmp, Richard Henderson, 2018/06/09