Re: sysctl semantics for KERN_PROC_PID
Re: sysctl semantics for KERN_PROC_PID
- Subject: Re: sysctl semantics for KERN_PROC_PID
- From: "A.M." <email@hidden>
- Date: Thu, 29 Jan 2009 14:04:08 -0500
On Jan 29, 2009, at 1:50 PM, Rohitash Panda wrote:
Hi,
I am trying to check the existence of a process through sysctl
( CTL_KERN ) . I am using the below construct :
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[3] = pid;
sysctl(mib, 4, &kp, &len, NULL, 0);
In the case that the pid is not around , what's the documented
return value for sysctl , -1 or 0 , for Mac OS X 10.5 ? Is the
behaviour same for Mac OS X 10.4 too ?
Hello,
Just use
if(kill(somePid,0)==0)
{
//process for pid is running
}
You have a
man 2 kill
Cheers,
M
_______________________________________________
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