Re: Non-priv way to collect job stats under Intel?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Jul 31, 2006, at 6:19 PM, Jeffrey Johnson wrote: Hi Jeffrey, -Ed _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... 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" :-). 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 This email sent to site_archiver@lists.apple.com
participants (1)
-
Ed Wynne