From ba40d85234e9930e27a457b1501006f521c81a8b Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 17 Sep 2015 16:10:53 +0000 Subject: [PATCH] time.c: move parser of time syscall to print_time.c * time.c (current_time_t_is_int32): Remove. (sys_time): Move ... * print_time.c: ... here. Mpersify time_t. --- print_time.c | 13 +++++++++++++ time.c | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/print_time.c b/print_time.c index bd183cc8..15f6a953 100644 --- a/print_time.c +++ b/print_time.c @@ -1,5 +1,6 @@ #include "defs.h" +#include DEF_MPERS_TYPE(time_t) #include DEF_MPERS_TYPE(timespec_t) #include DEF_MPERS_TYPE(timeval_t) @@ -65,3 +66,15 @@ MPERS_PRINTER_DECL(void, print_timeval_pair)(struct tcb *tcp, const long addr) print_timeval_t(&t[1]); tprints("]"); } + +SYS_FUNC(time) +{ + if (exiting(tcp)) { + time_t t; + + if (!umove_or_printaddr(tcp, tcp->u_arg[0], &t)) + tprintf("[%jd]", (intmax_t) t); + } + + return 0; +} diff --git a/time.c b/time.c index 48b7e19b..ce355e95 100644 --- a/time.c +++ b/time.c @@ -45,10 +45,8 @@ # else # define current_time_t_is_compat (current_wordsize == 4) # endif -# define current_time_t_is_int32 current_time_t_is_compat #else # define current_time_t_is_compat 0 -# define current_time_t_is_int32 (sizeof(time_t) == 4) #endif struct timeval32 @@ -158,17 +156,6 @@ sprint_timespec(char *buf, struct tcb *tcp, long addr) } } -SYS_FUNC(time) -{ - if (exiting(tcp)) { - if (current_time_t_is_int32) - printnum_int(tcp, tcp->u_arg[0], "%d"); - else - printnum_int64(tcp, tcp->u_arg[0], "%" PRId64); - } - return 0; -} - SYS_FUNC(gettimeofday) { if (exiting(tcp)) { -- 2.40.0