[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 20/49] linux-user: Implement rusage argument to w
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v6 20/49] linux-user: Implement rusage argument to waitid |
Date: |
Sat, 19 Jan 2019 08:30:53 +1100 |
The kernel interface, which we are supposed to be implementing,
takes a fifth argument: an rusage pointer akin to wait4.
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/syscall-defs.h | 2 +-
linux-user/syscall-proc.inc.c | 27 +++++++++++++++++++--------
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h
index a84050a318..f099d98fa3 100644
--- a/linux-user/syscall-defs.h
+++ b/linux-user/syscall-defs.h
@@ -119,7 +119,7 @@ SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX);
SYSCALL_DEF_FULL(vfork, .impl = impl_fork);
#endif
SYSCALL_DEF(wait4, ARG_DEC, ARG_PTR, ARG_HEX, ARG_PTR);
-SYSCALL_DEF(waitid, ARG_HEX, ARG_DEC, ARG_PTR, ARG_HEX);
+SYSCALL_DEF(waitid, ARG_HEX, ARG_DEC, ARG_PTR, ARG_HEX, ARG_PTR);
#ifdef TARGET_NR_waitpid
SYSCALL_DEF(waitpid, ARG_DEC, ARG_PTR, ARG_HEX);
#endif
diff --git a/linux-user/syscall-proc.inc.c b/linux-user/syscall-proc.inc.c
index 37f5bbe197..de4efed9f4 100644
--- a/linux-user/syscall-proc.inc.c
+++ b/linux-user/syscall-proc.inc.c
@@ -370,19 +370,30 @@ SYSCALL_IMPL(waitid)
id_t id = arg2;
abi_ulong target_info = arg3;
int options = arg4;
+ abi_ulong target_rusage = arg5;
siginfo_t info, *info_ptr = target_info ? &info : NULL;
+ struct rusage rusage;
+ struct rusage *rusage_ptr = target_rusage ? &rusage : NULL;
abi_long ret;
info.si_pid = 0;
- ret = get_errno(safe_waitid(idtype, id, info_ptr, options, NULL));
- if (!is_error(ret) && target_info && info.si_pid != 0) {
- target_siginfo_t *p = lock_user(VERIFY_WRITE, target_info,
- sizeof(target_siginfo_t), 0);
- if (!p) {
- return -TARGET_EFAULT;
+ ret = get_errno(safe_waitid(idtype, id, info_ptr, options, rusage_ptr));
+ if (!is_error(ret)) {
+ if (target_info && info.si_pid != 0) {
+ target_siginfo_t *p = lock_user(VERIFY_WRITE, target_info,
+ sizeof(target_siginfo_t), 0);
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ host_to_target_siginfo(p, &info);
+ unlock_user(p, target_info, sizeof(target_siginfo_t));
+ }
+ if (target_rusage) {
+ abi_long err = host_to_target_rusage(target_rusage, &rusage);
+ if (err) {
+ ret = err;
+ }
}
- host_to_target_siginfo(p, &info);
- unlock_user(p, target_info, sizeof(target_siginfo_t));
}
return ret;
}
--
2.17.2
- [Qemu-devel] [PATCH v6 10/49] linux-user: Split out readv, writev, (continued)
- [Qemu-devel] [PATCH v6 10/49] linux-user: Split out readv, writev, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 11/49] linux-user: Split out pread64, pwrite64, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 12/49] linux-user: Split out preadv, pwritev, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 13/49] linux-user: Split out name_to_handle_at, open_by_handle_at, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 15/49] linux-user: Split out memory syscalls, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 16/49] linux-user: Split out exit, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 17/49] linux-user: Split out brk, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 14/49] linux-user: Split out ipc syscalls, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 18/49] linux-user: Split out clone, fork, vfork, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 19/49] linux-user: Split out wait4, waitid, waitpid, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 20/49] linux-user: Implement rusage argument to waitid,
Richard Henderson <=
- [Qemu-devel] [PATCH v6 21/49] linux-user: Split out creat, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 26/49] linux-user: Split out chdir, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 22/49] linux-user: Split out link, linkat, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 24/49] linux-user: Split out execve, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 28/49] linux-user: Split out mknod, mknodat, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 25/49] linux-user: Implement execveat, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 23/49] linux-user: Split out unlink, unlinkat, rmdir, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 27/49] linux-user: Split out time, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 29/49] linux-user: Split out chmod, fchmod, fchmodat, Richard Henderson, 2019/01/18
- [Qemu-devel] [PATCH v6 30/49] linux-user: Split out lseek, llseek, Richard Henderson, 2019/01/18