cli_monitor: API transition

Issue #1987
This commit is contained in:
Norman Feske 2017-02-17 10:53:59 +01:00 committed by Christian Helmuth
parent bfdadc55b2
commit e17811fb7a
4 changed files with 21 additions and 7 deletions

View File

@ -175,7 +175,7 @@ class Launcher::Subsystem_manager
try {
Child *child = new (_heap)
Child(_ram, label, binary_name.string(),
Child(_ram, _heap, label, binary_name.string(),
_env.pd(),
_env.ram(),
_env.ram_session_cap(),

View File

@ -45,12 +45,13 @@ class Cli_monitor::Child_base : public Genode::Child_policy
typedef Genode::size_t size_t;
typedef Genode::Registered<Genode::Parent_service> Parent_service;
typedef Genode::Registry<Parent_service> Parent_services;
private:
Ram &_ram;
Genode::Allocator &_alloc;
Genode::Session_label const _label;
Binary_name const _binary_name;
@ -60,7 +61,15 @@ class Cli_monitor::Child_base : public Genode::Child_policy
size_t _ram_quota;
size_t _ram_limit;
Parent_services _parent_services;
struct Parent_services : Genode::Registry<Parent_service>
{
Genode::Allocator &_alloc;
Parent_services(Genode::Allocator &alloc) : _alloc(alloc) { }
~Parent_services()
{
for_each([&] (Parent_service &s) { Genode::destroy(_alloc, &s); });
}
} _parent_services { _alloc };
enum { ENTRYPOINT_STACK_SIZE = 12*1024 };
Genode::Rpc_entrypoint _entrypoint;
@ -94,8 +103,11 @@ class Cli_monitor::Child_base : public Genode::Child_policy
* \param ref_ram used as reference account for the child'd RAM
* session and for allocating the backing store
* for the child's configuration
* \param alloc allocator used to fill parent-service registry
* on demand
*/
Child_base(Ram &ram,
Genode::Allocator &alloc,
Name const &label,
Binary_name const &binary_name,
Genode::Pd_session &pd_session,
@ -107,7 +119,7 @@ class Cli_monitor::Child_base : public Genode::Child_policy
Genode::Signal_context_capability yield_response_sig_cap,
Genode::Signal_context_capability exit_sig_cap)
:
_ram(ram),
_ram(ram), _alloc(alloc),
_label(label), _binary_name(binary_name),
_ref_ram_cap(ref_ram_cap), _ref_ram(ref_ram),
_ram_quota(ram_quota), _ram_limit(ram_limit),
@ -289,7 +301,7 @@ class Cli_monitor::Child_base : public Genode::Child_policy
if (service)
return *service;
return *new (Genode::env()->heap()) Parent_service(_parent_services, name);
return *new (_alloc) Parent_service(_parent_services, name);
}
void yield_response()

View File

@ -28,6 +28,7 @@ struct Cli_monitor::Child : Child_base, List<Child>::Element
Argument argument;
Child(Ram &ram,
Genode::Allocator &alloc,
Name const &label,
Binary_name const &binary,
Genode::Pd_session &pd_session,
@ -40,6 +41,7 @@ struct Cli_monitor::Child : Child_base, List<Child>::Element
Genode::Signal_context_capability exit_sig_cap)
:
Child_base(ram,
alloc,
label,
binary,
pd_session,

View File

@ -113,8 +113,8 @@ class Cli_monitor::Start_command : public Command
Child *child = 0;
try {
child = new (_alloc)
Child(_ram, label, binary_name, _pd, _ref_ram, _ref_ram_cap,
_local_rm, ram, ram_limit,
Child(_ram, _alloc, label, binary_name, _pd, _ref_ram,
_ref_ram_cap, _local_rm, ram, ram_limit,
_yield_response_sigh_cap, _exit_sig_cap);
}
catch (Genode::Parent::Service_denied) {