diff --git a/base/src/base/console/log_console.cc b/base/src/base/console/log_console.cc index 1c2294fdd0..377b795764 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 913892839f..6996bafaad 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 */