[systemd-devel] [PATCH] [RFC] Introspect and monitor dropin configuration

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sun Mar 31 08:07:10 PDT 2013


On Sun, Mar 31, 2013 at 04:52:54PM +0300, Oleksii Shevchuk wrote:
> ---
>  src/core/dbus-unit.c   |  1 +
>  src/core/load-dropin.c | 60 ++++++++++++++++++++++++++++++++++----------------
>  src/core/load-dropin.h |  1 +
>  src/core/unit.c        | 21 ++++++++++++++++++
>  src/core/unit.h        |  2 ++
>  5 files changed, 66 insertions(+), 19 deletions(-)
> 
> diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
> index dc7d1f1..f413386 100644
> --- a/src/core/dbus-unit.c
> +++ b/src/core/dbus-unit.c
> @@ -1284,6 +1284,7 @@ const BusProperty bus_unit_properties[] = {
>          { "SubState",             bus_unit_append_sub_state,          "s", 0 },
>          { "FragmentPath",         bus_property_append_string,         "s", offsetof(Unit, fragment_path),                              true },
>          { "SourcePath",           bus_property_append_string,         "s", offsetof(Unit, source_path),                                true },
> +        { "DropinPaths",          bus_property_append_strv,          "as", offsetof(Unit, dropin_paths),                               true },
>          { "UnitFileState",        bus_unit_append_file_state,         "s", 0 },
>          { "InactiveExitTimestamp",bus_property_append_usec,           "t", offsetof(Unit, inactive_exit_timestamp.realtime)   },
>          { "InactiveExitTimestampMonotonic", bus_property_append_usec, "t", offsetof(Unit, inactive_exit_timestamp.monotonic)  },
> diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c
> index 95c9a38..8925f29 100644
> --- a/src/core/load-dropin.c
> +++ b/src/core/load-dropin.c
> @@ -137,12 +137,44 @@ static int process_dir(Unit *u, const char *unit_path, const char *name, const c
>          return 0;
>  }
>  
> -int unit_load_dropin(Unit *u) {
> +char ** unit_find_dropin_paths(Unit *u) {
>          Iterator i;
>          char *t;
>          _cleanup_strv_free_ char **strv = NULL;
> +        char ** configs = NULL;
The usual style is:   char **configs = NULL;

> +        STRV_FOREACH(j, u->dropin_paths)
> +                fprintf(f, "%s\tDropin Path: %s\n", prefix, *j);
Hm, can we not use *j for paths? This is confusing as hell.

I didn't actually test this, but it looks quite useful.

Zbyszek


More information about the systemd-devel mailing list