mirror of
https://github.com/systemd/systemd.git
synced 2025-01-27 18:04:05 +03:00
Merge pull request #27757 from dtardon/bus-locator
Convert more DBus calls to BusLocator
This commit is contained in:
commit
8ddc5f7699
@ -11,6 +11,7 @@
|
||||
#include "blockdev-util.h"
|
||||
#include "btrfs-util.h"
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-locator.h"
|
||||
#include "data-fd-util.h"
|
||||
#include "env-util.h"
|
||||
#include "errno-list.h"
|
||||
@ -2117,15 +2118,7 @@ int home_killall(Home *h) {
|
||||
if (asprintf(&unit, "user-" UID_FMT ".slice", h->uid) < 0)
|
||||
return log_oom();
|
||||
|
||||
r = sd_bus_call_method(
|
||||
h->manager->bus,
|
||||
"org.freedesktop.systemd1",
|
||||
"/org/freedesktop/systemd1",
|
||||
"org.freedesktop.systemd1.Manager",
|
||||
"KillUnit",
|
||||
&error,
|
||||
NULL,
|
||||
"ssi", unit, "all", SIGKILL);
|
||||
r = bus_call_method(h->manager->bus, bus_systemd_mgr, "KillUnit", &error, NULL, "ssi", unit, "all", SIGKILL);
|
||||
if (r < 0)
|
||||
log_full_errno(sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_UNIT) ? LOG_DEBUG : LOG_WARNING,
|
||||
r, "Failed to kill login processes of user, ignoring: %s", bus_error_message(&error, r));
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "build.h"
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
#include "bus-map-properties.h"
|
||||
#include "format-table.h"
|
||||
#include "hostname-setup.h"
|
||||
@ -298,13 +299,7 @@ static int get_one_name(sd_bus *bus, const char* attr, char **ret) {
|
||||
|
||||
/* This obtains one string property, and copy it if 'ret' is set, or print it otherwise. */
|
||||
|
||||
r = sd_bus_get_property(
|
||||
bus,
|
||||
"org.freedesktop.hostname1",
|
||||
"/org/freedesktop/hostname1",
|
||||
"org.freedesktop.hostname1",
|
||||
attr,
|
||||
&error, &reply, "s");
|
||||
r = bus_get_property(bus, bus_hostname, attr, &error, &reply, "s");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not get property: %s", bus_error_message(&error, r));
|
||||
|
||||
@ -408,15 +403,7 @@ static int show_status(int argc, char **argv, void *userdata) {
|
||||
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
||||
const char *text = NULL;
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
"org.freedesktop.hostname1",
|
||||
"/org/freedesktop/hostname1",
|
||||
"org.freedesktop.hostname1",
|
||||
"Describe",
|
||||
&error,
|
||||
&reply,
|
||||
NULL);
|
||||
r = bus_call_method(bus, bus_hostname, "Describe", &error, &reply, NULL);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not get description: %s", bus_error_message(&error, r));
|
||||
|
||||
@ -448,14 +435,7 @@ static int set_simple_string_internal(sd_bus *bus, sd_bus_error *error, const ch
|
||||
if (!error)
|
||||
error = &e;
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
"org.freedesktop.hostname1",
|
||||
"/org/freedesktop/hostname1",
|
||||
"org.freedesktop.hostname1",
|
||||
method,
|
||||
error, NULL,
|
||||
"sb", value, arg_ask_password);
|
||||
r = bus_call_method(bus, bus_hostname, method, error, NULL, "sb", value, arg_ask_password);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set %s: %s", target, bus_error_message(error, r));
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "build.h"
|
||||
#include "bus-locator.h"
|
||||
#include "bus-util.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
@ -704,14 +705,7 @@ static int get_virtualization(char **v) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = sd_bus_get_property_string(
|
||||
bus,
|
||||
"org.freedesktop.systemd1",
|
||||
"/org/freedesktop/systemd1",
|
||||
"org.freedesktop.systemd1.Manager",
|
||||
"Virtualization",
|
||||
NULL,
|
||||
&b);
|
||||
r = bus_get_property_string(bus, bus_systemd_mgr, "Virtualization", NULL, &b);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "alloc-util.h"
|
||||
#include "build.h"
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
#include "bus-util.h"
|
||||
#include "catalog.h"
|
||||
#include "chase.h"
|
||||
@ -2246,15 +2247,7 @@ static int run(int argc, char *argv[]) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to open system bus: %m");
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
"org.freedesktop.machine1",
|
||||
"/org/freedesktop/machine1",
|
||||
"org.freedesktop.machine1.Manager",
|
||||
"OpenMachineRootDirectory",
|
||||
&error,
|
||||
&reply,
|
||||
"s", arg_machine);
|
||||
r = bus_call_method(bus, bus_machine_mgr, "OpenMachineRootDirectory", &error, &reply, "s", arg_machine);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to open root directory: %s", bus_error_message(&error, r));
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "alloc-util.h"
|
||||
#include "build.h"
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
#include "bus-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-table.h"
|
||||
@ -41,15 +42,7 @@ static int inhibit(sd_bus *bus, sd_bus_error *error) {
|
||||
int r;
|
||||
int fd;
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
"org.freedesktop.login1",
|
||||
"/org/freedesktop/login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
"Inhibit",
|
||||
error,
|
||||
&reply,
|
||||
"ssss", arg_what, arg_who, arg_why, arg_mode);
|
||||
r = bus_call_method(bus, bus_login_mgr, "Inhibit", error, &reply, "ssss", arg_what, arg_who, arg_why, arg_mode);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@ -68,15 +61,7 @@ static int print_inhibitors(sd_bus *bus) {
|
||||
|
||||
pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
"org.freedesktop.login1",
|
||||
"/org/freedesktop/login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
"ListInhibitors",
|
||||
&error,
|
||||
&reply,
|
||||
"");
|
||||
r = bus_call_method(bus, bus_login_mgr, "ListInhibitors", &error, &reply, NULL);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not get active inhibitors: %s", bus_error_message(&error, r));
|
||||
|
||||
|
@ -917,14 +917,7 @@ static int show_user(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to look up user %s: %m", argv[i]);
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
"org.freedesktop.login1",
|
||||
"/org/freedesktop/login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
"GetUser",
|
||||
&error, &reply,
|
||||
"u", (uint32_t) uid);
|
||||
r = bus_call_method(bus, bus_login_mgr, "GetUser", &error, &reply, "u", (uint32_t) uid);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get user: %s", bus_error_message(&error, r));
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "alloc-util.h"
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
#include "bus-util.h"
|
||||
#include "cgroup-util.h"
|
||||
#include "clean-ipc.h"
|
||||
@ -388,13 +389,7 @@ static int user_update_slice(User *u) {
|
||||
u->user_record->io_weight == UINT64_MAX)
|
||||
return 0;
|
||||
|
||||
r = sd_bus_message_new_method_call(
|
||||
u->manager->bus,
|
||||
&m,
|
||||
"org.freedesktop.systemd1",
|
||||
"/org/freedesktop/systemd1",
|
||||
"org.freedesktop.systemd1.Manager",
|
||||
"SetUnitProperties");
|
||||
r = bus_message_new_method_call(u->manager->bus, &m, bus_systemd_mgr, "SetUnitProperties");
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "sd-bus.h"
|
||||
|
||||
#include "bus-locator.h"
|
||||
#include "bus-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "macro.h"
|
||||
@ -16,14 +17,7 @@ static int inhibit(sd_bus *bus, const char *what) {
|
||||
int fd;
|
||||
int r;
|
||||
|
||||
r = sd_bus_call_method(bus,
|
||||
"org.freedesktop.login1",
|
||||
"/org/freedesktop/login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
"Inhibit",
|
||||
&error,
|
||||
&reply,
|
||||
"ssss", what, who, reason, mode);
|
||||
r = bus_call_method(bus, bus_login_mgr, "Inhibit", &error, &reply, "ssss", what, who, reason, mode);
|
||||
assert_se(r >= 0);
|
||||
|
||||
r = sd_bus_message_read_basic(reply, SD_BUS_TYPE_UNIX_FD, &fd);
|
||||
@ -41,14 +35,7 @@ static void print_inhibitors(sd_bus *bus) {
|
||||
unsigned n = 0;
|
||||
int r;
|
||||
|
||||
r = sd_bus_call_method(bus,
|
||||
"org.freedesktop.login1",
|
||||
"/org/freedesktop/login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
"ListInhibitors",
|
||||
&error,
|
||||
&reply,
|
||||
"");
|
||||
r = bus_call_method(bus, bus_login_mgr, "ListInhibitors", &error, &reply, NULL);
|
||||
assert_se(r >= 0);
|
||||
|
||||
r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssssuu)");
|
||||
|
@ -57,7 +57,7 @@ TEST(set_type) {
|
||||
|
||||
/* Type is reset to the original value when we release control of the session */
|
||||
assert_se(!streq(type, "tty"));
|
||||
assert_se(bus_call_method(bus, &session, "ReleaseControl", NULL, NULL, "") >= 0);
|
||||
assert_se(bus_call_method(bus, &session, "ReleaseControl", NULL, NULL, NULL) >= 0);
|
||||
type = mfree(type);
|
||||
assert_se(bus_get_property_string(bus, &session, "Type", NULL, &type) >= 0);
|
||||
assert_se(streq(type, "tty"));
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "sd-bus.h"
|
||||
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
#include "dev-setup.h"
|
||||
#include "format-util.h"
|
||||
#include "fs-util.h"
|
||||
@ -33,13 +34,13 @@ static int acquire_runtime_dir_properties(uint64_t *size, uint64_t *inodes) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to connect to system bus: %m");
|
||||
|
||||
r = sd_bus_get_property_trivial(bus, "org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", "RuntimeDirectorySize", &error, 't', size);
|
||||
r = bus_get_property_trivial(bus, bus_login_mgr, "RuntimeDirectorySize", &error, 't', size);
|
||||
if (r < 0) {
|
||||
log_warning_errno(r, "Failed to acquire runtime directory size, ignoring: %s", bus_error_message(&error, r));
|
||||
*size = physical_memory_scale(10U, 100U); /* 10% */
|
||||
}
|
||||
|
||||
r = sd_bus_get_property_trivial(bus, "org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", "RuntimeDirectoryInodesMax", &error, 't', inodes);
|
||||
r = bus_get_property_trivial(bus, bus_login_mgr, "RuntimeDirectoryInodesMax", &error, 't', inodes);
|
||||
if (r < 0) {
|
||||
log_warning_errno(r, "Failed to acquire number of inodes for runtime directory, ignoring: %s", bus_error_message(&error, r));
|
||||
*inodes = DIV_ROUND_UP(*size, 4096);
|
||||
|
@ -148,12 +148,10 @@ static int manager_connect_bus(Manager *m) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to request match on Connected signal: %m");
|
||||
|
||||
r = sd_bus_match_signal_async(
|
||||
r = bus_match_signal_async(
|
||||
m->bus,
|
||||
NULL,
|
||||
"org.freedesktop.login1",
|
||||
"/org/freedesktop/login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
bus_login_mgr,
|
||||
"PrepareForSleep",
|
||||
match_prepare_for_sleep, NULL, m);
|
||||
if (r < 0)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "btrfs-util.h"
|
||||
#include "build.h"
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
#include "bus-util.h"
|
||||
#include "cap-list.h"
|
||||
#include "capability-util.h"
|
||||
@ -2092,13 +2093,7 @@ static int resolved_listening(void) {
|
||||
if (r == 0)
|
||||
return 0;
|
||||
|
||||
r = sd_bus_get_property_string(bus,
|
||||
"org.freedesktop.resolve1",
|
||||
"/org/freedesktop/resolve1",
|
||||
"org.freedesktop.resolve1.Manager",
|
||||
"DNSStubListener",
|
||||
&error,
|
||||
&dns_stub_listener_mode);
|
||||
r = bus_get_property_string(bus, bus_resolve_mgr, "DNSStubListener", &error, &dns_stub_listener_mode);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to query DNSStubListener property: %s", bus_error_message(&error, r));
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "build.h"
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
#include "copy.h"
|
||||
#include "main-func.h"
|
||||
#include "pretty-print.h"
|
||||
@ -55,15 +56,7 @@ static int dump_state(int argc, char *argv[], void *userdata) {
|
||||
|
||||
pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
"org.freedesktop.oom1",
|
||||
"/org/freedesktop/oom1",
|
||||
"org.freedesktop.oom1.Manager",
|
||||
"DumpByFileDescriptor",
|
||||
&error,
|
||||
&reply,
|
||||
NULL);
|
||||
r = bus_call_method(bus, bus_oom_mgr, "DumpByFileDescriptor", &error, &reply, NULL);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to dump context: %s", bus_error_message(&error, r));
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
#include "chase.h"
|
||||
#include "conf-files.h"
|
||||
#include "copy.h"
|
||||
@ -780,13 +781,7 @@ static int unit_file_is_active(
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL, *reply = NULL;
|
||||
const char *at, *prefix, *joined;
|
||||
|
||||
r = sd_bus_message_new_method_call(
|
||||
bus,
|
||||
&m,
|
||||
"org.freedesktop.systemd1",
|
||||
"/org/freedesktop/systemd1",
|
||||
"org.freedesktop.systemd1.Manager",
|
||||
"ListUnitsByPatterns");
|
||||
r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, "ListUnitsByPatterns");
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
@ -242,13 +242,7 @@ static int maybe_reload(sd_bus **bus) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = sd_bus_message_new_method_call(
|
||||
*bus,
|
||||
&m,
|
||||
"org.freedesktop.systemd1",
|
||||
"/org/freedesktop/systemd1",
|
||||
"org.freedesktop.systemd1.Manager",
|
||||
"Reload");
|
||||
r = bus_message_new_method_call(*bus, &m, bus_systemd_mgr, "Reload");
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
|
||||
@ -566,12 +560,10 @@ static int maybe_enable_disable(sd_bus *bus, const char *path, bool enable) {
|
||||
if (!names)
|
||||
return log_oom();
|
||||
|
||||
r = sd_bus_message_new_method_call(
|
||||
r = bus_message_new_method_call(
|
||||
bus,
|
||||
&m,
|
||||
"org.freedesktop.systemd1",
|
||||
"/org/freedesktop/systemd1",
|
||||
"org.freedesktop.systemd1.Manager",
|
||||
bus_systemd_mgr,
|
||||
enable ? "EnableUnitFilesWithFlags" : "DisableUnitFilesWithFlags");
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "alloc-util.h"
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-get-properties.h"
|
||||
#include "bus-locator.h"
|
||||
#include "bus-log-control-api.h"
|
||||
#include "bus-message-util.h"
|
||||
#include "bus-polkit.h"
|
||||
@ -2282,12 +2283,10 @@ int manager_connect_bus(Manager *m) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to attach bus to event loop: %m");
|
||||
|
||||
r = sd_bus_match_signal_async(
|
||||
r = bus_match_signal_async(
|
||||
m->bus,
|
||||
NULL,
|
||||
"org.freedesktop.login1",
|
||||
"/org/freedesktop/login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
bus_login_mgr,
|
||||
"PrepareForSleep",
|
||||
match_prepare_for_sleep,
|
||||
NULL,
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "af-list.h"
|
||||
#include "alloc-util.h"
|
||||
#include "bus-common-errors.h"
|
||||
#include "bus-locator.h"
|
||||
#include "dns-type.h"
|
||||
#include "random-util.h"
|
||||
#include "resolved-def.h"
|
||||
@ -46,13 +47,7 @@ static void test_rr_lookup(sd_bus *bus, const char *name, uint16_t type, const c
|
||||
name = m;
|
||||
}
|
||||
|
||||
assert_se(sd_bus_message_new_method_call(
|
||||
bus,
|
||||
&req,
|
||||
"org.freedesktop.resolve1",
|
||||
"/org/freedesktop/resolve1",
|
||||
"org.freedesktop.resolve1.Manager",
|
||||
"ResolveRecord") >= 0);
|
||||
assert_se(bus_message_new_method_call(bus, &req, bus_resolve_mgr, "ResolveRecord") >= 0);
|
||||
|
||||
assert_se(sd_bus_message_append(req, "isqqt", 0, name, DNS_CLASS_IN, type, UINT64_C(0)) >= 0);
|
||||
|
||||
@ -83,13 +78,7 @@ static void test_hostname_lookup(sd_bus *bus, const char *name, int family, cons
|
||||
name = m;
|
||||
}
|
||||
|
||||
assert_se(sd_bus_message_new_method_call(
|
||||
bus,
|
||||
&req,
|
||||
"org.freedesktop.resolve1",
|
||||
"/org/freedesktop/resolve1",
|
||||
"org.freedesktop.resolve1.Manager",
|
||||
"ResolveHostname") >= 0);
|
||||
assert_se(bus_message_new_method_call(bus, &req, bus_resolve_mgr, "ResolveHostname") >= 0);
|
||||
|
||||
assert_se(sd_bus_message_append(req, "isit", 0, name, family, UINT64_C(0)) >= 0);
|
||||
|
||||
|
@ -39,6 +39,12 @@ const BusLocator* const bus_network_mgr = &(BusLocator){
|
||||
.interface = "org.freedesktop.network1.Manager"
|
||||
};
|
||||
|
||||
const BusLocator* const bus_oom_mgr = &(BusLocator){
|
||||
.destination = "org.freedesktop.oom1",
|
||||
.path = "/org/freedesktop/oom1",
|
||||
.interface = "org.freedesktop.oom1.Manager"
|
||||
};
|
||||
|
||||
const BusLocator* const bus_portable_mgr = &(BusLocator){
|
||||
.destination = "org.freedesktop.portable1",
|
||||
.path = "/org/freedesktop/portable1",
|
||||
@ -63,6 +69,12 @@ const BusLocator* const bus_timedate = &(BusLocator){
|
||||
.interface = "org.freedesktop.timedate1"
|
||||
};
|
||||
|
||||
const BusLocator* const bus_timesync_mgr = &(BusLocator){
|
||||
.destination = "org.freedesktop.timesync1",
|
||||
.path = "/org/freedesktop/timesync1",
|
||||
.interface = "org.freedesktop.timesync1.Manager"
|
||||
};
|
||||
|
||||
const BusLocator* const bus_hostname = &(BusLocator){
|
||||
.destination = "org.freedesktop.hostname1",
|
||||
.path = "/org/freedesktop/hostname1",
|
||||
|
@ -10,16 +10,18 @@ typedef struct BusLocator {
|
||||
} BusLocator;
|
||||
|
||||
extern const BusLocator* const bus_home_mgr;
|
||||
extern const BusLocator* const bus_hostname;
|
||||
extern const BusLocator* const bus_import_mgr;
|
||||
extern const BusLocator* const bus_locale;
|
||||
extern const BusLocator* const bus_login_mgr;
|
||||
extern const BusLocator* const bus_machine_mgr;
|
||||
extern const BusLocator* const bus_network_mgr;
|
||||
extern const BusLocator* const bus_oom_mgr;
|
||||
extern const BusLocator* const bus_portable_mgr;
|
||||
extern const BusLocator* const bus_resolve_mgr;
|
||||
extern const BusLocator* const bus_systemd_mgr;
|
||||
extern const BusLocator* const bus_timedate;
|
||||
extern const BusLocator* const bus_hostname;
|
||||
extern const BusLocator* const bus_timesync_mgr;
|
||||
|
||||
/* Shorthand flavors of the sd-bus convenience helpers with destination,path,interface strings encapsulated
|
||||
* within a single struct. */
|
||||
|
@ -147,13 +147,7 @@ static int lock_all_homes(void) {
|
||||
if (r < 0)
|
||||
return log_warning_errno(r, "Failed to connect to system bus, ignoring: %m");
|
||||
|
||||
r = sd_bus_message_new_method_call(
|
||||
bus,
|
||||
&m,
|
||||
"org.freedesktop.home1",
|
||||
"/org/freedesktop/home1",
|
||||
"org.freedesktop.home1.Manager",
|
||||
"LockAllHomes");
|
||||
r = bus_message_new_method_call(bus, &m, bus_home_mgr, "LockAllHomes");
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
#include "bus-util.h"
|
||||
#include "format-util.h"
|
||||
#include "log.h"
|
||||
@ -50,14 +51,7 @@ static usec_t get_startup_monotonic_time(Context *c) {
|
||||
|
||||
assert(c);
|
||||
|
||||
r = sd_bus_get_property_trivial(
|
||||
c->bus,
|
||||
"org.freedesktop.systemd1",
|
||||
"/org/freedesktop/systemd1",
|
||||
"org.freedesktop.systemd1.Manager",
|
||||
"UserspaceTimestampMonotonic",
|
||||
&error,
|
||||
't', &t);
|
||||
r = bus_get_property_trivial(c->bus, bus_systemd_mgr, "UserspaceTimestampMonotonic", &error, 't', &t);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to get timestamp: %s", bus_error_message(&error, r));
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user