lkml.org 
[lkml]   [2004]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] stat shows wrong ppid
Hi,

One more place in fs/proc/array.c where ppid is wrong, which
I missed in my previous mail to lkml

Please apply

Regards,

Dinakar

Signed-off-by: Dinakar Guniguntala <dino@in.ibm.com>


On Thu, Oct 07, 2004 at 04:33:23PM +0530, Dinakar Guniguntala wrote:
> Hi,
>
> /proc shows the wrong PID as parent in the following case
>
> Process A creates Threads 1 & 2 (using pthread_create)
> Thread 2 then forks and execs process B
> getppid() for Process B shows Process A (rightly) as parent,
> however /proc/B/status shows Thread 2 as PPid (incorrect)
>
> Following patch has been tested and it works ok
>
> Regards,
>
> Dinakar
>
diff -Naurp linux-2.6.9-rc3-mm2.orig/fs/proc/array.c linux-2.6.9-rc3-mm2/fs/proc/array.c
--- linux-2.6.9-rc3-mm2.orig/fs/proc/array.c 2004-10-19 15:05:58.259265024 +0530
+++ linux-2.6.9-rc3-mm2/fs/proc/array.c 2004-10-19 15:09:52.474658872 +0530
@@ -370,7 +370,7 @@ static int do_task_stat(struct task_stru
stime += task->signal->stime;
}
}
- ppid = task->pid ? task->real_parent->pid : 0;
+ ppid = task->pid ? task->group_leader->real_parent->tgid : 0;
read_unlock(&tasklist_lock);

if (!whole || num_threads<2)
\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.053 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site