diff --git a/repos/os/src/init/child.cc b/repos/os/src/init/child.cc index 29d7b7332..11c828870 100644 --- a/repos/os/src/init/child.cc +++ b/repos/os/src/init/child.cc @@ -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", [&] () { diff --git a/repos/os/src/init/child.h b/repos/os/src/init/child.h index 8b312e204..4410ed98f 100644 --- a/repos/os/src/init/child.h +++ b/repos/os/src/init/child.h @@ -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