All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dinakar Guniguntala <dino@in.ibm.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] ps shows wrong ppid
Date: Thu, 7 Oct 2004 16:33:23 +0530	[thread overview]
Message-ID: <20041007110323.GA4503@in.ibm.com> (raw)

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

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 3 as PPid (incorrect)

Following patch has been tested and it works ok

Regards,

Dinakar

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


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

diff -Naurp linux-2.6.9-rc1-orig/fs/proc/array.c linux-2.6.9-rc1/fs/proc/array.c
--- linux-2.6.9-rc1-orig/fs/proc/array.c	2004-08-24 12:32:58.000000000 +0530
+++ linux-2.6.9-rc1/fs/proc/array.c	2004-10-07 15:33:05.465755672 +0530
@@ -169,7 +169,7 @@ static inline char * task_state(struct t
 		get_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);

             reply	other threads:[~2004-10-07 10:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-07 11:03 Dinakar Guniguntala [this message]
2004-10-19 10:31 ` [PATCH] stat shows wrong ppid Dinakar Guniguntala

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=20041007110323.GA4503@in.ibm.com \
    --to=dino@in.ibm.com \
    --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.