2013-08-10 01:44:55 +00:00
|
|
|
/*
|
|
|
|
* \brief TRACE session interface
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2013-08-11
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 12:23:52 +00:00
|
|
|
* Copyright (C) 2013-2017 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__TRACE_SESSION_H_
|
|
|
|
#define _INCLUDE__TRACE_SESSION__TRACE_SESSION_H_
|
|
|
|
|
|
|
|
#include <base/exception.h>
|
|
|
|
#include <base/trace/types.h>
|
|
|
|
#include <dataspace/capability.h>
|
|
|
|
#include <session/session.h>
|
|
|
|
|
|
|
|
namespace Genode { namespace Trace { struct Session; } }
|
|
|
|
|
|
|
|
|
|
|
|
struct Genode::Trace::Session : Genode::Session
|
|
|
|
{
|
2017-05-24 12:41:19 +00:00
|
|
|
/**
|
|
|
|
* \noapi
|
|
|
|
*/
|
2013-08-10 01:44:55 +00:00
|
|
|
static const char *service_name() { return "TRACE"; }
|
|
|
|
|
2020-05-05 12:27:29 +00:00
|
|
|
enum { CAP_QUOTA = 6 };
|
2017-05-07 20:03:25 +00:00
|
|
|
|
2013-08-10 01:44:55 +00:00
|
|
|
/**
|
|
|
|
* Allocate policy-module backing store
|
|
|
|
*
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
* \throw Out_of_ram
|
|
|
|
* \throw Out_of_caps
|
2013-08-10 01:44:55 +00:00
|
|
|
*/
|
|
|
|
virtual Policy_id alloc_policy(size_t size) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request policy-module backing store
|
|
|
|
*
|
|
|
|
* \throw Nonexistent_policy
|
|
|
|
*/
|
|
|
|
virtual Dataspace_capability policy(Policy_id) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a policy module from the TRACE service
|
|
|
|
*/
|
|
|
|
virtual void unload_policy(Policy_id) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start tracing of a subject
|
|
|
|
*
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
* \throw Out_of_ram
|
|
|
|
* \throw Out_of_caps
|
2013-08-10 01:44:55 +00:00
|
|
|
* \throw Already_traced
|
|
|
|
* \throw Source_is_dead
|
|
|
|
* \throw Nonexistent_policy
|
2018-01-23 23:33:51 +00:00
|
|
|
* \throw Nonexistent_subject
|
2013-08-10 01:44:55 +00:00
|
|
|
* \throw Traced_by_other_session
|
|
|
|
*/
|
|
|
|
virtual void trace(Subject_id, Policy_id, size_t buffer_size) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pause generation of tracing data
|
|
|
|
*
|
|
|
|
* \throw Nonexistent_subject
|
|
|
|
*/
|
|
|
|
virtual void pause(Subject_id) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resume generation of tracing data
|
|
|
|
*
|
|
|
|
* \throw Nonexistent_subject
|
|
|
|
* \throw Source_is_dead
|
|
|
|
*/
|
|
|
|
virtual void resume(Subject_id) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain trace buffer of given subject
|
|
|
|
*
|
|
|
|
* \throw Nonexistent_subject
|
|
|
|
*/
|
|
|
|
virtual Dataspace_capability buffer(Subject_id) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Release subject and free buffers
|
|
|
|
*
|
|
|
|
* If the source still exists, the buffers are freed but the subject
|
|
|
|
* stays intact.
|
|
|
|
*
|
|
|
|
* \throw Nonexistent_subject
|
|
|
|
*/
|
|
|
|
virtual void free(Subject_id) = 0;
|
|
|
|
|
|
|
|
virtual ~Session() { }
|
|
|
|
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
** RPC declaration **
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
GENODE_RPC(Rpc_dataspace, Dataspace_capability, dataspace);
|
|
|
|
GENODE_RPC_THROW(Rpc_alloc_policy, Policy_id, alloc_policy,
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps),
|
2013-08-10 01:44:55 +00:00
|
|
|
size_t);
|
|
|
|
GENODE_RPC_THROW(Rpc_policy, Dataspace_capability, policy,
|
|
|
|
GENODE_TYPE_LIST(Nonexistent_policy),
|
|
|
|
Policy_id);
|
|
|
|
GENODE_RPC_THROW(Rpc_unload_policy, void, unload_policy,
|
|
|
|
GENODE_TYPE_LIST(Nonexistent_policy), Policy_id);
|
|
|
|
GENODE_RPC_THROW(Rpc_trace, void, trace,
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps, Already_traced,
|
2018-01-23 23:33:51 +00:00
|
|
|
Source_is_dead, Nonexistent_subject,
|
|
|
|
Nonexistent_policy,
|
2013-08-10 01:44:55 +00:00
|
|
|
Traced_by_other_session),
|
|
|
|
Subject_id, Policy_id, size_t);
|
|
|
|
GENODE_RPC_THROW(Rpc_pause, void, pause,
|
|
|
|
GENODE_TYPE_LIST(Nonexistent_subject), Subject_id);
|
|
|
|
GENODE_RPC_THROW(Rpc_resume, void, resume,
|
|
|
|
GENODE_TYPE_LIST(Nonexistent_subject, Source_is_dead),
|
|
|
|
Subject_id);
|
2015-06-17 11:25:51 +00:00
|
|
|
GENODE_RPC_THROW(Rpc_subjects, size_t, subjects,
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps));
|
2020-01-16 17:00:30 +00:00
|
|
|
GENODE_RPC_THROW(Rpc_subject_infos, size_t, subject_infos,
|
|
|
|
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps));
|
2013-08-10 01:44:55 +00:00
|
|
|
GENODE_RPC_THROW(Rpc_buffer, Dataspace_capability, buffer,
|
|
|
|
GENODE_TYPE_LIST(Nonexistent_subject, Subject_not_traced),
|
|
|
|
Subject_id);
|
|
|
|
GENODE_RPC_THROW(Rpc_free, void, free,
|
|
|
|
GENODE_TYPE_LIST(Nonexistent_subject), Subject_id);
|
|
|
|
|
2016-05-11 15:23:51 +00:00
|
|
|
GENODE_RPC_INTERFACE(Rpc_dataspace, Rpc_alloc_policy, Rpc_policy,
|
2022-09-29 14:50:47 +00:00
|
|
|
Rpc_unload_policy, Rpc_trace, Rpc_pause,
|
2021-12-15 16:19:10 +00:00
|
|
|
Rpc_resume, Rpc_subjects, Rpc_buffer,
|
2020-01-16 17:00:30 +00:00
|
|
|
Rpc_free, Rpc_subject_infos);
|
2013-08-10 01:44:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _INCLUDE__TRACE_SESSION__TRACE_SESSION_H_ */
|