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.
The new header envvars.h contains the names of commonly used
environment variables, such as $user, $ifs, $path and so on.
These defines are useful for Jehanne core applications that
use them to comunicate some values.
They are not strictly required, but having such defines we
can easily change the naming convention (from lowercase to uppercase).