Core: exit with child
This commit is contained in:
parent
1955221146
commit
b15148c728
|
@ -130,6 +130,8 @@ namespace Genode {
|
|||
size_t max_caps() const override { return 10000; }
|
||||
|
||||
void wait_for_exit() override;
|
||||
|
||||
void child_exit() override;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -148,6 +148,8 @@ void Platform::wait_for_exit()
|
|||
lx_exit_group(0);
|
||||
}
|
||||
|
||||
void Platform::child_exit() { sigint_handler(0); }
|
||||
|
||||
|
||||
/*****************************
|
||||
** Support for IPC library **
|
||||
|
|
|
@ -79,6 +79,11 @@ namespace Genode {
|
|||
*/
|
||||
virtual void wait_for_exit() = 0;
|
||||
|
||||
/**
|
||||
* Handle exit of child
|
||||
*/
|
||||
virtual void child_exit() { };
|
||||
|
||||
/**
|
||||
* Return true if platform supports direct unmap (no mapping db)
|
||||
*/
|
||||
|
|
|
@ -119,6 +119,8 @@ class Core_child : public Child_policy
|
|||
|
||||
Child _child;
|
||||
|
||||
int &_exit_value;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
|
@ -128,14 +130,16 @@ class Core_child : public Child_policy
|
|||
Pd_session &core_pd, Capability<Pd_session> core_pd_cap,
|
||||
Cpu_session &core_cpu, Capability<Cpu_session> core_cpu_cap,
|
||||
Cap_quota cap_quota, Ram_quota ram_quota,
|
||||
Rpc_entrypoint &ep)
|
||||
Rpc_entrypoint &ep,
|
||||
int &exit_value)
|
||||
:
|
||||
_services(services),
|
||||
_core_pd_cap (core_pd_cap), _core_pd (core_pd),
|
||||
_core_cpu_cap(core_cpu_cap), _core_cpu(core_cpu),
|
||||
_cap_quota(Child::effective_quota(cap_quota)),
|
||||
_ram_quota(Child::effective_quota(ram_quota)),
|
||||
_child(local_rm, ep, *this)
|
||||
_child(local_rm, ep, *this),
|
||||
_exit_value(exit_value)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -174,6 +178,13 @@ class Core_child : public Child_policy
|
|||
_core_cpu.transfer_quota(cap, Cpu_session::quota_lim_upscale(100, 100));
|
||||
}
|
||||
|
||||
void exit(int exit_value) override
|
||||
{
|
||||
_exit_value = exit_value;
|
||||
Child_policy::exit(exit_value);
|
||||
platform().child_exit();
|
||||
}
|
||||
|
||||
Pd_session &ref_pd() override { return _core_pd; }
|
||||
Pd_session_capability ref_pd_cap() const override { return _core_pd_cap; }
|
||||
|
||||
|
@ -221,6 +232,8 @@ namespace Genode {
|
|||
|
||||
int main()
|
||||
{
|
||||
int exit_value = 0;
|
||||
|
||||
/**
|
||||
* Disable tracing within core because it is currently not fully implemented.
|
||||
*/
|
||||
|
@ -309,10 +322,10 @@ int main()
|
|||
|
||||
static Reconstructible<Core_child>
|
||||
init(services, local_rm, core_pd, core_pd_cap, core_cpu, core_cpu_cap,
|
||||
init_cap_quota, init_ram_quota, ep);
|
||||
init_cap_quota, init_ram_quota, ep, exit_value);
|
||||
|
||||
platform().wait_for_exit();
|
||||
|
||||
init.destruct();
|
||||
return 0;
|
||||
return exit_value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user