-
Ingo Molnar authored
This changes sys_getppid() to be more POSIX-threading conformant. sys_getppid() needs to return the PID of the "process' parent" (ie. the tgid of the parent thread), not the thread parent's PID. The patch has no effect on non-CLONE_THREAD users, for them current->group_leader == current. The effect on CLONE_THREAD threads is that getppid() does not return any PID within the thread group anymore. Plus if a threaded application starts up a (non-thread) child then the child sees the process PID of the parent process, not the thread PID of the parent thread. in theory we could introduce the getttid() variant to get to the TID of the parent thread, but i doubt it would be of any use. (and we can add it if the need arises.) The lockless algorithm is still safe because the ->group_leader pointer never changes asynchronously. (the ->real_parent pointer might still change asynchronously so the SMP checks are still needed.) I've also updated the comments (they referenced the nonexistent p_ooptr field.), plus i've changed the mb() to rmb() - we need to order the reads, we dont do any global writes that need some predictable ordering.
d86f4ccd