X Tutup
Skip to content

Commit d4cc0ed

Browse files
committed
importd,logind: add --bus-introspect= option
1 parent 1e9bc92 commit d4cc0ed

File tree

9 files changed

+24
-2
lines changed

9 files changed

+24
-2
lines changed

src/hostname/hostnamed.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ static int run(int argc, char *argv[]) {
783783

784784
r = service_parse_argv("systemd-hostnamed.service",
785785
"Manage the system hostname and related metadata.",
786+
NULL,
786787
argc, argv);
787788
if (r <= 0)
788789
return r;

src/import/importd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,8 @@ static int run(int argc, char *argv[]) {
13761376

13771377
r = service_parse_argv("systemd-importd.service",
13781378
"VM and container image import and export service.",
1379+
BUS_IMPLEMENTATIONS(&manager_object,
1380+
&log_control_object),
13791381
argc, argv);
13801382
if (r <= 0)
13811383
return r;

src/locale/localed.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@ static int run(int argc, char *argv[]) {
757757

758758
r = service_parse_argv("systemd-localed.service",
759759
"Manage system locale settings and key mappings.",
760+
NULL,
760761
argc, argv);
761762
if (r <= 0)
762763
return r;

src/login/logind.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,8 @@ static int run(int argc, char *argv[]) {
11801180

11811181
r = service_parse_argv("systemd-logind.service",
11821182
"Manager for user logins and devices and privileged operations.",
1183+
BUS_IMPLEMENTATIONS(&manager_object,
1184+
&log_control_object),
11831185
argc, argv);
11841186
if (r <= 0)
11851187
return r;

src/machine/machined.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ static int run(int argc, char *argv[]) {
360360

361361
r = service_parse_argv("systemd-machined.service",
362362
"Manage registrations of local VMs and containers.",
363+
NULL,
363364
argc, argv);
364365
if (r <= 0)
365366
return r;

src/resolve/resolved.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ static int run(int argc, char *argv[]) {
2828

2929
r = service_parse_argv("systemd-resolved.service",
3030
"Provide name resolution with caching using DNS, mDNS, LLMNR.",
31+
NULL,
3132
argc, argv);
3233
if (r <= 0)
3334
return r;

src/shared/service-util.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "terminal-util.h"
1010
#include "util.h"
1111

12-
static int help(const char *program_path, const char *service, const char *description) {
12+
static int help(const char *program_path, const char *service, const char *description, bool bus_introspect) {
1313
_cleanup_free_ char *link = NULL;
1414
int r;
1515

@@ -23,6 +23,7 @@ static int help(const char *program_path, const char *service, const char *descr
2323
"%sOptions%s:\n"
2424
" -h --help Show this help\n"
2525
" --version Show package version\n"
26+
" --bus-introspect=PATH Write D-Bus XML introspection data\n"
2627
"\nSee the %s for details.\n"
2728
, program_path
2829
, ansi_highlight(), description, ansi_normal()
@@ -36,15 +37,18 @@ static int help(const char *program_path, const char *service, const char *descr
3637
int service_parse_argv(
3738
const char *service,
3839
const char *description,
40+
const BusObjectImplementation* const* bus_objects,
3941
int argc, char *argv[]) {
4042

4143
enum {
4244
ARG_VERSION = 0x100,
45+
ARG_BUS_INTROSPECT,
4346
};
4447

4548
static const struct option options[] = {
4649
{ "help", no_argument, NULL, 'h' },
4750
{ "version", no_argument, NULL, ARG_VERSION },
51+
{ "bus-introspect", required_argument, NULL, ARG_BUS_INTROSPECT },
4852
{}
4953
};
5054

@@ -57,11 +61,17 @@ int service_parse_argv(
5761
switch(c) {
5862

5963
case 'h':
60-
return help(argv[0], service, description);
64+
return help(argv[0], service, description, bus_objects);
6165

6266
case ARG_VERSION:
6367
return version();
6468

69+
case ARG_BUS_INTROSPECT:
70+
return bus_introspect_implementations(
71+
stdout,
72+
optarg,
73+
bus_objects);
74+
6575
case '?':
6676
return -EINVAL;
6777

src/shared/service-util.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
/* SPDX-License-Identifier: LGPL-2.1+ */
22
#pragma once
33

4+
#include "bus-util.h"
5+
46
int service_parse_argv(
57
const char *service,
68
const char *description,
9+
const BusObjectImplementation* const* bus_objects,
710
int argc, char *argv[]);

src/timedate/timedated.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,7 @@ static int run(int argc, char *argv[]) {
11291129

11301130
r = service_parse_argv("systemd-timedated.service",
11311131
"Manage the system clock and timezone and NTP enablement.",
1132+
NULL,
11321133
argc, argv);
11331134
if (r <= 0)
11341135
return r;

0 commit comments

Comments
 (0)
X Tutup