aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/times.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-02-18 20:57:51 +0000
committerRoland McGrath <roland@gnu.org>2002-02-18 20:57:51 +0000
commit21297437bb37c5f1aedb615fd41e93efc12f556a (patch)
tree77461c41453829cbf06db3d934f82706d0b485a2 /sysdeps/mach/hurd/times.c
parent9ce8b3c817156108b9f1a1cf12a3fa6eb4332f11 (diff)
downloadglibc-21297437bb37c5f1aedb615fd41e93efc12f556a.zip
glibc-21297437bb37c5f1aedb615fd41e93efc12f556a.tar.gz
glibc-21297437bb37c5f1aedb615fd41e93efc12f556a.tar.bz2
* sysdeps/mach/configure.in: Check for <mach/machine/ndr_def.h>
or <machine/ndr_def.h> and add -DNDR_DEF_HEADER=... to DEFINES. * sysdeps/mach/configure: Regenerated. * mach/mach_init.c [NDR_DEF_HEADER]: #include it. * hurd/hurdfault.c (_hurdsig_fault_init): Add a cast. * hurd/hurd/signal.h: Include <setjmp.h> for `jmp_buf' decl. * mach/msgserver.c (__mach_msg_server_timeout) [! MACH_RCV_LARGE]: Double MAX_SIZE and don't retry on MACH_RCV_TOO_LARGE. * sysdeps/mach/hurd/times.c [NO_CREATION_TIME] (startup_time): New static variable. [NO_CREATION_TIME] (times_init): New static function in __libc_subinit. (__times) [NO_CREATION_TIME]: Use startup_time in lieu of task creation_time from task_basic_info. (__times): Use __gettimeofday instead of __host_get_time. * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg) [! MACH_MSG_TYPE_BIT]: Use untyped Mach IPC message format. * hurd/catch-exc.c: Include <assert.h>, missing from last change.
Diffstat (limited to 'sysdeps/mach/hurd/times.c')
-rw-r--r--sysdeps/mach/hurd/times.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sysdeps/mach/hurd/times.c b/sysdeps/mach/hurd/times.c
index e232757..2065aac 100644
--- a/sysdeps/mach/hurd/times.c
+++ b/sysdeps/mach/hurd/times.c
@@ -33,6 +33,17 @@ clock_from_time_value (const time_value_t *t)
return t->seconds * 1000000 + t->microseconds;
}
+#if NO_CREATION_TIME
+static time_value_t startup_time;
+static void times_init (void) __attribute__ ((unused));
+static void
+times_init (void)
+{
+ __gettimeofday ((struct timeval *) &startup_time, NULL);
+}
+text_set_element (__libc_subinit, times_init);
+#endif
+
/* Store the CPU time used by this process and all its
dead children (and their dead children) in BUFFER.
Return the elapsed real time, or (clock_t) -1 for errors.
@@ -66,15 +77,15 @@ __times (struct tms *tms)
/* XXX This can't be implemented until getrusage(RUSAGE_CHILDREN) can be. */
tms->tms_cutime = tms->tms_cstime = 0;
- err = __host_get_time (__mach_host_self (), &now);
- if (err)
- return __hurd_fail (err);
+ if (__gettimeofday ((struct timeval *) &now, NULL) < 0)
+ return -1;
#if NO_CREATION_TIME
- return 0; /* XXX */
+# define our_creation_time startup_time
#else
- return (clock_from_time_value (&now)
- - clock_from_time_value (&bi.creation_time));
+# define our_creation_time bi.startup_time
#endif
+ return (clock_from_time_value (&now)
+ - clock_from_time_value (&our_creation_time));
}
weak_alias (__times, times)