Adding functionality to inherit capabilities and pass capabilities as arguments.
The function 'spawn_domain_with_fdcap' was used to spawn a domain and
inherit the file descriptors of the current domain. A similar inheritance
mechanism is needed for session capabilities.
To this end, the function was renamed to 'spawn_domain_with_caps'. It no longer
expects an fdcap as one of the arguments but a CNode containing all the
capabilities, that should be inherited by the newly spawned domain. The layout
of this CNode is convention an defined in include/barrelfish/spawn_client.h.
Spawnd knows about these capabilities and copies them to the appropriate places.
For example, if the fdcap is present in the inherit CNode, spawnd copies it to
the corresponding slot in the task CNode.
Moreover, we need the ability to pass arbitrary capabilities to a domain at
startup for example to start a device driver. Spawnd does not have to know about
these capabilities. Which capabilities are passed in which order is an agreement
between spawner and spawnee. To this end, this patch adds another CNode argument
to the function 'spawn_domain_with_caps'. If a domain wants to pass certain
capabilites to another domain it therefore creates a CNode and places the
capabilities in this Cnode and the passes this CNode as an argument to
'spawn_domain_with_caps'. Spawnd makes this CNode available to the spawnee in
the ARGCN slot of the root CNode as either a CNode (if spawner and spawnee are
on the same core) or a ForeignCNode (if on different cores).
The first method of inheriting capabilities and the second method of passing
capabilities are intentionally kept as two arguments because of the following
reasons:
* To account for the difference in their handling. Spawnd knows about the
inherited capabilities and places each of them to appropriate places in the
spawnee's CSpace. As a result they are available early-on, i.e. before the
library initialization code for this domain runs.
* Putting both kinds of capabilities in a single flat CNode, would require
recompilation of the whole OS after adding a new capability, that should be
inherited.
13 files changed: