Re: Modern way of getting the list of running applications?
Re: Modern way of getting the list of running applications?
- Subject: Re: Modern way of getting the list of running applications?
- From: Stéphane Sudre <email@hidden>
- Date: Wed, 11 Jul 2007 00:17:18 +0200
On mardi, juillet 10, 2007, at 01:03 AM, Alastair Houghton wrote:
On 9 Jul 2007, at 22:16, Stéphane Sudre wrote:
Following a discussion of some utility on another mailing list, I was
wondering if there was a new modern way to get the list of running
applications without using:
- the Carbon Process Manager
- the creator / CFBundleSignature of an application
?
A 'ps' wrapper is not a solution since it does not provide accurate
information (relative path vs absolute path for instance).
At the BSD layer, you can use the KERN_PROC sysctl() to obtain a list
of kinfo_proc structs. The last time I used this method (because I
wanted to see *all* processes, not just visible applications), I think
I resorted to the Process Manager to find the bundle corresponding to
a BSD pid (i.e. GetProcessForPID(), then GetProcessBundleLocation(),
and finally FSRefMakePath() to get back to a path).
The issue with this solution (kinfo_proc) is that it's not backward and
forward compatible. I remembered giving it a try to discover that the
ps code (which was available for Mac OS X 10.3) did not compile on 10.4.
Interesting tip for the CPS SPI (I understand it's private but it's
still interesting).
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden