From d3759811b656097af181ddc5ae1ab020325bafe5 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 22 Jan 2019 18:57:22 +0100 Subject: [PATCH] os/session_policy: warn if no policy exists The situation where a 'Session_policy' is constructed for a label with no matching policy is in almost all cases a configuration problem. A diagnostic message eases pin-pointing such mistaks. By adding the message to the 'Session_policy', servers don't need to manually handle the exception to provide diagnostic information. This simplifies the server code in many components. --- repos/gems/recipes/raw/motif_wm/decorator_init.config | 1 + repos/gems/recipes/raw/motif_wm/wm.config | 1 + repos/gems/recipes/raw/themed_wm/decorator_init.config | 1 + repos/os/include/os/session_policy.h | 2 ++ 4 files changed, 5 insertions(+) diff --git a/repos/gems/recipes/raw/motif_wm/decorator_init.config b/repos/gems/recipes/raw/motif_wm/decorator_init.config index c619ae141a..6043f6332b 100644 --- a/repos/gems/recipes/raw/motif_wm/decorator_init.config +++ b/repos/gems/recipes/raw/motif_wm/decorator_init.config @@ -12,6 +12,7 @@ </controls> + <default-policy/> </config> <route> <service name="ROM" label="window_layout"> <parent label="window_layout"/> </service> diff --git a/repos/gems/recipes/raw/motif_wm/wm.config b/repos/gems/recipes/raw/motif_wm/wm.config index cd558c071d..0ec71f3c74 100644 --- a/repos/gems/recipes/raw/motif_wm/wm.config +++ b/repos/gems/recipes/raw/motif_wm/wm.config @@ -45,6 +45,7 @@ <config> <policy label_prefix="decorator" role="decorator"/> <policy label_prefix="layouter" role="layouter"/> + <default-policy/> </config> <route> <service name="ROM" label="resize_request"> <child name="report_rom"/> </service> diff --git a/repos/gems/recipes/raw/themed_wm/decorator_init.config b/repos/gems/recipes/raw/themed_wm/decorator_init.config index 418b944716..62f6389197 100644 --- a/repos/gems/recipes/raw/themed_wm/decorator_init.config +++ b/repos/gems/recipes/raw/themed_wm/decorator_init.config @@ -14,6 +14,7 @@ <config> <libc/> <vfs> <tar name="plain_decorator_theme.tar"/> </vfs> + <default-policy/> </config> <route> <service name="ROM" label="window_layout"> <parent label="window_layout"/> </service> diff --git a/repos/os/include/os/session_policy.h b/repos/os/include/os/session_policy.h index 425e294d8d..eb1659fde2 100644 --- a/repos/os/include/os/session_policy.h +++ b/repos/os/include/os/session_policy.h @@ -15,6 +15,7 @@ #define _INCLUDE__OS__SESSION_POLICY_H_ #include <base/session_label.h> +#include <base/log.h> #include <session/session.h> #include <util/arg_string.h> #include <util/xml_node.h> @@ -199,6 +200,7 @@ class Genode::Session_policy : public Xml_node try { return config.sub_node("default-policy"); } catch (...) { } + warning("no policy defined for label '", label, "'"); throw No_policy_defined(); }