mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 06:07:59 +00:00
init: generate a state report when children exit
Whenever a childs is terminated the exit value is propagate through a new state report. Thereby it becomes possibly for a managing component to react upon the terminating condition of a child. Issue #2558.
This commit is contained in:
parent
3b5a34c163
commit
eae0445cd8
@ -281,6 +281,9 @@ void Init::Child::report_state(Xml_generator &xml, Report_detail const &detail)
|
||||
if (!_child.active())
|
||||
xml.attribute("state", "incomplete");
|
||||
|
||||
if (_exited)
|
||||
xml.attribute("exited", _exit_value);
|
||||
|
||||
if (detail.child_ram() && _child.ram_session_cap().valid()) {
|
||||
xml.node("ram", [&] () {
|
||||
|
||||
|
@ -404,6 +404,14 @@ class Init::Child : Child_policy, Routed_service::Wakeup
|
||||
name, *this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Exit state of the child set when 'exit()' is executed
|
||||
* and reported afterwards through the state report.
|
||||
*/
|
||||
|
||||
bool _exited { false };
|
||||
int _exit_value { -1 };
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -535,6 +543,14 @@ class Init::Child : Child_policy, Routed_service::Wakeup
|
||||
}
|
||||
} catch (...) { }
|
||||
|
||||
/*
|
||||
* Trigger a new report for exited children so that any management
|
||||
* component may react upon it.
|
||||
*/
|
||||
_exited = true;
|
||||
_exit_value = exit_value;
|
||||
_report_update_trigger.trigger_report_update();
|
||||
|
||||
/*
|
||||
* Print a message as the exit is not handled otherwise. There are
|
||||
* a number of automated tests that rely on this message. It is
|
||||
|
Loading…
Reference in New Issue
Block a user