2003-08-09 Peter Bruin <pjbruin@dds.nl> (hurd/ChangeLog) * hurd_types.h (struct procinfo) [NO_CREATION_TIME]: New member creation_time. (libps/ChangeLog) * spec.c (ps_get_start_time) [NO_CREATION_TIME]: Get creation time from procinfo instead of task_basic_info. (ps_start_time_getter) [NO_CREATION_TIME]: Ask for PSTAT_PROC_INFO instead of PSTAT_TASK_BASIC. (proc/ChangeLog) * proc.h (struct proc) [NO_CREATION_TIME]: New member p_creation_time. * mgt.c (allocate_proc) [NO_CREATION_TIME]: Initialize p_creation_time. (utils/ChangeLog) * w.c (fetch_boot_time) [NO_CREATION_TIME]: Get creation time from proc_info instead of task_basic_info. Index: hurd/hurd_types.h =================================================================== RCS file: /cvsroot/hurd/hurd/hurd/hurd_types.h,v retrieving revision 1.46 diff -u -r1.46 hurd_types.h --- hurd/hurd_types.h 27 Jun 2002 19:19:13 -0000 1.46 +++ hurd/hurd_types.h 9 Aug 2003 12:21:47 -0000 @@ -1,5 +1,5 @@ /* C declarations for Hurd server interfaces - Copyright (C) 1993,94,95,96,98,99,2001,02 Free Software Foundation, Inc. + Copyright (C) 1993,94,95,96,98,99,2001,02,03 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -278,6 +278,9 @@ struct task_basic_info taskinfo; struct task_events_info taskevents; +#ifdef NO_CREATION_TIME + struct timeval creation_time; +#endif #ifdef TASK_SCHED_TIMESHARE_INFO struct policy_timeshare_base timeshare_base_info; #endif Index: libps/spec.c =================================================================== RCS file: /cvsroot/hurd/hurd/libps/spec.c,v retrieving revision 1.34 diff -u -r1.34 spec.c --- libps/spec.c 5 Jun 2002 01:40:49 -0000 1.34 +++ libps/spec.c 9 Aug 2003 20:01:18 -0000 @@ -1,6 +1,6 @@ /* Access, formatting, & comparison routines for printing process info. - Copyright (C) 1995,96,97,99,2001,02 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,99,2001,02,03 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.org> @@ -222,12 +222,22 @@ static void ps_get_start_time (struct proc_stat *ps, struct timeval *tv) { +#ifdef NO_CREATION_TIME + *tv = proc_stat_proc_info (ps)->creation_time; +#else time_value_t *const tvt = &proc_stat_task_basic_info (ps)->creation_time; tv->tv_sec = tvt->seconds; tv->tv_usec = tvt->microseconds; +#endif } const struct ps_getter ps_start_time_getter = -{"start_time", PSTAT_TASK_BASIC, ps_get_start_time}; +{"start_time", +#ifdef NO_CREATION_TIME + PSTAT_PROC_INFO, +#else + PSTAT_TASK_BASIC, +#endif + ps_get_start_time}; static float ps_get_rmem_frac (struct proc_stat *ps) Index: proc/info.c =================================================================== RCS file: /cvsroot/hurd/hurd/proc/info.c,v retrieving revision 1.45 diff -u -r1.45 info.c --- proc/info.c 5 Jun 2002 23:28:46 -0000 1.45 +++ proc/info.c 9 Aug 2003 19:49:33 -0000 @@ -1,5 +1,5 @@ /* Process information queries - Copyright (C) 1992,93,94,95,96,99,2000,01,02 Free Software Foundation, Inc. + Copyright (C) 1992,93,94,95,96,99,2000,01,02,03 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -462,6 +462,10 @@ pi->exitstatus = pi->sigcode = 0; pi->nthreads = nthreads; + +#ifdef NO_CREATION_TIME + pi->creation_time = p->p_creation_time; +#endif /* Release GLOBAL_LOCK around time consuming bits, and more importatantly, potential calls to P's msgport, which can block. */ Index: proc/mgt.c =================================================================== RCS file: /cvsroot/hurd/hurd/proc/mgt.c,v retrieving revision 1.66 diff -u -r1.66 mgt.c --- proc/mgt.c 9 Aug 2003 16:43:34 -0000 1.66 +++ proc/mgt.c 9 Aug 2003 19:49:35 -0000 @@ -32,6 +32,9 @@ #include <sys/resource.h> #include <hurd/auth.h> #include <assert.h> +#ifdef NO_CREATION_TIME +#include <sys/time.h> +#endif #include "proc.h" #include "process_S.h" @@ -566,6 +569,10 @@ p->p_msgport = MACH_PORT_NULL; condition_init (&p->p_wakeup); + +#ifdef NO_CREATION_TIME + gettimeofday (&p->p_creation_time, NULL); +#endif return p; } Index: proc/proc.h =================================================================== RCS file: /cvsroot/hurd/hurd/proc/proc.h,v retrieving revision 1.27 diff -u -r1.27 proc.h --- proc/proc.h 22 Dec 2001 21:00:25 -0000 1.27 +++ proc/proc.h 9 Aug 2003 19:49:35 -0000 @@ -1,5 +1,5 @@ /* Process server definitions - Copyright (C) 1992,93,94,95,96,99,2000,01 Free Software Foundation, Inc. + Copyright (C) 1992,93,94,95,96,99,2000,01,03 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -26,6 +26,9 @@ #include <sys/mman.h> #include <hurd/ports.h> #include <cthreads.h> +#ifdef NO_CREATION_TIME +#include <sys/time.h> +#endif struct proc { @@ -68,6 +71,10 @@ struct rusage p_rusage; /* my usage if I'm dead, to return via wait */ struct rusage p_child_rusage; /* accumulates p_rusage of all dead children */ + +#ifdef NO_CREATION_TIME + struct timeval p_creation_time; /* time of registration by proc server */ +#endif unsigned int p_exec:1; /* has called proc_mark_exec */ unsigned int p_stopped:1; /* has called proc_mark_stop */ Index: utils/w.c =================================================================== RCS file: /cvsroot/hurd/hurd/utils/w.c,v retrieving revision 1.30 diff -u -r1.30 w.c --- utils/w.c 28 May 2002 23:56:34 -0000 1.30 +++ utils/w.c 9 Aug 2003 20:06:05 -0000 @@ -354,9 +354,15 @@ if (err) error (3, err, "ps_context_find_proc_stat"); +#ifdef NO_CREATION_TIME + err = proc_stat_set_flags (ps, PSTAT_PROC_INFO); + if (!err && !(ps->flags & PSTAT_PROC_INFO)) + err = EGRATUITOUS; +#else err = proc_stat_set_flags (ps, PSTAT_TASK_BASIC); if (!err && !(ps->flags & PSTAT_TASK_BASIC)) err = EGRATUITOUS; +#endif if (err) { error (0, err, "cannot find boot time"); @@ -364,9 +370,13 @@ } else { +#ifdef NO_CREATION_TIME + *when = proc_stat_proc_info (ps)->creation_time; +#else time_value_t *const tv = &proc_stat_task_basic_info (ps)->creation_time; when->tv_sec = tv->seconds; when->tv_usec = tv->microseconds; +#endif } ps_context_free (context);