kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* pid_task function fails to execute
@ 2011-05-05  6:09 conn intel
  2011-05-05  8:42 ` conn intel
  0 siblings, 1 reply; 4+ messages in thread
From: conn intel @ 2011-05-05  6:09 UTC (permalink / raw)
  To: kernelnewbies

Hello friends,

I am having issue with the pid_task function with arguments first as
userspace pid (using getpid fn) and 2nd argument PIDTYPE_PID.

"pid_task(<pid from userspace>, PIDTYPE_PID);"

Can anyone assist me what can be the cause?

Have a Good Day,
Thank you,
Ankur.

*The kernel gives exception as below:*
Unable to handle kernel NULL pointer dereference at virtual address 000001dd
pgd = c7c04000
[000001dd] *pgd=779fe031, *pte=00000000, *ppte=00000000
Internal error: Oops: 1 [#1]
last sysfs file: /sys/devices/platform/i2c-gpio.1/i2c-1/1-0048/temp1_pid
<8>Modules linked in: tmp102
<8>CPU: 0 Tainted: G W (2.6.33.2 #100)
<8>PC is at pid_task+0x18/0x44
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110505/52cfcc5f/attachment.html 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* pid_task function fails to execute
  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
  0 siblings, 1 reply; 4+ messages in thread
From: conn intel @ 2011-05-05  8:42 UTC (permalink / raw)
  To: kernelnewbies

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.

Feel free to share comments.

Thank you,
Ankur.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110505/530937fc/attachment.html 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* pid_task function fails to execute
  2011-05-05  8:42 ` conn intel
@ 2011-05-05 14:29   ` Dave Hylands
  2011-05-24  5:31     ` conn intel
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Hylands @ 2011-05-05 14:29 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* pid_task function fails to execute
  2011-05-05 14:29   ` Dave Hylands
@ 2011-05-24  5:31     ` conn intel
  0 siblings, 0 replies; 4+ messages in thread
From: conn intel @ 2011-05-24  5:31 UTC (permalink / raw)
  To: kernelnewbies

On Thu, May 5, 2011 at 7:59 PM, Dave Hylands <dhylands@gmail.com> wrote:

> 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).
>
> Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110524/03740b20/attachment.html 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-24  5:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-05-24  5:31     ` conn intel

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).