bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with time package, struct rusage and wait3


From: Roland McGrath
Subject: Re: Problem with time package, struct rusage and wait3
Date: Wed, 1 Aug 2001 01:05:18 -0400 (EDT)

I cut down the CC list, because this has nothing to with debian.


> On Tue, Jul 31, 2001 at 03:11:00PM -0400, Roland McGrath wrote:
> > You are mistaken; sysdeps/unix/bsd/bsd4.4/wait3.c is used.
> 
> You're right. Now I definitely know that I shouldn't post any
> patches before noon.

:-)  Sorry I didn't elaborate more this morning; I didn't have time to
write much then.

There is no mystery here.  rusage has been a known missing feature for a
very long time.  It can't be done properly without microkernel changes to
support it.  As you can see in getrusage.c, the microkernel maintains the
right statistics at the task level and that's all that's needed for
RUSAGE_SELF (which is implemented).  

The problem for wait4 is that the kernel does not record these statistics
anywhere but the task data structures, and so the data is lost as soon as
the Mach task terminates.  The work in proc is quite simple: it needs to
record this info when a task dies so it can return it for proc_wait, and
add it into a sum of the parent's dead children that can be returned by a
new proc RPC that RUSAGE_CHILDREN would use.  None of that work has been
done because it is all trivial, and useless until the kernel has the
feature to notify proc.

If you are interested in adding this functionality to the kernel, that
would be great.  (It has been an item on the tasks list for a long time,
albeit with an oblique description that doesn't suggest this is what is
needed for rusage.)  But you probably should take on some other Hurd work
before tackling this.  If you do want to go at it, then talk with us about
the specifics before you get started.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]