From: Zbigniew Jędrzejewski-Szmek Date: Tue, 28 Apr 2020 15:55:34 +0000 (+0200) Subject: importd,logind: add --bus-introspect= option X-Git-Tag: v246-rc1~433^2~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d4cc0edfced262b34be4e113bd527e651f1f0024;p=thirdparty%2Fsystemd.git importd,logind: add --bus-introspect= option --- diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index b2b5299b325..535c800bebc 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -783,6 +783,7 @@ static int run(int argc, char *argv[]) { r = service_parse_argv("systemd-hostnamed.service", "Manage the system hostname and related metadata.", + NULL, argc, argv); if (r <= 0) return r; diff --git a/src/import/importd.c b/src/import/importd.c index 398b2964b05..9408edece10 100644 --- a/src/import/importd.c +++ b/src/import/importd.c @@ -1376,6 +1376,8 @@ static int run(int argc, char *argv[]) { r = service_parse_argv("systemd-importd.service", "VM and container image import and export service.", + BUS_IMPLEMENTATIONS(&manager_object, + &log_control_object), argc, argv); if (r <= 0) return r; diff --git a/src/locale/localed.c b/src/locale/localed.c index a0fcadcc914..ef73448854e 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -757,6 +757,7 @@ static int run(int argc, char *argv[]) { r = service_parse_argv("systemd-localed.service", "Manage system locale settings and key mappings.", + NULL, argc, argv); if (r <= 0) return r; diff --git a/src/login/logind.c b/src/login/logind.c index 1bf1f21f002..d748e8f4b81 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -1180,6 +1180,8 @@ static int run(int argc, char *argv[]) { r = service_parse_argv("systemd-logind.service", "Manager for user logins and devices and privileged operations.", + BUS_IMPLEMENTATIONS(&manager_object, + &log_control_object), argc, argv); if (r <= 0) return r; diff --git a/src/machine/machined.c b/src/machine/machined.c index 191031e2aab..5a24f6ccc8d 100644 --- a/src/machine/machined.c +++ b/src/machine/machined.c @@ -360,6 +360,7 @@ static int run(int argc, char *argv[]) { r = service_parse_argv("systemd-machined.service", "Manage registrations of local VMs and containers.", + NULL, argc, argv); if (r <= 0) return r; diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c index 73da508d7ac..6f2b4c114e9 100644 --- a/src/resolve/resolved.c +++ b/src/resolve/resolved.c @@ -28,6 +28,7 @@ static int run(int argc, char *argv[]) { r = service_parse_argv("systemd-resolved.service", "Provide name resolution with caching using DNS, mDNS, LLMNR.", + NULL, argc, argv); if (r <= 0) return r; diff --git a/src/shared/service-util.c b/src/shared/service-util.c index 7fea74d2d95..c9b684fc05e 100644 --- a/src/shared/service-util.c +++ b/src/shared/service-util.c @@ -9,7 +9,7 @@ #include "terminal-util.h" #include "util.h" -static int help(const char *program_path, const char *service, const char *description) { +static int help(const char *program_path, const char *service, const char *description, bool bus_introspect) { _cleanup_free_ char *link = NULL; int r; @@ -23,6 +23,7 @@ static int help(const char *program_path, const char *service, const char *descr "%sOptions%s:\n" " -h --help Show this help\n" " --version Show package version\n" + " --bus-introspect=PATH Write D-Bus XML introspection data\n" "\nSee the %s for details.\n" , program_path , ansi_highlight(), description, ansi_normal() @@ -36,15 +37,18 @@ static int help(const char *program_path, const char *service, const char *descr int service_parse_argv( const char *service, const char *description, + const BusObjectImplementation* const* bus_objects, int argc, char *argv[]) { enum { ARG_VERSION = 0x100, + ARG_BUS_INTROSPECT, }; static const struct option options[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, ARG_VERSION }, + { "bus-introspect", required_argument, NULL, ARG_BUS_INTROSPECT }, {} }; @@ -57,11 +61,17 @@ int service_parse_argv( switch(c) { case 'h': - return help(argv[0], service, description); + return help(argv[0], service, description, bus_objects); case ARG_VERSION: return version(); + case ARG_BUS_INTROSPECT: + return bus_introspect_implementations( + stdout, + optarg, + bus_objects); + case '?': return -EINVAL; diff --git a/src/shared/service-util.h b/src/shared/service-util.h index f4868184f48..76bff61d58b 100644 --- a/src/shared/service-util.h +++ b/src/shared/service-util.h @@ -1,7 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once +#include "bus-util.h" + int service_parse_argv( const char *service, const char *description, + const BusObjectImplementation* const* bus_objects, int argc, char *argv[]); diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index 6dac0bafffa..7f2e3019d42 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -1129,6 +1129,7 @@ static int run(int argc, char *argv[]) { r = service_parse_argv("systemd-timedated.service", "Manage the system clock and timezone and NTP enablement.", + NULL, argc, argv); if (r <= 0) return r;