All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dinakar Guniguntala <dino@in.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>,
	Albert Cahalan <albert@users.sourceforge.net>
Subject: [PATCH] stat shows wrong ppid
Date: Tue, 19 Oct 2004 16:01:20 +0530	[thread overview]
Message-ID: <20041019103120.GA4490@in.ibm.com> (raw)
In-Reply-To: <20041007110323.GA4503@in.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

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
> 

[-- Attachment #2: stat.patch --]
[-- Type: text/plain, Size: 527 bytes --]

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)

      reply	other threads:[~2004-10-19 10:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-07 11:03 [PATCH] ps shows wrong ppid Dinakar Guniguntala
2004-10-19 10:31 ` Dinakar Guniguntala [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=20041019103120.GA4490@in.ibm.com \
    --to=dino@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=albert@users.sourceforge.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.