开发者

List of all running processes

How can I get a list of the names of all currently running pr开发者_JAVA技巧ocesses? (In C/Objective-C on Mac OS X.)


Cocoa processes can be retrieved from NSWorkspace

[[NSWorkspace sharedWorkspace] runningApplications]

For the entire process list (i.e. including non graphical) see Technical Q&A QA1123


A simple google search yielded the following result for me :

http://jongampark.wordpress.com/2008/01/26/a-simple-objectie-c-class-for-checking-if-a-specific-process-is-running/

Notice this goes even further and adds a function to search for a running process.


I know you can do this on unix like systems. In the directory /proc are directories which stand for every process. In those directories you have a file called cmdline which hold the command line who started this process.

I don't know if this is the same on Mac OS X, but you can go further with that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜