Re: Getting the parent process name
Re: Getting the parent process name
- Subject: Re: Getting the parent process name
- From: Pascal Pochet <email@hidden>
- Date: Wed, 28 Jun 2006 22:30:53 +0200
#include <sys/types.h>
#include <unistd.h>
#include <sys/sysctl.h>
int getprocessname( pid_t inPID, char *outName, size_t inMaxLen)
{
struct kinfo_proc info;
size_t length = sizeof(struct kinfo_proc);
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, inPID };
if (sysctl(mib, 4, &info, &length, NULL, 0) < 0)
return -1 ;
else
strncpy(outName, info.kp_proc.p_comm, inMaxLen) ;
return 0 ;
}
pass getppid() as first argument…
Pascal Pochet
email@hidden
Le 27-juin-06 à 22:18, Mark Williams a écrit :
I should expand. I am trying to make sure here that the child was
actually launched by the proper app and not from something else or
the command line.
Mark.
On Jun 27, 2006, at 12:02 PM, Mark Williams wrote:
How would I go about getting the parent process name? Actually,
the grand parent's name?
Thanks,
Mark.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40fornextsoft.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden