It has always bugged me that the foundation framework(or the cocoa framework for that matter) doesn't have a process manager built in. The Carbon Process Manager is nice, but it lacks 64-bit capabilities and NSWorkspace is handy, but it's lacking in how much raw information about running processes it can provide. So I decided to write my own process manager in Obj -C that is 64-bit compatible.
The source code can be downloaded here source
A few notes:
1. It isn't finished yet, so if you decide to make changes, I would appreciate it if you sent me a copy of the changes so they can be reflected in the final product.
2. I haven't provided a read me in that link, so I hope your code reading abilities are good (the method names are pretty self explanatory)
3. If you decide to use it, I would appreciate it if you didn't remove the copyright notice.
4. Processes with children may throw off methods that deal with processes by name (e.g signalProcessWithName: or processWithNameHasElevatedPrivileges:)
5. The array that contains parent pids for processes isn't really doing anything useful internally at the moment, but the information is still there if you need it
6. Currently, when sorting is enabled, each array is sorted based on its PID. I will add alphabetical sorting shortly.
warning: if you decide to add alphabetical sorting yourself make sure to take into account the fact that multiple processes can have the same name.
7. The arrays containing process info (names,pids,ppids,euids) have their elements added at the same time, meaning that the index that locates information for a given process in 1 array will be the same index for all of the other arrays. This of course, means you should never change a single array by hand unless you can guarantee that any given index will reflect information for the same process in every array.
8. In the future, process info will probably be stored in a dictionary that contains each process's name, pid, children etc etc... but for now that is not the case.
9. Feel free to leave suggestions or ideas for features.
love, eric