From 8ef88ae084ff4dd7cc4a7cd9b9ced44ddf025032 Mon Sep 17 00:00:00 2001 From: Johannes Schlatow Date: Fri, 5 Jul 2024 17:05:42 +0200 Subject: [PATCH] monitor: skip wait for terminal connection Waiting for the terminal connection (e.g. if routed to a tcp_terminal) can cause the monitor to get stuck in the '_handle_config' method. Fixes #5275 --- repos/os/src/monitor/main.cc | 6 ++-- repos/os/src/monitor/terminal_connection.h | 32 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 repos/os/src/monitor/terminal_connection.h diff --git a/repos/os/src/monitor/main.cc b/repos/os/src/monitor/main.cc index d21241d82c..c73ccfb78f 100644 --- a/repos/os/src/monitor/main.cc +++ b/repos/os/src/monitor/main.cc @@ -17,7 +17,7 @@ #include #include #include -#include +#include /* local includes */ #include @@ -115,7 +115,7 @@ struct Monitor::Main : Sandbox::State_handler, { Env &_env; - Terminal::Connection _terminal { _env }; + Terminal_connection _terminal { _env }; Signal_handler _terminal_read_avail_handler { _env.ep(), *this, &Gdb_stub::_handle_terminal_read_avail }; @@ -130,7 +130,7 @@ struct Monitor::Main : Sandbox::State_handler, { struct Write_fn { - Terminal::Connection &_terminal; + Terminal_connection &_terminal; void operator () (char const *str) { size_t const num_bytes = strlen(str); diff --git a/repos/os/src/monitor/terminal_connection.h b/repos/os/src/monitor/terminal_connection.h new file mode 100644 index 0000000000..6638d45f65 --- /dev/null +++ b/repos/os/src/monitor/terminal_connection.h @@ -0,0 +1,32 @@ +/* + * \brief Connection to Terminal service without waiting + * \author Norman Feske + * \date 2024-07-05 + */ + +/* + * Copyright (C) 2024 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + +#ifndef _TERMINAL_CONNECTION_H_ +#define _TERMINAL_CONNECTION_H_ + +#include +#include + +namespace Monitor { struct Terminal_connection; } + + +struct Monitor::Terminal_connection : Genode::Connection, Terminal::Session_client +{ + Terminal_connection(Genode::Env &env, Label const &label = Label()) + : + Genode::Connection(env, label, Ram_quota { 10*1024 }, Args()), + Terminal::Session_client(env.rm(), cap()) + { } +}; + +#endif /* _TERMINAL_CONNECTION_H_ */