plan9fox/sys
cinap_lenrek 08d6b0f043 kernel: improve diagnostics by reversing the roles of Proc.parentpid and Proc.parent
for better system diagnostics, we *ALWAYS* want to record the parent
pid of a user process, regardless of if the child will post a wait
record on exit or not.

for that, we reverse the roles of Proc.parent and Proc.parentpid so
Proc.parentpid will always be set on rfork() and the Proc.parent
pointer will point to the parent's Proc structure or is set to nil
when no wait record should be posted on exit (RFNOWAIT flag).

this means that we can get the pid of the original parent process
from /proc, regardless of the the child having rforked with the
RFNOWAIT flag. this improves the output of pstree(1) somewhat if
the parent is still alive. note that theres no guarantee that the
parent pid is still valid.

the conditions are unchanged:

a user process that will post wait record has:

up->kp == 0 && up->parent != nil && up->parent->pid == up->parentpid

the boot process is:

up->kp == 0 && up->parent == nil && up->parentpid == 0

and kproc's have:

up->kp != 0 && up->parent == nil && up->parentpid == 0
2019-12-01 17:57:14 +01:00
..
doc /sys/doc: fix mkfile to and remove files that now can be regenerated 2017-05-09 16:23:48 +02:00
games/lib add games/linden and games/turtle 2019-11-03 13:49:23 +00:00
include Add toascii() to ape 2019-09-09 16:00:06 +01:00
lib /sys/lib/plumb/basic: open nedmail windows with -noscroll 2019-10-22 08:18:20 +10:30
man os(1): add c implementation of inferno os command and cmd(3) device manpages 2019-11-30 20:10:08 +01:00
src kernel: improve diagnostics by reversing the roles of Proc.parentpid and Proc.parent 2019-12-01 17:57:14 +01:00