]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Fix the pid and ppid variables in multithreaded processes.
authorNick Alcock <nick.alcock@oracle.com>
Mon, 17 Mar 2014 16:29:34 +0000 (16:29 +0000)
committerKris Van Hees <kris.van.hees@oracle.com>
Thu, 24 Apr 2014 09:32:37 +0000 (05:32 -0400)
pid is currently equal to the Linux-side PID: i.e., from userspace's
perspective, the thread ID.  tgid is equal to the thread ID of the parent.  Both
of these are at best inconvenient and at worst wrong: they should both use the
thread group ID of their respective task, which corresponds to the
userspace-visible PID.

Orabug: 18412802
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
dtrace/dtrace_dif.c

index 0d0020bb9f3ec42f2dfdd7b34a5c5f8f44025035..52816e942043103678693918958cf8be3ac85019 100644 (file)
@@ -2243,7 +2243,7 @@ static uint64_t dtrace_dif_variable(dtrace_mstate_t *mstate,
                 * It is always safe to dereference current, it always points
                 * to a valid task_struct.
                 */
-               return (uint64_t)current->pid;
+               return (uint64_t)current->tgid;
 
        case DIF_VAR_PPID:
                if (!dtrace_priv_proc(state))
@@ -2256,7 +2256,7 @@ static uint64_t dtrace_dif_variable(dtrace_mstate_t *mstate,
                 * Additionally, it is safe to dereference one's parent, since
                 * it is never NULL after process birth.
                 */
-               return (uint64_t)current->real_parent->pid;
+               return (uint64_t)current->real_parent->tgid;
 
        case DIF_VAR_TID:
                return (uint64_t)current->pid;