diff --git a/repos/os/include/init/child.h b/repos/os/include/init/child.h index 418b0e415f..ad21b4a396 100644 --- a/repos/os/include/init/child.h +++ b/repos/os/include/init/child.h @@ -424,6 +424,12 @@ class Init::Child : Child_policy, Child_service::Wakeup Reconstructible _start_node; + /* + * Version attribute of the start node, used to force child restarts. + */ + typedef String<80> Version; + Version _version { _start_node->xml().attribute_value("version", Version()) }; + Default_route_accessor &_default_route_accessor; Ram_limit_accessor &_ram_limit_accessor; @@ -816,6 +822,15 @@ class Init::Child : Child_policy, Child_service::Wakeup Genode::memcmp(start_node.addr(), _start_node->xml().addr(), start_node.size()) != 0) { + /* + * Check for a change of the version attribute, force restart + * if the version changed. + */ + if (_version != start_node.attribute_value("version", Version())) { + abandon(); + return MAY_HAVE_SIDE_EFFECTS; + } + /* * Start node changed * @@ -887,6 +902,9 @@ class Init::Child : Child_policy, Child_service::Wakeup xml.attribute("name", _unique_name); xml.attribute("binary", _binary_name); + if (_version.valid()) + xml.attribute("version", _version); + if (detail.ids()) xml.attribute("id", _id.value); diff --git a/repos/os/run/init.run b/repos/os/run/init.run index 5a8d2b93d5..0768b06cc3 100644 --- a/repos/os/run/init.run +++ b/repos/os/run/init.run @@ -203,7 +203,6 @@ append config { - @@ -218,7 +217,6 @@ append config { - @@ -232,6 +230,31 @@ append config { + + + + + + + + + + + + + + + + + + + + + + @@ -261,6 +284,7 @@ append config { config version (count 2). --> + @@ -302,7 +326,6 @@ append config { -