Merging Shelter & Msh › Fork actions for namespaces [fork-actions]

To interact with namespaces, Merry must fork itself. Up until now, forking was only ever used in the fork+exec model for running user programs.

Now, we do fork on every "toplevel" complete command in the shell (roughly equivalent to every line).

Eio contains a useful abstraction called fork actions -- these are non-allocating, little fragments of C-code that get called before a process calls exec to set up the environment in the child process (things like changing the directory, redirecting FDs etc.). We borrow that in void and remove the requirement to call exec. With that removed, it now becomes a way to alter the environment in a forked child that is still running the OCaml program.

For example, the main action we need is a pivot_root.

let actions =
  [ Void.Private.Fork_actions.pivot_root ~root (Context.mode ctx) ]
in

We have other support for mapping UIDs, and will need more for setting up the network, resetting the time etc.