trace: extend for_each_subject_infos return value

Fixes #3811
This commit is contained in:
Alexander Boettcher 2020-07-07 16:48:04 +02:00 committed by Norman Feske
parent a7d170adda
commit 21e48a8e12
3 changed files with 6 additions and 4 deletions

View File

@ -86,8 +86,10 @@ struct Genode::Trace::Session_client : Genode::Rpc_client<Genode::Trace::Session
return num_subjects;
}
struct For_each_subject_info_result { size_t count; size_t limit; };
template <typename FN>
size_t for_each_subject_info(FN const &fn)
For_each_subject_info_result for_each_subject_info(FN const &fn)
{
size_t const num_subjects = call<Rpc_subject_infos>();
size_t const max_subjects = _argument_buffer.size / (sizeof(Subject_info) + sizeof(Subject_id));
@ -99,7 +101,7 @@ struct Genode::Trace::Session_client : Genode::Rpc_client<Genode::Trace::Session
fn(ids[i], infos[i]);
}
return num_subjects;
return { .count = num_subjects, .limit = max_subjects };
}
Policy_id alloc_policy(size_t size) override {

View File

@ -63,7 +63,7 @@ struct Genode::Trace::Connection : Genode::Connection<Genode::Trace::Session>,
}
template <typename FN>
size_t for_each_subject_info(FN const &fn)
For_each_subject_info_result for_each_subject_info(FN const &fn)
{
return _retry([&] () {
return Session_client::for_each_subject_info(fn); });

View File

@ -91,7 +91,7 @@ struct Trace_subject_registry
do {
try {
return trace.for_each_subject_info(fn);
return trace.for_each_subject_info(fn).count;
} catch (Genode::Out_of_ram) {
trace.upgrade_ram(4096);
}