Re: Find argument passed to running process
Re: Find argument passed to running process
- Subject: Re: Find argument passed to running process
- From: "Stephen J. Butler" <email@hidden>
- Date: Tue, 1 Sep 2009 23:38:56 -0500
On Tue, Sep 1, 2009 at 9:55 AM, Rakesh Singhal<email@hidden> wrote:
> I can find pid for any running process using code given here
> http://developer.apple.com/mac/library/qa/qa2001/qa1123.html. But I want to
> find the arguments passed to this running process, when it was launched. I
> checked the kinfo_proc structure but I could not find any thing related to
> arguments.
To actually answer the question, look at the source code for "ps":
<http://www.opensource.apple.com/source/adv_cmds/adv_cmds-119/ps.tproj/ps.c>
It calls sysctl with { CTL_KERN, KERN_PROC, what, flags } (look a
little higher up for what gets stuffed in those vars). From the
result, it then looks at "kp[i]->kp_proc->p_comm" (saveuser function).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden