@@ -204,6 +204,7 @@ SYSCALL_DEF(syncfs, ARG_DEC);
#ifdef TARGET_NR_time
SYSCALL_DEF(time, ARG_PTR);
#endif
+SYSCALL_DEF(times, ARG_PTR);
#ifdef TARGET_NR_umount
SYSCALL_DEF(umount, ARG_STR);
#endif
@@ -468,6 +468,31 @@ SYSCALL_IMPL(nice)
}
#endif
+SYSCALL_IMPL(times)
+{
+ abi_ulong target_buf = arg1;
+ struct tms tms;
+ abi_long ret;
+
+ ret = get_errno(times(&tms));
+ if (target_buf) {
+ struct target_tms *tmsp = lock_user(VERIFY_WRITE, target_buf,
+ sizeof(struct target_tms), 0);
+ if (!tmsp) {
+ return -TARGET_EFAULT;
+ }
+ tmsp->tms_utime = tswapal(host_to_target_clock_t(tms.tms_utime));
+ tmsp->tms_stime = tswapal(host_to_target_clock_t(tms.tms_stime));
+ tmsp->tms_cutime = tswapal(host_to_target_clock_t(tms.tms_cutime));
+ tmsp->tms_cstime = tswapal(host_to_target_clock_t(tms.tms_cstime));
+ unlock_user(tmsp, target_buf, sizeof(struct target_tms));
+ }
+ if (!is_error(ret)) {
+ ret = host_to_target_clock_t(ret);
+ }
+ return ret;
+}
+
/*
* Map host to target signal numbers for the wait family of syscalls.
* Assume all other status bits are the same.
@@ -5346,24 +5346,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
void *p;
switch(num) {
- case TARGET_NR_times:
- {
- struct target_tms *tmsp;
- struct tms tms;
- ret = get_errno(times(&tms));
- if (arg1) {
- tmsp = lock_user(VERIFY_WRITE, arg1, sizeof(struct target_tms), 0);
- if (!tmsp)
- return -TARGET_EFAULT;
- tmsp->tms_utime = tswapal(host_to_target_clock_t(tms.tms_utime));
- tmsp->tms_stime = tswapal(host_to_target_clock_t(tms.tms_stime));
- tmsp->tms_cutime = tswapal(host_to_target_clock_t(tms.tms_cutime));
- tmsp->tms_cstime = tswapal(host_to_target_clock_t(tms.tms_cstime));
- }
- if (!is_error(ret))
- ret = host_to_target_clock_t(ret);
- }
- return ret;
case TARGET_NR_acct:
if (arg1 == 0) {
ret = get_errno(acct(NULL));
@@ -1290,9 +1290,6 @@
#ifdef TARGET_NR_timerfd_settime
{ TARGET_NR_timerfd_settime, "timerfd_settime" , NULL, NULL, NULL },
#endif
-#ifdef TARGET_NR_times
-{ TARGET_NR_times, "times" , NULL, NULL, NULL },
-#endif
#ifdef TARGET_NR_tkill
{ TARGET_NR_tkill, "tkill" , NULL, print_tkill, NULL },
#endif
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- linux-user/syscall-defs.h | 1 + linux-user/syscall-proc.inc.c | 25 +++++++++++++++++++++++++ linux-user/syscall.c | 18 ------------------ linux-user/strace.list | 3 --- 4 files changed, 26 insertions(+), 21 deletions(-) -- 2.17.1