diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2008-06-10 22:18:44 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2008-06-10 22:18:44 +0000 |
commit | 5e8254de24c263322968a8925d4ae111feca4c9e (patch) | |
tree | 14fef52005cae64973988478869d3932bf067f50 /exec/elfcore.c | |
parent | 68b00fd1be95b3ee5f962bf7d624c61875d8db86 (diff) |
* elfcore.c (TIME_VALUE_TO_TIMESPEC): Completely implement instead of
casting `time_value *' into `struct timeval *'.
(dump_core): Reimplement timeradd instead of casting `time_value *'
into `struct timeval *'.
Diffstat (limited to 'exec/elfcore.c')
-rw-r--r-- | exec/elfcore.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/exec/elfcore.c b/exec/elfcore.c index 0bbe7653..bf19487a 100644 --- a/exec/elfcore.c +++ b/exec/elfcore.c @@ -121,8 +121,10 @@ fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs) #endif -#define TIME_VALUE_TO_TIMESPEC(tv, ts) \ - TIMEVAL_TO_TIMESPEC ((struct timeval *) (tv), (ts)) +#define TIME_VALUE_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->seconds; \ + (ts)->tv_nsec = (tv)->microseconds * 1000; \ +} #define PAGES_TO_KB(x) ((x) * (vm_page_size / 1024)) #define ENCODE_PCT(f) ((uint16_t) ((f) * 32768.0)) @@ -380,9 +382,13 @@ dump_core (task_t task, file_t file, off_t corelimit, TIME_VALUE_TO_TIMESPEC (&pi->taskinfo.system_time, &pstatus.data.pr_stime); /* Sum the user and system time for pr_time. */ - timeradd ((const struct timeval *) &pi->taskinfo.user_time, - (const struct timeval *) &pi->taskinfo.system_time, - (struct timeval *) &pi->taskinfo.user_time); + pi->taskinfo.user_time.seconds += pi->taskinfo.system_time.seconds; + pi->taskinfo.user_time.microseconds += pi->taskinfo.system_time.microseconds; + if (pi->taskinfo.user_time.microseconds >= 1000000) + { + ++pi->taskinfo.user_time.seconds; + pi->taskinfo.user_time.microseconds -= 1000000; + } TIME_VALUE_TO_TIMESPEC (&pi->taskinfo.user_time, &psinfo.data.pr_time); /* XXX struct procinfo should have dead child info for pr_c[us]?time */ |