Replace Quota_exceeded by Insufficient_ram_quota

This patch replaces the 'Parent::Quota_exceeded',
'Service::Quota_exceeded', and 'Root::Quota_exceeded' exceptions
by the single 'Insufficient_ram_quota' exception type.

Furthermore, the 'Parent' interface distinguished now between
'Out_of_ram' (the child's RAM is exhausted) from
'Insufficient_ram_quota' (the child's RAM donation does not suffice to
establish the session).

This eliminates ambiguities and removes the need to convert exception
types along the path of the session creation.

Issue #2398
This commit is contained in:
Norman Feske 2017-05-08 14:32:03 +02:00 committed by Christian Helmuth
parent eea493a8ca
commit 6609aafb05
55 changed files with 135 additions and 134 deletions

View File

@ -38,7 +38,7 @@ void * Hw::Address_space::_table_alloc()
void * ret;
if (!_cma()->alloc_aligned(sizeof(Page_table), (void**)&ret,
Page_table::ALIGNM_LOG2).ok())
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
return ret;
}

View File

@ -83,7 +83,7 @@ void * Vm_session_component::_alloc_table()
if (!cma()->alloc_aligned(sizeof(Table), (void**)&table,
Table::ALIGNM_LOG2).ok()) {
error("failed to allocate kernel object");
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
return table;
}

View File

@ -24,7 +24,7 @@ addr_t Vm_session_component::_alloc_ds(size_t &ram_quota)
if (_ds_size() > ram_quota ||
platform()->ram_alloc()->alloc_aligned(_ds_size(), (void**)&addr,
get_page_size_log2()).error())
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
ram_quota -= _ds_size();
return addr;
}

View File

@ -46,7 +46,7 @@ class Genode::Attached_io_mem_dataspace
* \param write_combined enable write combining for the resource
*
* \throw Parent::Service_denied
* \throw Parent::Quota_exceeded
* \throw Insufficient_ram_quota
* \throw Parent::Unavailable
* \throw Rm_session::Attach_failed
*/

View File

@ -92,9 +92,8 @@ struct Genode::Env
* \param args session constructor arguments
* \param affinity preferred CPU affinity for the session
*
* \throw Service_denied parent denies session request
* \throw Quota_exceeded our own quota does not suffice for
* the creation of the new session
* \throw Service_denied
* \throw Insufficient_ram_quota
* \throw Unavailable
*
* This method blocks until the session is available or an error

View File

@ -68,13 +68,13 @@ struct Genode::Local_connection_base : Noncopyable
_session_state->service().initiate_request(*_session_state);
if (_session_state->phase == Session_state::QUOTA_EXCEEDED)
if (_session_state->phase == Session_state::INSUFFICIENT_RAM_QUOTA)
ram_quota += 4096;
else
break;
}
if (_session_state->phase == Session_state::QUOTA_EXCEEDED)
if (_session_state->phase == Session_state::INSUFFICIENT_RAM_QUOTA)
warning("giving up to increase session quota for ", service.name(), " session "
"after ", (int)NUM_ATTEMPTS, " attempts");
}

View File

@ -57,9 +57,8 @@ class Genode::Service : Noncopyable
** Exception types **
*********************/
class Invalid_args { };
class Unavailable { };
class Quota_exceeded { };
class Invalid_args : Exception { };
class Unavailable : Exception { };
/**
* Constructor
@ -132,7 +131,7 @@ class Genode::Local_service : public Service
* Create session
*
* \throw Denied
* \throw Quota_exceeded
* \throw Insufficient_ram_quota
*/
virtual SESSION &create(Args const &, Affinity) = 0;
@ -202,8 +201,8 @@ class Genode::Local_service : public Service
}
catch (typename Factory::Denied) {
session.phase = Session_state::INVALID_ARGS; }
catch (Quota_exceeded) {
session.phase = Session_state::QUOTA_EXCEEDED; }
catch (Insufficient_ram_quota) {
session.phase = Session_state::INSUFFICIENT_RAM_QUOTA; }
break;
@ -229,7 +228,7 @@ class Genode::Local_service : public Service
break;
case Session_state::INVALID_ARGS:
case Session_state::QUOTA_EXCEEDED:
case Session_state::INSUFFICIENT_RAM_QUOTA:
case Session_state::AVAILABLE:
case Session_state::CAP_HANDED_OUT:
case Session_state::CLOSED:
@ -285,9 +284,9 @@ class Genode::Parent_service : public Service
session.phase = Session_state::AVAILABLE;
}
catch (Parent::Quota_exceeded) {
catch (Insufficient_ram_quota) {
session.id_at_parent.destruct();
session.phase = Session_state::INVALID_ARGS; }
session.phase = Session_state::INSUFFICIENT_RAM_QUOTA; }
catch (Parent::Service_denied) {
session.id_at_parent.destruct();
@ -304,7 +303,7 @@ class Genode::Parent_service : public Service
try {
_env.upgrade(session.id_at_parent->id(), args.string()); }
catch (Parent::Quota_exceeded) {
catch (Out_of_ram) {
warning("quota exceeded while upgrading parent session"); }
session.confirm_ram_upgrade();
@ -322,7 +321,7 @@ class Genode::Parent_service : public Service
break;
case Session_state::INVALID_ARGS:
case Session_state::QUOTA_EXCEEDED:
case Session_state::INSUFFICIENT_RAM_QUOTA:
case Session_state::AVAILABLE:
case Session_state::CAP_HANDED_OUT:
case Session_state::CLOSED:

View File

@ -79,7 +79,7 @@ class Genode::Session_state : public Parent::Client, public Parent::Server,
enum Phase { CREATE_REQUESTED,
INVALID_ARGS,
QUOTA_EXCEEDED,
INSUFFICIENT_RAM_QUOTA,
AVAILABLE,
CAP_HANDED_OUT,
UPGRADE_REQUESTED,
@ -185,7 +185,7 @@ class Genode::Session_state : public Parent::Client, public Parent::Server,
case CREATE_REQUESTED:
case INVALID_ARGS:
case QUOTA_EXCEEDED:
case INSUFFICIENT_RAM_QUOTA:
case CLOSED:
return false;

View File

@ -59,7 +59,6 @@ class Genode::Parent
class Exception : public ::Genode::Exception { };
class Service_denied : public Exception { };
class Quota_exceeded : public Exception { };
class Unavailable : public Exception { };
typedef Rpc_in_buffer<64> Service_name;
@ -160,9 +159,9 @@ class Genode::Parent
* \param args session constructor arguments
* \param affinity preferred CPU affinity for the session
*
* \throw Service_denied parent denies session request
* \throw Quota_exceeded our own quota does not suffice for
* the creation of the new session
* \throw Service_denied parent denies session request
* \throw Insufficient_ram_quota donated RAM quota does not suffice
* \throw Out_of_ram session RAM quota exceeds our resources
*
* \return session capability of the new session is immediately
* available, or an invalid capability
@ -183,8 +182,7 @@ class Genode::Parent
* Request session capability
*
* \throw Service_denied
* \throw Quota_exceeded session quota does not suffice for
* the creation of the new session
* \throw Insufficient_ram_quota
*
* In the exception case, the parent implicitly closes the session.
*/
@ -198,7 +196,7 @@ class Genode::Parent
* \param id ID of recipient session
* \param args description of the amount of quota to transfer
*
* \throw Quota_exceeded quota could not be transferred
* \throw Out_of_ram
*
* The 'args' argument has the same principle format as the 'args'
* argument of the 'session' operation.
@ -217,7 +215,8 @@ class Genode::Parent
* Interface for providing services
*/
enum Session_response { SESSION_OK, SESSION_CLOSED, INVALID_ARGS, QUOTA_EXCEEDED };
enum Session_response { SESSION_OK, SESSION_CLOSED, INVALID_ARGS,
INSUFFICIENT_RAM_QUOTA };
/**
* Set state of a session provided by the child service
@ -295,14 +294,16 @@ class Genode::Parent
Service_name const &);
GENODE_RPC(Rpc_session_sigh, void, session_sigh, Signal_context_capability);
GENODE_RPC_THROW(Rpc_session, Session_capability, session,
GENODE_TYPE_LIST(Service_denied, Quota_exceeded, Unavailable),
GENODE_TYPE_LIST(Service_denied, Out_of_ram,
Insufficient_ram_quota, Unavailable),
Client::Id, Service_name const &, Session_args const &,
Affinity const &);
GENODE_RPC_THROW(Rpc_session_cap, Session_capability, session_cap,
GENODE_TYPE_LIST(Service_denied, Quota_exceeded, Unavailable),
GENODE_TYPE_LIST(Service_denied,
Insufficient_ram_quota, Unavailable),
Client::Id);
GENODE_RPC_THROW(Rpc_upgrade, Upgrade_result, upgrade,
GENODE_TYPE_LIST(Quota_exceeded),
GENODE_TYPE_LIST(Out_of_ram),
Client::Id, Upgrade_args const &);
GENODE_RPC(Rpc_close, Close_result, close, Client::Id);
GENODE_RPC(Rpc_session_response, void, session_response,

View File

@ -146,7 +146,7 @@ class Genode::Root_component : public Rpc_object<Typed_root<SESSION_TYPE> >,
warning("insufficient ram quota "
"for ", SESSION_TYPE::service_name(), " session, "
"provided=", ram_quota, ", required=", needed);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
Ram_quota const remaining_ram_quota { ram_quota.value - needed };
@ -284,7 +284,7 @@ class Genode::Root_component : public Rpc_object<Typed_root<SESSION_TYPE> >,
{
try {
return _create(args, affinity); }
catch (Root::Quota_exceeded) { throw Service::Quota_exceeded(); }
catch (Insufficient_ram_quota) { throw; }
catch (...) {
throw typename Local_service<SESSION_TYPE>::Factory::Denied(); }
}

View File

@ -47,7 +47,7 @@ struct Genode::Root
* Create session
*
* \throw Unavailable
* \throw Quota_exceeded
* \throw Insufficient_ram_quota
* \throw Invalid_args
*
* \return capability to new session
@ -71,7 +71,8 @@ struct Genode::Root
*********************/
GENODE_RPC_THROW(Rpc_session, Session_capability, session,
GENODE_TYPE_LIST(Unavailable, Quota_exceeded, Invalid_args),
GENODE_TYPE_LIST(Unavailable, Insufficient_ram_quota,
Invalid_args),
Session_args const &, Affinity const &);
GENODE_RPC_THROW(Rpc_upgrade, void, upgrade,
GENODE_TYPE_LIST(Invalid_args),

View File

@ -73,7 +73,7 @@ class Genode::Core_parent : public Parent
Session_capability session_cap(Client::Id) override { return Session_capability(); }
Upgrade_result upgrade(Client::Id, Upgrade_args const &) override {
throw Quota_exceeded(); }
throw Out_of_ram(); }
Close_result close(Client::Id) override { return CLOSE_DONE; }

View File

@ -40,7 +40,7 @@ namespace Genode {
Arg_string::find_arg(args, "ram_quota").ulong_value(0);
if (ram_quota < Trace::Control_area::SIZE)
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
return new (md_alloc())
Cpu_session_component(

View File

@ -112,7 +112,7 @@ class Genode::Expanding_parent_client : public Parent_client
* caller to issue (and respond to) a resource request.
*/
enum { NUM_ATTEMPTS = 2 };
return retry<Parent::Quota_exceeded>(
return retry<Out_of_ram>(
[&] () { return Parent_client::upgrade(id, args); },
[&] () { resource_request(Resource_args(args.string())); },
NUM_ATTEMPTS);

View File

@ -147,7 +147,7 @@ void Child::session_sigh(Signal_context_capability sigh)
_id_space.for_each<Session_state const>([&] (Session_state const &session) {
if (session.phase == Session_state::AVAILABLE ||
session.phase == Session_state::QUOTA_EXCEEDED ||
session.phase == Session_state::INSUFFICIENT_RAM_QUOTA ||
session.phase == Session_state::INVALID_ARGS) {
if (sigh.valid() && session.async_client_notify)
@ -160,7 +160,7 @@ void Child::session_sigh(Signal_context_capability sigh)
/**
* Create session-state object for a dynamically created session
*
* \throw Parent::Quota_exceeded
* \throw Insufficient_ram_quota
* \throw Parent::Service_denied
*/
Session_state &
@ -171,16 +171,15 @@ create_session(Child_policy::Name const &child_name, Service &service,
Affinity const &affinity)
{
try {
return service.create_session(factory, id_space, id, label, args, affinity);
}
catch (Service::Quota_exceeded) {
error(child_name, " requested session with insufficient session quota");
throw Parent::Quota_exceeded();
}
return service.create_session(factory, id_space, id, label, args, affinity); }
catch (Insufficient_ram_quota) {
error(child_name, " requested session with insufficient RAM quota");
throw; }
catch (Allocator::Out_of_memory) {
error("could not allocate session meta data for child ", child_name);
throw Parent::Quota_exceeded();
}
error(child_name, " session meta data could not be allocated");
throw Out_of_ram(); }
catch (Id_space<Parent::Client>::Conflicting_id) {
error(child_name, " requested conflicting session ID ", id, " "
@ -249,7 +248,7 @@ Session_capability Child::session(Parent::Client::Id id,
size_t const keep_ram_quota = _session_factory.session_costs();
if (ram_quota.value < keep_ram_quota)
throw Parent::Quota_exceeded();
throw Insufficient_ram_quota();
/* ram quota to be forwarded to the server */
Ram_quota const forward_ram_quota { ram_quota.value - keep_ram_quota };
@ -286,9 +285,9 @@ Session_capability Child::session(Parent::Client::Id id,
throw Service_denied();
}
if (session.phase == Session_state::QUOTA_EXCEEDED) {
if (session.phase == Session_state::INSUFFICIENT_RAM_QUOTA) {
_revert_quota_and_destroy(session);
throw Parent::Quota_exceeded();
throw Insufficient_ram_quota();
}
/* finish transaction */
@ -300,7 +299,7 @@ Session_capability Child::session(Parent::Client::Id id,
* Release session meta data if one of the quota transfers went wrong.
*/
session.destroy();
throw Parent::Quota_exceeded();
throw Out_of_ram();
}
/*
@ -329,7 +328,7 @@ Session_capability Child::session_cap(Client::Id id)
auto lamda = [&] (Session_state &session) {
if (session.phase == Session_state::INVALID_ARGS
|| session.phase == Session_state::QUOTA_EXCEEDED) {
|| session.phase == Session_state::INSUFFICIENT_RAM_QUOTA) {
Session_state::Phase const phase = session.phase;
@ -340,10 +339,11 @@ Session_capability Child::session_cap(Client::Id id)
*/
_revert_quota_and_destroy(session);
if (phase == Session_state::INVALID_ARGS)
throw Parent::Service_denied();
else
throw Parent::Quota_exceeded();
switch (phase) {
case Session_state::INVALID_ARGS: throw Parent::Service_denied();
case Session_state::INSUFFICIENT_RAM_QUOTA: throw Insufficient_ram_quota();
default: break;
}
}
if (!session.alive())
@ -404,7 +404,7 @@ Parent::Upgrade_result Child::upgrade(Client::Id id, Parent::Upgrade_args const
}
catch (Transfer::Quota_exceeded) {
warning(_policy.name(), ": upgrade of ", session.service().name(), " failed");
throw Parent::Quota_exceeded();
throw Out_of_ram();
}
if (session.phase == Session_state::CAP_HANDED_OUT) {
@ -455,7 +455,7 @@ Child::Close_result Child::_close(Session_state &session)
* without involving the server
*/
if (session.phase == Session_state::INVALID_ARGS
|| session.phase == Session_state::QUOTA_EXCEEDED) {
|| session.phase == Session_state::INSUFFICIENT_RAM_QUOTA) {
_revert_quota_and_destroy(session);
return CLOSE_DONE;
}
@ -554,8 +554,8 @@ void Child::session_response(Server::Id id, Session_response response)
session.ready_callback->session_ready(session);
break;
case Parent::QUOTA_EXCEEDED:
session.phase = Session_state::QUOTA_EXCEEDED;
case Parent::INSUFFICIENT_RAM_QUOTA:
session.phase = Session_state::INSUFFICIENT_RAM_QUOTA;
if (session.ready_callback)
session.ready_callback->session_ready(session);
break;
@ -705,6 +705,7 @@ void Child::_try_construct_env_dependent_members()
Child_address_space(_pd.session(), _policy).region_map(),
_parent_cap);
}
catch (Out_of_ram) { _error("out of RAM during ELF loading"); }
catch (Ram_session::Alloc_failed) { _error("RAM allocation failed during ELF loading"); }
catch (Cpu_session::Thread_creation_failed) { _error("unable to create initial thread"); }
catch (Cpu_session::Out_of_metadata) { _error("CPU session quota exhausted"); }

View File

@ -135,7 +135,7 @@ namespace {
strncpy(argbuf, args.string(), sizeof(argbuf));
Ram_quota ram_quota = ram_quota_from_args(argbuf);
return retry<Parent::Quota_exceeded>(
return retry<Insufficient_ram_quota>(
[&] () {
Arg_string::set_arg(argbuf, sizeof(argbuf), "ram_quota",
@ -172,7 +172,7 @@ namespace {
warning("giving up to increase session quota for ", name.string(), " session "
"after ", (int)NUM_ATTEMPTS, " attempts");
throw Parent::Quota_exceeded();
throw Insufficient_ram_quota();
}
void upgrade(Parent::Client::Id id, Parent::Upgrade_args const &args) override

View File

@ -185,8 +185,8 @@ void Root_proxy::_handle_session_request(Xml_node request)
}
catch (Root::Invalid_args) {
_env.parent().session_response(id, Parent::INVALID_ARGS); }
catch (Root::Quota_exceeded) {
_env.parent().session_response(id, Parent::QUOTA_EXCEEDED); }
catch (Insufficient_ram_quota) {
_env.parent().session_response(id, Parent::INSUFFICIENT_RAM_QUOTA); }
catch (Root::Unavailable) {
_env.parent().session_response(id, Parent::INVALID_ARGS); }
}

View File

@ -30,14 +30,14 @@ struct Formatted_phase
typedef Genode::Session_state State;
switch (_phase) {
case State::CREATE_REQUESTED: print(output, "CREATE_REQUESTED"); break;
case State::INVALID_ARGS: print(output, "INVALID_ARGS"); break;
case State::QUOTA_EXCEEDED: print(output, "QUOTA_EXCEEDED"); break;
case State::AVAILABLE: print(output, "AVAILABLE"); break;
case State::CAP_HANDED_OUT: print(output, "CAP_HANDED_OUT"); break;
case State::UPGRADE_REQUESTED: print(output, "UPGRADE_REQUESTED"); break;
case State::CLOSE_REQUESTED: print(output, "CLOSE_REQUESTED"); break;
case State::CLOSED: print(output, "CLOSED"); break;
case State::CREATE_REQUESTED: print(output, "CREATE_REQUESTED"); break;
case State::INVALID_ARGS: print(output, "INVALID_ARGS"); break;
case State::INSUFFICIENT_RAM_QUOTA: print(output, "INSUFFICIENT_RAM_QUOTA"); break;
case State::AVAILABLE: print(output, "AVAILABLE"); break;
case State::CAP_HANDED_OUT: print(output, "CAP_HANDED_OUT"); break;
case State::UPGRADE_REQUESTED: print(output, "UPGRADE_REQUESTED"); break;
case State::CLOSE_REQUESTED: print(output, "CLOSE_REQUESTED"); break;
case State::CLOSED: print(output, "CLOSED"); break;
}
}
};
@ -87,7 +87,7 @@ void Session_state::generate_session_request(Xml_generator &xml) const
break;
case INVALID_ARGS:
case QUOTA_EXCEEDED:
case INSUFFICIENT_RAM_QUOTA:
case AVAILABLE:
case CAP_HANDED_OUT:
case CLOSED:
@ -155,7 +155,7 @@ void Session_state::destroy()
Session_state::Session_state(Service &service,
Id_space<Parent::Client> &client_id_space,
Parent::Client::Id client_id,
Session_label const &label,
Session::Label const &label,
Args const &args,
Affinity const &affinity)
:

View File

@ -226,7 +226,7 @@ struct Audio_out::Root_policy
(sizeof(Stream) > ram_quota - session_size)) {
Genode::error("insufficient 'ram_quota', got ", ram_quota,
" need ", sizeof(Stream) + session_size);
throw ::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
}
char channel_name[16];
@ -417,7 +417,7 @@ struct Audio_in::Root_policy
Genode::error("insufficient 'ram_quota', got ", ram_quota,
" need ", sizeof(Stream) + session_size,
", denying '",Genode::label_from_args(args),"'");
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
}
char channel_name[16];

View File

@ -240,7 +240,7 @@ class Root : public Root_component
/* deplete ram quota by the memory needed for the session structure */
size_t session_size = max(4096UL, (unsigned long)sizeof(Usb_nic::Session_component));
if (ram_quota < session_size)
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
/*
* Check if donated ram quota suffices for both communication
@ -250,7 +250,7 @@ class Root : public Root_component
tx_buf_size + rx_buf_size > ram_quota - session_size) {
Genode::error("insufficient 'ram_quota', got ", ram_quota, " need %ld",
tx_buf_size + rx_buf_size + session_size);
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
}
return new (Root::md_alloc())

View File

@ -822,12 +822,12 @@ class Usb::Root : public Genode::Root_component<Session_component>
/* check session quota */
size_t session_size = max<size_t>(4096, sizeof(Session_component));
if (ram_quota < session_size)
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
if (tx_buf_size > ram_quota - session_size) {
error("Insufficient 'ram_quota',got ", ram_quota, " need ",
tx_buf_size + session_size);
throw Root::Quota_exceeded();
tx_buf_size + session_size);
throw Insufficient_ram_quota();
}
Ram_dataspace_capability tx_ds = _env.ram().alloc(tx_buf_size);

View File

@ -180,7 +180,7 @@ class Root : public Genode::Root_component<Wifi_session_component,
/* deplete ram quota by the memory needed for the session structure */
size_t session_size = max(4096UL, (unsigned long)sizeof(Wifi_session_component));
if (ram_quota < session_size)
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
/*
* Check if donated ram quota suffices for both communication

View File

@ -397,7 +397,7 @@ class File_system::Root : public Root_component<Session_component>
if (session_size > ram_quota) {
Genode::error("insufficient 'ram_quota' from ", label.string(),
" got ", ram_quota, "need ", session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
ram_quota -= session_size;

View File

@ -944,7 +944,7 @@ namespace File_system {
if (max((size_t)4096, session_size) > ram_quota) {
error("insufficient 'ram_quota', got ", ram_quota, ", "
"need ", session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
return new (md_alloc())
Session_component(_env, _heap, tx_buf_size,

View File

@ -480,7 +480,7 @@ class File_system::Root : public Root_component<Session_component>
if (max((size_t)4096, session_size) > ram_quota) {
Genode::error("insufficient 'ram_quota', got ", ram_quota, " , "
"need ", session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
return new (md_alloc())
Session_component(tx_buf_size, _ep, _rm, root_dir, writeable, *md_alloc());

View File

@ -270,7 +270,7 @@ class Block::Root : public Genode::Root_component<Block::Session_component,
sizeof(Session_component)
+ sizeof(Allocator_avl));
if (ram_quota < session_size)
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
/*
* Check if donated ram quota suffices for both
@ -280,7 +280,7 @@ class Block::Root : public Genode::Root_component<Block::Session_component,
if (tx_buf_size > ram_quota - session_size) {
error("insufficient 'ram_quota', got ", ram_quota, ", need ",
tx_buf_size + session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
return new (md_alloc()) Session_component(_driver_factory,

View File

@ -133,7 +133,7 @@ class Gpio::Root : public Genode::Root_component<Gpio::Session_component>
Genode::warning("insufficient dontated ram_quota "
"(", ram_quota, " bytes), "
"require ", sizeof(Session_component), " bytes");
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
}
return new (md_alloc()) Session_component(_ep, _driver, pin);

View File

@ -46,7 +46,7 @@ class Nic::Root : public Genode::Root_component<SESSION_COMPONENT,
/* deplete ram quota by the memory needed for the session structure */
size_t session_size = max(4096UL, (unsigned long)sizeof(SESSION_COMPONENT));
if (ram_quota < session_size)
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
/*
* Check if donated ram quota suffices for both communication
@ -56,7 +56,7 @@ class Nic::Root : public Genode::Root_component<SESSION_COMPONENT,
tx_buf_size + rx_buf_size > ram_quota - session_size) {
Genode::error("insufficient 'ram_quota', got ", ram_quota, ", "
"need ", tx_buf_size + rx_buf_size + session_size);
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
}
return new (Root::md_alloc())

View File

@ -43,7 +43,7 @@ class Genode::Attached_mmio : public Attached_io_mem_dataspace,
* \param write_combined enable write combining for the resource
*
* \throw Parent::Service_denied
* \throw Parent::Quota_exceeded
* \throw Insufficient_ram_quota
* \throw Parent::Unavailable
* \throw Rm_session::Attach_failed
*/

View File

@ -194,7 +194,7 @@ class Genode::Child_policy_dynamic_rom_file : public Rpc_object<Rom_session>,
break;
case Session_state::INVALID_ARGS:
case Session_state::QUOTA_EXCEEDED:
case Session_state::INSUFFICIENT_RAM_QUOTA:
case Session_state::AVAILABLE:
case Session_state::CAP_HANDED_OUT:
case Session_state::CLOSED:

View File

@ -213,7 +213,7 @@ class Genode::Slave::Connection_base
break;
case Session_state::INVALID_ARGS:
case Session_state::QUOTA_EXCEEDED:
case Session_state::INSUFFICIENT_RAM_QUOTA:
case Session_state::AVAILABLE:
case Session_state::CAP_HANDED_OUT:
case Session_state::CLOSED:
@ -272,7 +272,7 @@ struct Genode::Slave::Connection : private Connection_base<CONNECTION>,
* Constructor
*
* \throw Parent::Service_denied parent denies session request
* \throw Parent::Quota_exceeded our own quota does not suffice for
* \throw Out_of_ram our own quota does not suffice for
* the creation of the new session
*/
Connection(Slave::Policy &policy, Args const &args,

View File

@ -81,7 +81,7 @@ class Regulator::Root :
size_t session_size = max((size_t)4096,
sizeof(Session_component));
if (ram_quota < session_size)
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
if (!strlen(reg_name))
throw Root::Invalid_args();

View File

@ -129,7 +129,7 @@ struct Report::Root : Genode::Root_component<Session_component>
if (ram_quota < session_size) {
Genode::error("insufficient ram donation from ", label.string());
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
if (buffer_size == 0) {

View File

@ -113,7 +113,7 @@ class Block::Root_multiple_clients : public Root_component< ::Session_component>
if (max((size_t)4096, session_size) > ram_quota) {
error("insufficient 'ram_quota' from '", label, "',"
" got ", ram_quota, ", need ", session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
/* Search for configured device */

View File

@ -212,7 +212,7 @@ struct Audio_out::Root_policy
(sizeof(Stream) > ram_quota - session_size)) {
Genode::error("insufficient 'ram_quota', got ", ram_quota,
" need ", sizeof(Stream) + session_size);
throw ::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
}
char channel_name[16];

View File

@ -66,7 +66,7 @@ class Root : public Genode::Root_component<Lan9118, Genode::Single_client>
/* deplete ram quota by the memory needed for the session structure */
size_t session_size = max(4096UL, (unsigned long)sizeof(Lan9118));
if (ram_quota < session_size)
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
/*
* Check if donated ram quota suffices for both communication
@ -76,7 +76,7 @@ class Root : public Genode::Root_component<Lan9118, Genode::Single_client>
tx_buf_size + rx_buf_size > ram_quota - session_size) {
error("insufficient 'ram_quota', got ", ram_quota, ", "
"need ", tx_buf_size + rx_buf_size + session_size);
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
}
return new (Root::md_alloc())

View File

@ -253,7 +253,7 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
enum { OVERHEAD = 4096 };
try { _env_ram.transfer_quota(_ram, Genode::Ram_quota{OVERHEAD}); }
catch (...) { throw Genode::Root::Quota_exceeded(); }
catch (...) { throw Genode::Insufficient_ram_quota(); }
}
bool const _ram_initialized = (_init_ram(), true);
@ -331,7 +331,7 @@ class Platform::Session_component : public Genode::Rpc_object<Session>
/* thrown by 'Device_pd_policy' or 'Child' */
catch (Genode::Ram_session::Alloc_failed) { throw Out_of_metadata(); }
/* throw by 'Slave::Connection' */
catch (Genode::Parent::Quota_exceeded) { throw Out_of_metadata(); }
catch (Genode::Insufficient_ram_quota) { throw Out_of_metadata(); }
Device_pd_client &session() { return _connection; }

View File

@ -44,7 +44,7 @@ class Timer::Root_component : public Genode::Root_component<Session_component>
Arg_string::find_arg(args, "ram_quota").ulong_value(0);
if (ram_quota < sizeof(Session_component)) {
throw Root::Quota_exceeded(); }
throw Insufficient_ram_quota(); }
return new (md_alloc())
Session_component(_timeout_scheduler);

View File

@ -184,7 +184,7 @@ void Init::Server::_handle_create_session_request(Xml_node request,
size_t const keep_quota = route.service.factory().session_costs();
if (ram_quota.value < keep_quota)
throw Genode::Service::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
Ram_quota const forward_ram_quota { ram_quota.value - keep_quota };
@ -223,13 +223,13 @@ void Init::Server::_handle_create_session_request(Xml_node request,
if (session.phase == Session_state::INVALID_ARGS)
throw Parent::Service_denied();
if (session.phase == Session_state::QUOTA_EXCEEDED)
throw Genode::Service::Quota_exceeded();
if (session.phase == Session_state::INSUFFICIENT_RAM_QUOTA)
throw Genode::Insufficient_ram_quota();
}
catch (Parent::Service_denied) {
_env.parent().session_response(Parent::Server::Id { id.value }, Parent::INVALID_ARGS); }
catch (Genode::Service::Quota_exceeded) {
_env.parent().session_response(Parent::Server::Id { id.value }, Parent::QUOTA_EXCEEDED); }
catch (Genode::Insufficient_ram_quota) {
_env.parent().session_response(Parent::Server::Id { id.value }, Parent::INSUFFICIENT_RAM_QUOTA); }
}

View File

@ -70,7 +70,7 @@ class Fs_log::Root_component :
size_t ram_quota =
Arg_string::find_arg(args, "ram_quota").aligned_size();
if (ram_quota < sizeof(Session_component))
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
Path dir_path;
char file_name[MAX_NAME_LEN];

View File

@ -314,7 +314,7 @@ class Volume_descriptor : public Iso::Iso_base
Directory_record *buf;
if (!(alloc.alloc(ROOT_SIZE, &buf)))
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
memcpy(buf, root_record(), ROOT_SIZE);

View File

@ -142,7 +142,7 @@ class Iso::Root : public Iso::Root_component
Arg_string::find_arg(args, "ram_quota").ulong_value(0);
size_t session_size = sizeof(Rom_component) + sizeof(File_info);
if (ram_quota < session_size)
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
Session_label const label = label_from_args(args);
strncpy(_path, label.last_element().string(), sizeof(_path));

View File

@ -395,7 +395,7 @@ class File_system::Root : public Root_component<Session_component>
if (max((size_t)4096, session_size) > ram_quota) {
Genode::error("insufficient 'ram_quota', "
"got ", ram_quota, ", need ", session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
try {

View File

@ -676,7 +676,7 @@ class Audio_out::Root : public Audio_out::Root_component
(sizeof(Stream) > ram_quota - session_size)) {
Genode::error("insufficient 'ram_quota', got ", ram_quota, ", "
"need ", sizeof(Stream) + session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
Channel::Number ch = number_from_string(channel_name);

View File

@ -217,12 +217,12 @@ class Net::Root : public Genode::Root_component<Net::Session_component>
Session_component(_env.ram(), _env.rm(), _env.ep(),
ram_quota, tx_buf_size, rx_buf_size,
_mac_alloc.alloc(), _nic, ip_addr);
} catch(Mac_allocator::Alloc_failed) {
} catch (Mac_allocator::Alloc_failed) {
Genode::warning("Mac address allocation failed!");
throw Root::Unavailable();
} catch(Ram_session::Quota_exceeded) {
Genode::warning("insufficient 'ram_quota'");
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
}

View File

@ -132,14 +132,14 @@ Session_component *Net::Root::_create_session(char const *args)
max((size_t)4096, sizeof(Session_component));
if (ram_quota < session_size) {
throw Root::Quota_exceeded(); }
throw Insufficient_ram_quota(); }
if (tx_buf_size > ram_quota - session_size ||
rx_buf_size > ram_quota - session_size ||
tx_buf_size + rx_buf_size > ram_quota - session_size)
{
error("insufficient 'ram_quota' for session creation");
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
return new (md_alloc())
Session_component(*md_alloc(), ram_quota - session_size,

View File

@ -156,7 +156,7 @@ class Nic_loopback::Root : public Root_component<Session_component>
/* deplete ram quota by the memory needed for the session structure */
size_t session_size = max(4096UL, (size_t)sizeof(Session_component));
if (ram_quota < session_size)
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
/*
* Check if donated ram quota suffices for both communication
@ -166,7 +166,7 @@ class Nic_loopback::Root : public Root_component<Session_component>
tx_buf_size + rx_buf_size > ram_quota - session_size) {
error("insufficient 'ram_quota', got ", ram_quota, ", "
"need ", tx_buf_size + rx_buf_size + session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
return new (md_alloc()) Session_component(tx_buf_size, rx_buf_size,

View File

@ -130,14 +130,14 @@ Session_component *Net::Root::_create_session(char const *args)
max((size_t)4096, sizeof(Session_component));
if (ram_quota < session_size) {
throw Root::Quota_exceeded(); }
throw Insufficient_ram_quota(); }
if (tx_buf_size > ram_quota - session_size ||
rx_buf_size > ram_quota - session_size ||
tx_buf_size + rx_buf_size > ram_quota - session_size)
{
error("insufficient 'ram_quota' for session creation");
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
return new (md_alloc())
Session_component(*md_alloc(), _timer, ram_quota - session_size,

View File

@ -1039,7 +1039,7 @@ class Nitpicker::Root : public Genode::Root_component<Session_component>
if (ram_quota < required_quota) {
Genode::warning("Insufficient dontated ram_quota (", ram_quota,
" bytes), require ", required_quota, " bytes");
throw Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
}
size_t const unused_quota = ram_quota - required_quota;

View File

@ -266,7 +266,7 @@ class Block::Root :
sizeof(Session_component)
+ sizeof(Allocator_avl));
if (ram_quota < session_size)
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
/*
* Check if donated ram quota suffices for both
@ -276,7 +276,7 @@ class Block::Root :
if (tx_buf_size > ram_quota - session_size) {
error("insufficient 'ram_quota', got ", ram_quota, ", need ",
tx_buf_size + session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
Ram_dataspace_capability ds_cap;

View File

@ -516,7 +516,7 @@ class File_system::Root : public Root_component<Session_component>
if (max((size_t)4096, session_size) > ram_quota) {
Genode::error("insufficient 'ram_quota', got ", ram_quota, ", "
"need ", session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
return new (md_alloc())
Session_component(tx_buf_size, _ep, _ram, _rm, _alloc,

View File

@ -107,7 +107,7 @@ namespace Genode {
/* delete ram quota by the memory needed for the session */
size_t session_size = max((size_t)4096, sizeof(Termlog_component));
if (ram_quota < session_size)
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
char label_buf[Termlog_component::LABEL_LEN];

View File

@ -1010,7 +1010,7 @@ class File_system::Root : public Root_component<Session_component>
if (max((size_t)4096, session_size) > ram_quota) {
Genode::error("insufficient 'ram_quota', got ", ram_quota, ", "
"need ", session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
return new (md_alloc())
Session_component(tx_buf_size, _ep, _ram, _rm, _env, _root_dir,

View File

@ -671,7 +671,7 @@ class Vfs_server::Root :
if (session_size > ram_quota) {
error("insufficient 'ram_quota' from '", label, "' "
"got ", ram_quota, ", need ", session_size);
throw Root::Quota_exceeded();
throw Insufficient_ram_quota();
}
ram_quota -= session_size;

View File

@ -219,7 +219,7 @@ class Root : public Genode::Root_component<Openvpn_component, Genode::Single_cli
/* deplete ram quota by the memory needed for the session structure */
size_t session_size = max(4096UL, (unsigned long)sizeof(Openvpn_component));
if (ram_quota < session_size)
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
/*
* Check if donated ram quota suffices for both communication
@ -229,7 +229,7 @@ class Root : public Genode::Root_component<Openvpn_component, Genode::Single_cli
tx_buf_size + rx_buf_size > ram_quota - session_size) {
Genode::error("insufficient 'ram_quota', got %ld, need %ld",
ram_quota, tx_buf_size + rx_buf_size + session_size);
throw Genode::Root::Quota_exceeded();
throw Genode::Insufficient_ram_quota();
}
Openvpn_component *component = new (Root::md_alloc())