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
This commit is contained in:
Johannes Schlatow 2024-07-05 17:05:42 +02:00 committed by Christian Helmuth
parent 5bc6c9f2d0
commit 8ef88ae084
2 changed files with 35 additions and 3 deletions

View File

@ -17,7 +17,7 @@
#include <region_map/client.h>
#include <sandbox/sandbox.h>
#include <os/reporter.h>
#include <terminal_session/connection.h>
#include <terminal_connection.h>
/* local includes */
#include <pd_intrinsics.h>
@ -115,7 +115,7 @@ struct Monitor::Main : Sandbox::State_handler,
{
Env &_env;
Terminal::Connection _terminal { _env };
Terminal_connection _terminal { _env };
Signal_handler<Gdb_stub> _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);

View File

@ -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 <terminal_session/client.h>
#include <base/connection.h>
namespace Monitor { struct Terminal_connection; }
struct Monitor::Terminal_connection : Genode::Connection<Terminal::Session>, Terminal::Session_client
{
Terminal_connection(Genode::Env &env, Label const &label = Label())
:
Genode::Connection<Terminal::Session>(env, label, Ram_quota { 10*1024 }, Args()),
Terminal::Session_client(env.rm(), cap())
{ }
};
#endif /* _TERMINAL_CONNECTION_H_ */