Re: Non-priv way to collect job stats under Intel?
Re: Non-priv way to collect job stats under Intel?
- Subject: Re: Non-priv way to collect job stats under Intel?
- From: Ed Wynne <email@hidden>
- Date: Tue, 1 Aug 2006 12:34:03 -0400
On Jul 31, 2006, at 6:19 PM, Jeffrey Johnson wrote:
We're making a universal binary of an app that calls task_for_pid
() on PPC to gather cputime
statistics on demand for its child processes and displays the stats
in a window in a ps-like
fashion. (We retrieved the source for ps and found the task_for_pid
() call).
Alas, task_for_pid has gone privileged on Intel, and since ps is
SUID root, I assume ps is still
using task_for_pid. But we can't, since we're not (and don't want
to be) run as root.
Is there another non-privileged, reasonably cheap way to collect
cputime stats for our child
processes that are still running without resorting to shelling out/
popen()ing ps? We only care about
processes owned by our UID. Wait4() is too late, because we want
incremental stats, not just the
ending stats. Our users are used to watching "das blinkenlights" :-).
Hi Jeffrey,
As long as your app is fork/exec'ing its own children you have
options. The easiest,
if you have control over the source, might be to have your children
checkin with their
parents and offer up their task port. The security gestapo can't stop
what is freely
given.
If you do not have control over the source, you can still use this
method by compiling
the checkin code as an init routine of a simple shared library file,
and getting it to run
in the client by using DYLD_INSERT_LIBRARIES.
I have some, arguably too simplistic, sample code demonstrating this
procedure at
http://www.phasic.com/~arwyn/checkin_server.c
-Ed
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden