Re: How can i see whether a process id is alive?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 18, 2009 at 5:17 PM, Driver-Seeker
<linuxdriverforme@xxxxxxxxx> wrote:
> Hi
>
>   I have a small question...
> I have the process id of an application.. I have to verify whether that
> process is alive or not from kernel space. How can i do that? do we have any
> such API's like isAlive(pid) ? [but googling didnt give me anything:(]

What do you mean by "alive"? Runnable state? All in all, I think you
can use find_task_by_vpid() function defined in linux/sched.h. It
needs one parameter: the pid of a task you're searching for and it
will return its task struct. There, you can check the state property.

Mind you that now PID are organized under namespace to accomodate
virtualization environment and I have no idea how to deal with this
new PID namespace schema. But looking at the find_task_by_vpid()
function implementation, it is a safe bet since it will use the same
namespace as the caller.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer
blog: the-hydra.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux