Re: kinfo_proc structure
Re: kinfo_proc structure
- Subject: Re: kinfo_proc structure
- From: mm w <email@hidden>
- Date: Thu, 2 Jul 2009 08:33:53 -0700
- a pid is unique not a process name
- nowadays, MAXCOMLEN value can be smaller than a process name length
- firefox-bin is the real executable pointed by CFBundleExecutable
property of the info.plist (e.g Bundle)
- my application may fail for several cases. YES
mib[0] = CTL_KERN;
mib[1] = KERN_PROCARGS;
mib[2] = pid;
buff = (size_t)cmd;
if (sysctl(mib, len, cmd, &buff, NULL, 0) != -1) {
if(NULL != (copy = malloc(buff + 1))) {
strncpy(copy, cmd, buff);
}
}
THEN :
try to scan the value and try a str_startwith"" trick
if(NULL != (name = strrchr(copy, '/'))) {
name++;
} else {
name = copy;
}
my example will fail for several cases.
the only choice you have it's to bridge pid/PSN and
ProcessInformationCopyDictionary methods
I guess it's what this API does in background: to plug in the Bundle
world with the sub-system process world
http://code.google.com/p/le-depotoir/source/browse/trunk/obj-C/workspace/AUWorkspaceAddition.m
Best,
On Thu, Jul 2, 2009 at 7:29 AM, Rahulkumar
Tibdewal<email@hidden> wrote:
> Hello Again,
>
>
>
> I just noticed few things between process names and there app names.
>
> For example, firefox.app process name is i.e. kp_proc.p_comm is firefox-bin.
>
> I am just confused. If this is the case then my application may fail for
> several cases.
>
> How can I handle these cases?
>
>
>
> Thanks
>
> Rahul
>
>
>
> From: Rahulkumar Tibdewal
> Sent: Thursday, July 02, 2009 6:48 PM
> To: carbon-dev; email@hidden
> Subject: kinfo_proc structure
>
>
>
> Hello All,
>
>
>
> I have a kinfo_proc populated. I am facing 2 problems mainly.
>
>
>
> 1. This one may be simple to answer but it is giving me tough time.
>
> I want to find the user id with the associated process id. Process id is
> already available to us from kinfo_proc.
>
>
>
> 2. Another one is little wired. Once kinfo_proc is populated, one can
> think that it has been populated by all running process in the system.
>
> Whereas it misses one ccollabgui.app process. And I can see its entry from
> ps-ef. Am I missing something?
>
>
>
> Any help is highly appreciated.
>
>
>
> Thanks
>
> Rahul
>
> DISCLAIMER ========== This e-mail may contain privileged and confidential
> information which is the property of Persistent Systems Ltd. It is intended
> only for the use of the individual or entity to which it is addressed. If
> you are not the intended recipient, you are not authorized to read, retain,
> copy, print, distribute or use this message. If you have received this
> communication in error, please notify the sender and delete all copies of
> this message. Persistent Systems Ltd. does not accept any liability for
> virus infected mails.
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden