Let reload_parent_cap take the new cap as agument

This commit is contained in:
Norman Feske 2012-02-18 01:42:24 +01:00
parent decfe7c4bb
commit 3ddf7d2b1b
3 changed files with 22 additions and 4 deletions

View File

@ -361,6 +361,14 @@ namespace Genode {
*/ */
~Platform_env() { parent()->exit(0); } ~Platform_env() { parent()->exit(0); }
/**
* Reload parent capability and reinitialize environment resources
*/
void reload_parent_cap(Capability<Parent>)
{
/* not supported on Linux */
}
/******************* /*******************
** Env interface ** ** Env interface **

View File

@ -154,7 +154,7 @@ namespace Genode {
* meaningful capabilities obtained via its updated parent * meaningful capabilities obtained via its updated parent
* capability. * capability.
*/ */
void reload_parent_cap(); void reload_parent_cap(Capability<Parent>);
/******************* /*******************

View File

@ -12,9 +12,10 @@
*/ */
#include <base/platform_env.h> #include <base/platform_env.h>
#include <base/crt0.h>
void Genode::Platform_env::reload_parent_cap() void Genode::Platform_env::reload_parent_cap(Capability<Parent> parent_cap)
{ {
/* /*
* This function is unused during the normal operation of Genode. It is * This function is unused during the normal operation of Genode. It is
@ -22,14 +23,23 @@ void Genode::Platform_env::reload_parent_cap()
* Noux execution environment. * Noux execution environment.
* *
* The function is called by the freshly created process right after the * The function is called by the freshly created process right after the
* fork happened. During the fork, the Noux environment is expected to have * fork happened.
* updated the '_parent_cap' of the new process.
* *
* The existing 'Platform_env' object contains capabilities that are * The existing 'Platform_env' object contains capabilities that are
* meaningful for the forking process but not the new process. Before the * meaningful for the forking process but not the new process. Before the
* the environment can be used, it must be reinitialized with the resources * the environment can be used, it must be reinitialized with the resources
* provided by the actual parent. * provided by the actual parent.
*/ */
/*
* Patch new parent capability into the original location as specified by
* the linker script.
*/
*(Capability<Parent> *)(&_parent_cap) = parent_cap;
/*
* Re-initialize 'Platform_env' members
*/
_parent_client = Parent_client(Genode::parent_cap()); _parent_client = Parent_client(Genode::parent_cap());
_resources = Resources(_parent_client); _resources = Resources(_parent_client);