/* * \brief Connection to TRACE service * \author Norman Feske * \date 2013-08-11 */ /* * Copyright (C) 2013-2023 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 _INCLUDE__TRACE_SESSION__CONNECTION_H_ #define _INCLUDE__TRACE_SESSION__CONNECTION_H_ #include #include #include namespace Genode { namespace Trace { struct Connection; } } struct Genode::Trace::Connection : Genode::Connection, Genode::Trace::Session_client { auto _retry(auto const &fn) -> decltype(fn()) { return retry_with_upgrade(Ram_quota{8*1024}, Cap_quota{2}, fn); } /** * Constructor * * \param ram_quota RAM donated for tracing purposes * \param arg_buffer_size session argument-buffer size */ Connection(Env &env, size_t ram_quota, size_t arg_buffer_size) : Genode::Connection(env, Label(), Ram_quota { 10*1024 + ram_quota }, Args("arg_buffer_size=", arg_buffer_size)), Session_client(env.rm(), cap()) { } Policy_id alloc_policy(size_t size) override { return _retry([&] () { return Session_client::alloc_policy(size); }); } void trace(Subject_id s, Policy_id p, size_t buffer_size) override { _retry([&] () { Session_client::trace(s, p, buffer_size); }); } size_t subjects(Subject_id *dst, size_t dst_len) override { return _retry([&] () { return Session_client::subjects(dst, dst_len); }); } For_each_subject_info_result for_each_subject_info(auto const &fn) { return _retry([&] () { return Session_client::for_each_subject_info(fn); }); } }; #endif /* _INCLUDE__TRACE_SESSION__CONNECTION_H_ */