From: Jorrit Herder Date: Wed, 1 Jun 2005 08:55:22 +0000 (+0000) Subject: Fixed minor bug in PM's child time administration. X-Git-Tag: v3.1.0~792 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=a3d2f3599310a9ad055b34bd4e63e77a52c6bf70;p=minix.git Fixed minor bug in PM's child time administration. --- diff --git a/kernel/clock.c b/kernel/clock.c index cf2a3c8a8..1a10c2240 100755 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -200,9 +200,7 @@ irq_hook_t *hook; * processing by one tick, or call the high level unnecessarily. * The variables which are changed require more care: * rp->p_user_time, rp->p_sys_time: - * These are protected by explicit locks in system.c. They are - * not properly protected in dmp.c (the increment here is not - * atomic) but that hardly matters. + * These are protected by explicit locks in system.c. * pending_ticks: * This is protected by explicit locks in clock.c. Don't * update realtime directly, since there are too many diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index 2886f2132..c44def5cd 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -77,6 +77,8 @@ PUBLIC int do_fork() rmc->mp_parent = who; /* record child's parent */ rmc->mp_flags &= (IN_USE|SEPARATE); /* inherit only these flags */ + rmc->mp_child_utime = 0; /* reset administration */ + rmc->mp_child_stime = 0; /* reset administration */ /* A separate I&D child keeps the parents text segment. The data and stack * segments must refer to the new copy. @@ -145,9 +147,9 @@ int exit_status; /* the process' exit status (for parent) */ /* Do accounting: fetch usage times and accumulate at parent. */ sys_times(proc_nr, t); - p_mp = &mproc[rmp->mp_parent]; /* process' parent */ - p_mp->mp_child_utime = t[2]; - p_mp->mp_child_stime = t[3]; + p_mp = &mproc[rmp->mp_parent]; /* process' parent */ + p_mp->mp_child_utime += t[0] + rmp->mp_child_utime; /* add user time */ + p_mp->mp_child_stime += t[1] + rmp->mp_child_stime; /* add system time */ /* Tell the kernel and FS that the process is no longer runnable. */ tell_fs(EXIT, proc_nr, 0, 0); /* file system can free the proc slot */