Re: Find argument passed to running process
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=5FaxLyP3CdYATbStjqZRzEu1UTCwFALycj5UaR6qk70=; b=thcXMMtYoTvAPHihxQmRnVSsP7w70KOPp1hgwF0T/wtk000AypxxvIrxXt3to8MEet il4eVUaFE7zQn/RRn0oB0F19cxAbYC8HdO8t4vreeL92zFt7+XzU4RxZlUlC+etRJT+S WYzh8cHIyMn6EmVCpd2GHbuswY0qD+/4EvFms= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=SR9LEEnFxXxgt3Y2ee5CSeFLUnKE5VJQ9u6Aje8R79ekbUay5HDJT3GIivWN7O7/bT t8QgP+NER56h+rx7pTix7hQbjLVvW5VSgnWGxD3UAfK1T8Rd9AHZdoq7nEcdSgKjh4xo tg9QL4pUF4u1533WKa4H/j+nPt6dL1iAmEq8Y= On Tue, Sep 1, 2009 at 9:55 AM, Rakesh Singhal<rakesh.singhal@gmail.com> 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Stephen J. Butler