ps shows wrong ppid
PATCH 1/1 ps shows wrong ppid
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 Bgetppid() for Process B shows Process A (rightly) as parent, however /proc/B/status shows Thread 3 as PPid (incorrect)
Following patch has been tested and it works ok
Regards,
Dinakar
fs/proc/array.c +1 -1
@@ -169,7 +169,7 @@ static inline char * task_state(struct tget_task_state (p), (p->sleep_avg/1024 )*100 /(1020000000 /1024 ), p->tgid, - p->pid, p->pid ? p->real_parent->pid :0 , + p->pid, p->pid ? p->group_leader->real_parent->tgid :0 , p->pid && p->ptrace ? p->parent->pid :0 , p->uid, p->euid, p->suid, p->fsuid, p->gid, p->egid, p->sgid, p->fsgid);
PATCH 1/1 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
Quoted 9 lines · Dinakar Guniguntala
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 Bgetppid()for Process B shows Process A (rightly) as parent, however/proc/B/statusshows Thread 2 as PPid (incorrect)
Quoted 6 lines
Following patch has been tested and it works ok
Regards,
Dinakar
fs/proc/array.c +1 -1
@@ -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 )