[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4AE560C9.6070600@ladisch.de>
Date: Mon, 26 Oct 2009 09:41:45 +0100
From: Clemens Ladisch <clemens@...isch.de>
To: "Leonidas ." <leonidas137@...il.com>
CC: linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: Process id recycling and status of tasks
Leonidas . wrote:
> On Fri, Oct 23, 2009 at 1:43 PM, Clemens Ladisch <clemens@...isch.de> wrote:
> > Get a reference to the task's pid (...), then later check whether
> > pid_task() works.
>
> Was going through pid.c, what is the fundamental difference between pid_task()
> and get_pid_task()?
As I said, the functions with "get" in their name increase the reference
count. In other words, get_pid_task(p) is implemented as
get_task(pid_task(p)), so, if it succeeded, you would then own a
reference to the task.
> Now my understanding is get_pid_task() should be followed by put_pid_task()
> so the reference counting work as expected, but put_pid_task() is not an
> exported symbol?
You'd have a standard task_struct, so you'd just use put_task(). And if
you don't actually want a reference to the task (because you only want
to check whether the task still exists), just use pid_task() instead.
HTH
Clemens
--
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