mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-13 12:48:20 +00:00
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:
committed by
Christian Helmuth
parent
4ac7127f89
commit
051e84c4b4
@ -11,11 +11,16 @@
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <base/printf.h>
|
||||
|
||||
/* local includes */
|
||||
#include "testlib.h"
|
||||
|
||||
/* Linux includes */
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
@ -35,7 +40,18 @@ extern Testlib_testclass testlib_testobject;
|
||||
Testapp_testclass testapp_testobject;
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
static int exit_status;
|
||||
static void exit_on_suspended() { exit(exit_status); }
|
||||
|
||||
|
||||
Genode::size_t Component::stack_size() { return 16*1024*sizeof(long); }
|
||||
char const * Component::name() { return "lx_hybrid_ctors"; }
|
||||
|
||||
|
||||
/*
|
||||
* Component implements classical main function in construct.
|
||||
*/
|
||||
void Component::construct(Genode::Environment &env)
|
||||
{
|
||||
printf("--- lx_hybrid global static constructor test ---\n");
|
||||
|
||||
@ -47,6 +63,6 @@ int main(int argc, char *argv[])
|
||||
testapp_testobject.dummy();
|
||||
|
||||
printf("--- returning from main ---\n");
|
||||
|
||||
return 0;
|
||||
exit_status = 0;
|
||||
env.ep().schedule_suspend(exit_on_suspended, nullptr);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <base/thread.h>
|
||||
#include <base/printf.h>
|
||||
|
||||
@ -12,6 +13,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum { STACK_SIZE = 4096 };
|
||||
|
||||
@ -40,7 +42,20 @@ struct Thread : Genode::Thread<STACK_SIZE>
|
||||
};
|
||||
|
||||
|
||||
int main(int, char **)
|
||||
static int exit_status;
|
||||
static void exit_on_suspended() { exit(exit_status); }
|
||||
|
||||
|
||||
Genode::size_t Component::stack_size() { return 16*1024*sizeof(long); }
|
||||
char const * Component::name() { return "lx_hybrid_errno"; }
|
||||
|
||||
|
||||
struct Unexpected_errno_change { };
|
||||
|
||||
/*
|
||||
* Component implements classical main function in construct.
|
||||
*/
|
||||
void Component::construct(Genode::Environment &env)
|
||||
{
|
||||
Genode::printf("--- thread-local errno test ---\n");
|
||||
|
||||
@ -60,9 +75,10 @@ int main(int, char **)
|
||||
|
||||
if (orig_errno != errno) {
|
||||
PERR("unexpected change of main thread's errno value");
|
||||
return -1;
|
||||
throw Unexpected_errno_change();
|
||||
}
|
||||
|
||||
Genode::printf("--- finished thread-local errno test ---\n");
|
||||
return 0;
|
||||
exit_status = 0;
|
||||
env.ep().schedule_suspend(exit_on_suspended, nullptr);
|
||||
}
|
||||
|
@ -11,27 +11,41 @@
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <base/printf.h>
|
||||
|
||||
/* Linux includes */
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
class Test_exception { };
|
||||
|
||||
/**
|
||||
* Main program
|
||||
static int exit_status;
|
||||
static void exit_on_suspended() { exit(exit_status); }
|
||||
|
||||
|
||||
Genode::size_t Component::stack_size() { return 16*1024*sizeof(long); }
|
||||
char const * Component::name() { return "lx_hybrid_exception"; }
|
||||
|
||||
|
||||
/*
|
||||
* Component implements classical main function in construct.
|
||||
*/
|
||||
int main(int, char **)
|
||||
void Component::construct(Genode::Environment &env)
|
||||
{
|
||||
printf("--- lx_hybrid exception test ---\n");
|
||||
|
||||
try {
|
||||
printf("Throwing Test_exception\n");
|
||||
throw Test_exception();
|
||||
} catch(Test_exception) {
|
||||
} catch (Test_exception) {
|
||||
printf("Caught Test_exception\n");
|
||||
}
|
||||
|
||||
printf("--- returning from main ---\n");
|
||||
|
||||
return 0;
|
||||
exit_status = 0;
|
||||
env.ep().schedule_suspend(exit_on_suspended, nullptr);
|
||||
}
|
||||
|
@ -12,11 +12,14 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <base/thread.h>
|
||||
#include <base/printf.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
static Genode::Lock *main_wait_lock()
|
||||
@ -46,7 +49,18 @@ static void *pthread_entry(void *)
|
||||
}
|
||||
|
||||
|
||||
int main(int, char **)
|
||||
static int exit_status;
|
||||
static void exit_on_suspended() { exit(exit_status); }
|
||||
|
||||
|
||||
Genode::size_t Component::stack_size() { return 16*1024*sizeof(long); }
|
||||
char const * Component::name() { return "lx_hybrid_pthread_ipc"; }
|
||||
|
||||
|
||||
/*
|
||||
* Component implements classical main function in construct.
|
||||
*/
|
||||
void Component::construct(Genode::Environment &env)
|
||||
{
|
||||
Genode::printf("--- pthread IPC test ---\n");
|
||||
|
||||
@ -58,5 +72,6 @@ int main(int, char **)
|
||||
main_wait_lock()->lock();
|
||||
|
||||
Genode::printf("--- finished pthread IPC test ---\n");
|
||||
return 0;
|
||||
exit_status = 0;
|
||||
env.ep().schedule_suspend(exit_on_suspended, nullptr);
|
||||
}
|
||||
|
Reference in New Issue
Block a user