failure MINT_BASE_PAGE_CN "Failure minting base page CNode into root CNode",
failure MINT_SEGCN "Failure minting segment CNode into root CNode",
failure MINT_PAGECN "Failure minting page CNode into root CNode",
+ failure MINT_INHERITCN "Failure minting inherit CNode into root CNode",
// setup_vspace
failure MAP_DISPATCHER_TO_NEW "Failure mapping dispatcher frame to new domain",
struct capref src;
src.cnode = inheritcn;
- src.slot = inherit_slot;;
+ src.slot = inherit_slot;
// Create frame (actually multiple pages) for fds
struct capref dest;
return SYS_ERR_OK;
}
- err = cnode_build_cnoderef(&inheritcn, inheritcn_cap);
+ // Put inheritcn cap into root cnode so we can grab caps out of it
+ struct capref inheritcn_cncap;
+ err = slot_alloc_root(&inheritcn_cncap);
+ if (err_is_fail(err)) {
+ return err_push(err, LIB_ERR_SLOT_ALLOC);
+ }
+
+ err = cap_mint(inheritcn_cncap, inheritcn_cap, 0, 0);
+ if (err_is_fail(err)) {
+ return err_push(err, SPAWN_ERR_MINT_INHERITCN);
+ }
+
+ err = cnode_build_cnoderef(&inheritcn, inheritcn_cncap);
if (err_is_fail(err)) {
return err;
}
return err_push(err, SPAWN_ERR_SETUP_KERNEL_CAP);
}
+ /* Cleanup our copy of inheritcn */
+ err = cap_delete(inheritcn_cncap);
+ if (err_is_fail(err)) {
+ return err_push(err, LIB_ERR_CAP_DELETE);
+ }
+ err = slot_free(inheritcn_cncap);
+ if (err_is_fail(err)) {
+ return err_push(err, LIB_ERR_SLOT_FREE);
+ }
return SYS_ERR_OK;
}