2013-08-10 01:44:55 +00:00
|
|
|
/*
|
|
|
|
* \brief Connection to TRACE service
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2013-08-11
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2023-03-03 11:07:28 +00:00
|
|
|
* Copyright (C) 2013-2023 Genode Labs GmbH
|
2013-08-10 01:44:55 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 12:23:52 +00:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2013-08-10 01:44:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__TRACE_SESSION__CONNECTION_H_
|
|
|
|
#define _INCLUDE__TRACE_SESSION__CONNECTION_H_
|
|
|
|
|
2020-05-05 12:27:29 +00:00
|
|
|
#include <util/retry.h>
|
2013-08-10 01:44:55 +00:00
|
|
|
#include <trace_session/client.h>
|
|
|
|
#include <base/connection.h>
|
|
|
|
|
|
|
|
namespace Genode { namespace Trace { struct Connection; } }
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
|
2013-08-10 01:44:55 +00:00
|
|
|
struct Genode::Trace::Connection : Genode::Connection<Genode::Trace::Session>,
|
|
|
|
Genode::Trace::Session_client
|
|
|
|
{
|
2024-05-22 14:35:38 +00:00
|
|
|
auto _retry(auto const &fn) -> decltype(fn())
|
2020-05-05 12:27:29 +00:00
|
|
|
{
|
2024-05-22 14:35:38 +00:00
|
|
|
return retry_with_upgrade(Ram_quota{8*1024}, Cap_quota{2}, fn);
|
2020-05-05 12:27:29 +00:00
|
|
|
}
|
|
|
|
|
2013-08-10 01:44:55 +00:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* \param ram_quota RAM donated for tracing purposes
|
|
|
|
* \param arg_buffer_size session argument-buffer size
|
|
|
|
*/
|
2023-12-04 13:22:49 +00:00
|
|
|
Connection(Env &env, size_t ram_quota, size_t arg_buffer_size)
|
2016-05-10 15:24:51 +00:00
|
|
|
:
|
2023-03-03 11:07:28 +00:00
|
|
|
Genode::Connection<Session>(env, Label(), Ram_quota { 10*1024 + ram_quota },
|
2023-12-04 13:22:49 +00:00
|
|
|
Args("arg_buffer_size=", arg_buffer_size)),
|
2017-01-16 19:32:26 +00:00
|
|
|
Session_client(env.rm(), cap())
|
2016-05-10 15:24:51 +00:00
|
|
|
{ }
|
2020-05-05 12:27:29 +00:00
|
|
|
|
|
|
|
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); });
|
|
|
|
}
|
|
|
|
|
2024-05-22 14:35:38 +00:00
|
|
|
For_each_subject_info_result for_each_subject_info(auto const &fn)
|
2020-05-05 12:27:29 +00:00
|
|
|
{
|
|
|
|
return _retry([&] () {
|
|
|
|
return Session_client::for_each_subject_info(fn); });
|
|
|
|
}
|
2013-08-10 01:44:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _INCLUDE__TRACE_SESSION__CONNECTION_H_ */
|