Move server API concept to base framework

This commit introduces the new `Component` interface in the form of the
headers base/component.h and base/entrypoint.h. The os/server.h API
has become merely a compatibilty wrapper and will eventually be removed.
The same holds true for os/signal_rpc_dispatcher.h. The mechanism has
moved to base/signal.h and is now called 'Signal_handler'.

Since the patch shuffles headers around, please do a 'make clean' in the
build directory.

Issue #1832
This commit is contained in:
Norman Feske
2015-12-23 15:22:33 +01:00
committed by Christian Helmuth
parent 4ac7127f89
commit 051e84c4b4
74 changed files with 1730 additions and 638 deletions

View File

@ -1,5 +1,5 @@
/*
* \brief Supplemental code for hybrid Genode/Linux programs
* \brief Supplemental code for hybrid Genode/Linux components
* \author Norman Feske
* \date 2011-09-02
*/
@ -13,6 +13,7 @@
/* Genode includes */
#include <base/printf.h>
#include <base/component.h>
#include <linux_syscalls.h>
#include <linux_cpu_session/linux_cpu_session.h>
@ -66,16 +67,45 @@ __attribute__((constructor(101))) void lx_hybrid_init()
lx_sigaction(LX_SIGUSR1, empty_signal_handler);
}
namespace Genode {
extern void bootstrap_component();
extern void call_global_static_constructors();
/*
* Hook for intercepting the call of the 'Component::construct' method. By
* hooking this function pointer in a library constructor, the libc is able
* to create a task context for the component code. This context is
* scheduled by the libc in a cooperative fashion, i.e. when the
* component's entrypoint is activated.
*/
extern void (*call_component_construct)(Genode::Environment &) __attribute__((weak));
}
static void lx_hybrid_component_construct(Genode::Environment &env)
{
Component::construct(env);
}
void (*Genode::call_component_construct)(Genode::Environment &) = &lx_hybrid_component_construct;
/*
* Dummy symbols to let generic tests programs (i.e., 'test-config_args') link
* successfully. Please note that such programs are not expected to work when
* built as hybrid Linux/Genode programs because when using the glibc startup
* code, we cannot manipulate argv prior executing main. However, by defining
* these symbols, we prevent the automated build bot from stumbling over such
* binaries.
* Static constructors are handled by the Linux startup code - so implement
* this as empty function.
*/
char **genode_argv = 0;
int genode_argc = 1;
void Genode::call_global_static_constructors() { }
/*
* Hybrid components are not allowed to implement legacy main(). This enables
* us to hook in and bootstrap components as usual.
*/
int main()
{
Genode::bootstrap_component();
/* never reached */
}
/************