Turn 'platform_env.h' into a private header

This patch removes 'platform_env.h' from the public API headers because
this header was not part of the API anyway.
This commit is contained in:
Norman Feske 2013-02-13 21:46:19 +01:00
parent cb225a1216
commit b1f63e3356
17 changed files with 49 additions and 37 deletions

View File

@ -2,6 +2,7 @@ SRC_CC = env.cc context_area.cc cap_map.cc cap_alloc.cc \
reload_parent_cap.cc spin_lock.cc cap_map_remove.cc reload_parent_cap.cc spin_lock.cc cap_map_remove.cc
LIBS = ipc heap log_console lock LIBS = ipc heap log_console lock
INC_DIR += $(REP_DIR)/src/base/lock $(BASE_DIR)/src/base/lock INC_DIR += $(REP_DIR)/src/base/lock $(BASE_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/env
vpath env.cc $(BASE_DIR)/src/base/env vpath env.cc $(BASE_DIR)/src/base/env
vpath context_area.cc $(BASE_DIR)/src/base/env vpath context_area.cc $(BASE_DIR)/src/base/env

View File

@ -1,5 +1,6 @@
SRC_CC = env.cc parent.cc context_area.cc SRC_CC = env.cc parent.cc context_area.cc
LIBS = ipc heap lock log_console LIBS = ipc heap lock log_console
INC_DIR += $(BASE_DIR)/src/base/env
vpath env.cc $(BASE_DIR)/src/base/env vpath env.cc $(BASE_DIR)/src/base/env
vpath context_area.cc $(BASE_DIR)/src/base/env vpath context_area.cc $(BASE_DIR)/src/base/env

View File

@ -1,5 +1,6 @@
SRC_CC = env.cc rm_session_mmap.cc platform_env.cc debug.cc context_area.cc SRC_CC = env.cc rm_session_mmap.cc platform_env.cc debug.cc context_area.cc
LIBS = ipc heap log_console lock syscall LIBS = ipc heap log_console lock syscall
INC_DIR += $(REP_DIR)/src/base/env
vpath env.cc $(BASE_DIR)/src/base/env vpath env.cc $(BASE_DIR)/src/base/env
vpath context_area.cc $(BASE_DIR)/src/base/env vpath context_area.cc $(BASE_DIR)/src/base/env

View File

@ -11,18 +11,18 @@
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
*/ */
/* Genode includes */
#include <util/arg_string.h> #include <util/arg_string.h>
#include <base/platform_env.h>
#include <base/thread.h> #include <base/thread.h>
#include <linux_dataspace/client.h> #include <linux_dataspace/client.h>
#include <linux_syscalls.h> #include <linux_syscalls.h>
/* local includes */
#include <platform_env.h>
using namespace Genode; using namespace Genode;
/**************************************************** /****************************************************
** Support for Platform_env_base::Rm_session_mmap ** ** Support for Platform_env_base::Rm_session_mmap **
****************************************************/ ****************************************************/

View File

@ -11,11 +11,14 @@
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
*/ */
#include <base/platform_env.h> /* Genode includes */
#include <base/thread.h> #include <base/thread.h>
#include <linux_dataspace/client.h> #include <linux_dataspace/client.h>
#include <linux_syscalls.h> #include <linux_syscalls.h>
/* local includes */
#include <platform_env.h>
using namespace Genode; using namespace Genode;

View File

@ -18,15 +18,15 @@
#ifndef _CORE__INCLUDE__CORE_ENV_H_ #ifndef _CORE__INCLUDE__CORE_ENV_H_
#define _CORE__INCLUDE__CORE_ENV_H_ #define _CORE__INCLUDE__CORE_ENV_H_
/* Genode includes */
#include <base/platform_env.h>
/* core includes */ /* core includes */
#include <platform.h> #include <platform.h>
#include <core_parent.h> #include <core_parent.h>
#include <cap_session_component.h> #include <cap_session_component.h>
#include <ram_session_component.h> #include <ram_session_component.h>
/* internal base includes */
#include <platform_env.h>
namespace Genode { namespace Genode {
@ -195,6 +195,8 @@ namespace Genode {
PWRN("%s:%u not implemented", __FILE__, __LINE__); PWRN("%s:%u not implemented", __FILE__, __LINE__);
return 0; return 0;
} }
void reload_parent_cap(Capability<Parent>::Dst, long) { }
}; };

View File

@ -27,7 +27,8 @@ SRC_CC = main.cc \
INC_DIR += $(REP_DIR)/src/core/include \ INC_DIR += $(REP_DIR)/src/core/include \
$(GEN_CORE_DIR)/include \ $(GEN_CORE_DIR)/include \
$(REP_DIR)/src/platform \ $(REP_DIR)/src/platform \
$(REP_DIR)/src/base/ipc $(REP_DIR)/src/base/ipc \
$(REP_DIR)/src/base/env
HOST_INC_DIR += /usr/include HOST_INC_DIR += /usr/include

View File

@ -1,6 +1,7 @@
SRC_CC = env.cc cap_sel_alloc.cc main_thread.cc context_area.cc \ SRC_CC = env.cc cap_sel_alloc.cc main_thread.cc context_area.cc \
reload_parent_cap.cc reload_parent_cap.cc
LIBS = ipc heap lock log_console LIBS = ipc heap lock log_console
INC_DIR += $(BASE_DIR)/src/base/env
vpath env.cc $(BASE_DIR)/src/base/env vpath env.cc $(BASE_DIR)/src/base/env
vpath cap_sel_alloc.cc $(REP_DIR)/src/base/env vpath cap_sel_alloc.cc $(REP_DIR)/src/base/env

View File

@ -63,6 +63,8 @@ class Minimal_env : public Genode::Env
return Genode::Ram_session_capability(); } return Genode::Ram_session_capability(); }
Genode::Cpu_session_capability cpu_session_cap() { Genode::Cpu_session_capability cpu_session_cap() {
return Genode::Cpu_session_capability(); } return Genode::Cpu_session_capability(); }
void reload_parent_cap(Genode::Capability<Genode::Parent>::Dst, long) { }
}; };

View File

@ -70,10 +70,23 @@ namespace Genode {
virtual Pd_session *pd_session() = 0; virtual Pd_session *pd_session() = 0;
/** /**
* Heap backed by the ram_session of the * Heap backed by the ram_session of the environment.
* environment.
*/ */
virtual Allocator *heap() = 0; virtual Allocator *heap() = 0;
/**
* Reload parent capability and reinitialize environment resources
*
* This function is solely used for implementing fork semantics.
* 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.
*/
virtual void reload_parent_cap(Capability<Parent>::Dst, long) = 0;
}; };
extern Env *env(); extern Env *env();

View File

@ -1,5 +1,6 @@
SRC_CC = env.cc context_area.cc reload_parent_cap.cc SRC_CC = env.cc context_area.cc reload_parent_cap.cc
LIBS = ipc heap log_console lock LIBS = ipc heap log_console lock
INC_DIR += $(BASE_DIR)/src/base/env
vpath env.cc $(REP_DIR)/src/base/env vpath env.cc $(REP_DIR)/src/base/env
vpath context_area.cc $(BASE_DIR)/src/base/env vpath context_area.cc $(BASE_DIR)/src/base/env

View File

@ -12,7 +12,7 @@
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
*/ */
#include <base/platform_env.h> #include <platform_env.h>
namespace Genode { namespace Genode {

View File

@ -202,19 +202,6 @@ namespace Genode {
_initial_junk, sizeof(_initial_junk)) _initial_junk, sizeof(_initial_junk))
{ } { }
/**
* Reload parent capability and reinitialize environment resources
*
* This function is solely used for implementing fork semantics.
* 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 'Platform_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 'Platform_env' with
* meaningful capabilities obtained via its updated parent
* capability.
*/
void reload_parent_cap(Native_capability::Dst, long); void reload_parent_cap(Native_capability::Dst, long);

View File

@ -11,7 +11,7 @@
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
*/ */
#include <base/platform_env.h> #include <platform_env.h>
#include <base/crt0.h> #include <base/crt0.h>

View File

@ -163,7 +163,6 @@ namespace Genode {
return 0; return 0;
} }
Cpu_session_capability cpu_session_cap() { Cpu_session_capability cpu_session_cap() {
PWRN("%s:%u not implemented", __FILE__, __LINE__); PWRN("%s:%u not implemented", __FILE__, __LINE__);
return Cpu_session_capability(); return Cpu_session_capability();
@ -174,6 +173,8 @@ namespace Genode {
PWRN("%s:%u not implemented", __FILE__, __LINE__); PWRN("%s:%u not implemented", __FILE__, __LINE__);
return 0; return 0;
} }
void reload_parent_cap(Capability<Parent>::Dst, long) { }
}; };

View File

@ -363,7 +363,6 @@ extern "C" int select(int nfds, fd_set *readfds, fd_set *writefds,
#include <setjmp.h> #include <setjmp.h>
#include <base/platform_env.h>
static jmp_buf fork_jmp_buf; static jmp_buf fork_jmp_buf;
@ -377,8 +376,7 @@ extern "C" void stdout_reconnect(); /* provided by 'log_console.cc' */
*/ */
extern "C" void fork_trampoline() extern "C" void fork_trampoline()
{ {
static_cast<Genode::Platform_env *>(Genode::env()) Genode::env()->reload_parent_cap(new_parent.dst, new_parent.local_name);
->reload_parent_cap(new_parent.dst, new_parent.local_name);
stdout_reconnect(); stdout_reconnect();
noux_connection()->reconnect(); noux_connection()->reconnect();