mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 23:42:32 +00:00
base: add reinit functionality to 'Env'
The 'reinit' and 'reinit_main_thread' methods are needed to implement fork in Noux. Until now, they were provided by the 'Deprecated_env' only.
This commit is contained in:
parent
ecf73e5b17
commit
53253ba422
@ -145,6 +145,33 @@ struct Genode::Env
|
||||
* executes this function before constructing libc components.
|
||||
*/
|
||||
virtual void exec_static_constructors() = 0;
|
||||
|
||||
/**
|
||||
* Reload parent capability and reinitialize environment resources
|
||||
*
|
||||
* This method is solely used for implementing fork in Noux. After forking
|
||||
* a process, the new child process is executed within a copy of the
|
||||
* address space of the forking process. Thereby, the new process inherits
|
||||
* the original 'env' object of the forking process, which is meaningless
|
||||
* in the context of the new process. By calling this function, the new
|
||||
* process is able to reinitialize its 'env' with meaningful capabilities
|
||||
* obtained via its updated parent capability.
|
||||
*
|
||||
* \noapi
|
||||
*/
|
||||
virtual void reinit(Native_capability::Raw) = 0;
|
||||
|
||||
/**
|
||||
* Reinitialize main-thread object
|
||||
*
|
||||
* \param stack_area_rm new region map of the stack area
|
||||
*
|
||||
* This function is solely used for implementing fork as provided by the
|
||||
* Noux environment.
|
||||
*
|
||||
* \noapi
|
||||
*/
|
||||
virtual void reinit_main_thread(Capability<Region_map> &stack_area_rm) = 0;
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__BASE__ENV_H_ */
|
||||
|
@ -99,6 +99,16 @@ namespace {
|
||||
return Genode::env_session_id_space();
|
||||
}
|
||||
|
||||
void reinit(Native_capability::Raw raw) override
|
||||
{
|
||||
Genode::env_deprecated()->reinit(raw);
|
||||
}
|
||||
|
||||
void reinit_main_thread(Capability<Region_map> &stack_area_rm) override
|
||||
{
|
||||
Genode::env_deprecated()->reinit_main_thread(stack_area_rm);
|
||||
}
|
||||
|
||||
void _block_for_session()
|
||||
{
|
||||
/*
|
||||
|
@ -56,6 +56,14 @@ struct Qt_launchpad_namespace::Local_env : Genode::Env
|
||||
void close(Parent::Client::Id id) { return genode_env.close(id); }
|
||||
|
||||
void exec_static_constructors() override { }
|
||||
|
||||
void reinit(Native_capability::Raw raw) override {
|
||||
genode_env.reinit(raw);
|
||||
}
|
||||
|
||||
void reinit_main_thread(Capability<Region_map> &stack_area_rm) override {
|
||||
genode_env.reinit_main_thread(stack_area_rm);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -161,6 +161,12 @@ class Libc::Env_implementation : public Libc::Env
|
||||
|
||||
/* already done by the libc */
|
||||
void exec_static_constructors() override { }
|
||||
|
||||
void reinit(Native_capability::Raw raw) override {
|
||||
_env.reinit(raw); }
|
||||
|
||||
void reinit_main_thread(Capability<Region_map> &stack_area_rm) override {
|
||||
_env.reinit_main_thread(stack_area_rm); }
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user