Getting running time of child

Boris Kochergin spawk at acm.poly.edu
Thu Nov 19 15:12:54 UTC 2009


Koffie Yahoo wrote:
>>> I've looked but not found (and I hope I'm in the right group here): Is
>>> there a way to get the user time and system time of a /running/ child
>>> from its parent (without having to mount procfs)?
>>>       
>> If you have only one child, there's getrusage(2).
>>     
>
> Unfortunately, that only works for children that have terminated, not
> for active children. I'm interested in active children.
>
> Jay
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>   
It's not as portable as getrusage(2), but you could probably get the 
information you want using libkvm's kvm_getprocs(3) function. The 
information available is defined in the kinfo_proc structure in 
/usr/include/sys/user.h.

-Boris


More information about the freebsd-hackers mailing list