I'm very grateful to Charles Forsyth for creating most of Jehanne's kernel
and to 9front's guys for all the code and ideas they freely share.
Here I make their copyrights explicit as they had been erroneusly omitted
or messed up before. Sorry.
While sending Tflush after a wakeup, we might call sleep.
Since the awake was not yet consumed, the new sleep was interrupted
causing a new Tflush, in an infinite loop that consumes all tags.
After sending the "clone" request to /proc/$pid/ns, the current process
will be moved to the working directory of $pid.
Otherwise the current process could still access the file and folders
on the service providing its dot, even if such service was not visible to $pid.
Also, keeping the original working directory means that the 'cd' line of the
current process's ns file would be different from that of $pid: the two ns
files must match since the command asked for a "clone".
See also https://marc.info/?l=9fans&m=150893734909969&w=2
Calling resrcwait in awake_gc_proc (that is called from pexit and thus
from sys_exits) means that we have to ignore errors that could cause
the syscall to return.
The funny part here was that one single test for newlib showed the
issue by faulting in a note handler AFTER completing with success:
/arch/amd64/qa/lib/newlib/sigchld/213-sigqueue
The fact was that in the executable, the function notifier() was
located just after the exits() function, whose last line was a call
to _exits().
Thus, when the _exits returned, the notifier() code was executed.
In _procfdprint print additional informations in the second column:
E is printed if the file was open with OCEXEC flag
D is printed if the file was open with ORCLOSE flag
Example output:
3 rE 9 46 (0000000000000001 0 00) 8192 13 /dev/cons