As far as I can remember the new `dc` argument added to the `mount`
system call is the only API innovation that I imported from Harvey-OS
in the Jehanne's kernel.
It's a great idea of Ronald G. Minnich, introduced at
72777a1fab
Since he didn't amended the copyright statements in Harvey, I forgot
to amend it here.
Sorry, my fault.
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
Any process X can get a new copy of the namespace of a target
process Y by writing the string "clone" to the ns file of Y.
The same user must own both processes.
The process writing the ns file must be allowed to mount.
The Pgrp of the calling process is then replaced with a new copy of
the Pgrp of the target process.
After the operation, any change done by X to its own namespace does
not affect Y. Also, if mount was forbidden for Y, it will also be
forbidden for X after the clone.