public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: "Leonidas ." <leonidas137@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Process id recycling and status of tasks
Date: Mon, 26 Oct 2009 09:41:45 +0100	[thread overview]
Message-ID: <4AE560C9.6070600@ladisch.de> (raw)
In-Reply-To: <f22d86810910241107l21159ccdx2203e2b537b7f36@mail.gmail.com>

Leonidas . wrote:
> On Fri, Oct 23, 2009 at 1:43 PM, Clemens Ladisch <clemens@ladisch.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

      parent reply	other threads:[~2009-10-26  8:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-22 13:29 Process id recycling and status of tasks Leonidas .
2009-10-23  8:13 ` Clemens Ladisch
2009-10-24 18:07   ` Leonidas .
2009-10-25 10:49     ` Leonidas .
2009-10-26  8:41     ` Clemens Ladisch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AE560C9.6070600@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=leonidas137@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox