How does ps show the argv for all processes on Mac OS X?

Posted by DNS on Stack Overflow See other posts from Stack Overflow or by DNS
Published on 2010-04-02T20:13:16Z Indexed on 2010/04/02 20:23 UTC
Read the original article Hit count: 257

Filed under:
|
|
|
|

I'm trying to identify when a particular process is running, based on its arguments, on Mac OS X. There may be several processes running with the same name, but only one will have the arguments I'm looking for. The processes are not owned by the same user who will be running my code. They will not have modified their argv in any way.

The 'ps' command shows exactly the information that I need. But I would greatly prefer not to have to spawn 'ps' and parse its output.

I originally tried the solution from this question, using sysctl, but it turns out that only works for processes you own; see my other question for more info.

So how does ps obtain argv information for processes owned by other users?

© Stack Overflow or respective owner

Related posts about ps

Related posts about mac