From 396a9ee27347f134b7bfc91b5222e0bd7a3cd47d Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 22 Feb 2012 12:35:26 +0100 Subject: [PATCH] Hook for re-establishing default LOG session --- base/src/base/console/log_console.cc | 27 ++++++++++++++++++++++++++- os/src/lib/ldso/symbol.map | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/base/src/base/console/log_console.cc b/base/src/base/console/log_console.cc index 1c2294fdd..377b79576 100644 --- a/base/src/base/console/log_console.cc +++ b/base/src/base/console/log_console.cc @@ -19,6 +19,10 @@ using namespace Genode; + +void *operator new (size_t, void *ptr) { return ptr; } + + class Log_console : public Console { private: @@ -77,6 +81,21 @@ class Log_console : public Console * Return LOG session interface */ Log_session *log_session() { return &_log; } + + /** + * Re-establish LOG session + */ + void reconnect() + { + /* + * Note that the destructor of old 'Log_connection' is not called. + * This is not needed because the only designated use of this + * function is the startup procedure of noux processes created + * via fork. At the point of calling this function, the new child + * has no valid capability to the original LOG session anyway. + */ + new (&_log) Log_connection; + } }; @@ -100,7 +119,7 @@ Log_console *stdout_log_console() /** - * Hook for supporting libC back ends for stdio + * Hook for supporting libc back ends for stdio */ extern "C" int stdout_write(const char *s) { @@ -108,6 +127,12 @@ extern "C" int stdout_write(const char *s) } +/** + * Hook for support the 'fork' implementation of the noux libc backend + */ +extern "C" void stdout_reconnect() { stdout_log_console()->reconnect(); } + + void Genode::printf(const char *format, ...) { va_list list; diff --git a/os/src/lib/ldso/symbol.map b/os/src/lib/ldso/symbol.map index 913892839..6996bafaa 100644 --- a/os/src/lib/ldso/symbol.map +++ b/os/src/lib/ldso/symbol.map @@ -35,6 +35,7 @@ */ wait_for_continue; stdout_write; + stdout_reconnect; raw_write_str; /* Testing */