genode/repos/base/include/rm_session/rm_session.h
Norman Feske 4d442bca30 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-31 13:16:07 +02:00

61 lines
1.4 KiB
C++

/*
* \brief Region-map session interface
* \author Norman Feske
* \date 2016-04-15
*/
/*
* Copyright (C) 2016-2017 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__RM_SESSION__RM_SESSION_H_
#define _INCLUDE__RM_SESSION__RM_SESSION_H_
#include <region_map/region_map.h>
#include <session/session.h>
namespace Genode { struct Rm_session; }
struct Genode::Rm_session : Session
{
static const char *service_name() { return "RM"; }
/*
* An RM session consumes a dataspace capability for the session-object
* allocation and its session capability.
*/
enum { CAP_QUOTA = 2 };
/**
* Create region map
*
* \param size upper bound of region map
* \return region-map capability
* \throw Out_of_ram
* \throw Out_of_caps
*/
virtual Capability<Region_map> create(size_t size) = 0;
/**
* Destroy region map
*/
virtual void destroy(Capability<Region_map>) = 0;
/*********************
** RPC declaration **
*********************/
GENODE_RPC_THROW(Rpc_create, Capability<Region_map>, create,
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps), size_t);
GENODE_RPC(Rpc_destroy, void, destroy, Capability<Region_map>);
GENODE_RPC_INTERFACE(Rpc_create, Rpc_destroy);
};
#endif /* _INCLUDE__RM_SESSION__RM_SESSION_H_ */