mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 07:08:18 +00:00
core: throw Trace::Out_of_metadata in subjects()
While importing trace sources as trace subjects into a TRACE session, the session quota might become depleted. The TRACE session already keeps track of the session quota via an allocator guard but the 'subjects' RPC function missed to handle the out-of-memory condition. This patch reflects the error condition as an 'Out_of_metadata' exception to the TRACE client. It also contains an extension of the trace test to exercise the corner case.
This commit is contained in:
committed by
Christian Helmuth
parent
705257cf22
commit
5d678dba9e
@ -29,7 +29,14 @@ Dataspace_capability Session_component::dataspace()
|
||||
|
||||
size_t Session_component::subjects()
|
||||
{
|
||||
_subjects.import_new_sources(_sources);
|
||||
try {
|
||||
_subjects.import_new_sources(_sources);
|
||||
|
||||
} catch (Allocator::Out_of_memory) {
|
||||
|
||||
PWRN("TRACE session ran out of memory");
|
||||
throw Out_of_metadata();
|
||||
}
|
||||
|
||||
return _subjects.subjects((Subject_id *)_argument_buffer.base,
|
||||
_argument_buffer.size/sizeof(Subject_id));
|
||||
@ -155,7 +162,7 @@ Session_component::Session_component(Allocator &md_alloc, size_t ram_quota,
|
||||
_subjects(_subjects_slab, _ram, _sources),
|
||||
_argument_buffer(_ram, arg_buffer_size)
|
||||
{
|
||||
_md_alloc.withdraw(arg_buffer_size);
|
||||
_md_alloc.withdraw(_argument_buffer.size);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user