[<prev] [next>] [day] [month] [year] [list]
Message-ID: <f284c33d0909202228p78e8c554nd8f67493b200a5c2@mail.gmail.com>
Date: Mon, 21 Sep 2009 12:28:29 +0700
From: Mulyadi Santosa <mulyadi.santosa@...il.com>
To: Driver-Seeker <linuxdriverforme@...il.com>
Cc: kernelnewbies@...linux.org, linux-kernel@...r.kernel.org
Subject: Re: How can i see whether a process id is alive?
On Fri, Sep 18, 2009 at 5:17 PM, Driver-Seeker
<linuxdriverforme@...il.com> 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 the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists