From: dhylands@gmail.com (Dave Hylands)
To: kernelnewbies@lists.kernelnewbies.org
Subject: pid_task function fails to execute
Date: Thu, 5 May 2011 07:29:34 -0700 [thread overview]
Message-ID: <BANLkTi=dxgbiLuhuO75kd8u=St7WbDHf1Q@mail.gmail.com> (raw)
In-Reply-To: <BANLkTi=NB6An1+r6mLU340JcfCjkTdVMrw@mail.gmail.com>
Hi,
On Thu, May 5, 2011 at 1:42 AM, conn intel <connintel@gmail.com> wrote:
>
> I found the issue:
>
> one has to pass arguments to pid_task as: pid_task(find_get_pid(<pid found
> using sys_getpid in userspace>) , PIDTYPE_PID);
>
> I am trying to understand how the pid value using find_get_pid function
> differs from the pid found in the userspace. It seems that they are
> different and due to that kernel get exception.
In the kernel, the pid is like a thread-id and the tgid is the process id.
In user space, the ps command shows the tgid. The /proc table also
shows the tgid. You can see all of the pids associated with a process
by looking at /proc/999/task/888
Replace 999 with tthe tgid and 888 with the pid.
ls -1 -d /proc/*/task/*
will show all of the threads running in the system
ls -1 -d /proc/*
will show all of the processes running in the system (which is what ps shows).
--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
next prev parent reply other threads:[~2011-05-05 14:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-05 6:09 pid_task function fails to execute conn intel
2011-05-05 8:42 ` conn intel
2011-05-05 14:29 ` Dave Hylands [this message]
2011-05-24 5:31 ` conn intel
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='BANLkTi=dxgbiLuhuO75kd8u=St7WbDHf1Q@mail.gmail.com' \
--to=dhylands@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).