summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/dbus.c2
-rw-r--r--src/hostname/hostnamed.c2
-rw-r--r--src/libsystemd-bus/bus-control.c19
-rw-r--r--src/libsystemd-bus/bus-kernel.c2
-rw-r--r--src/libsystemd-bus/bus-protocol.h8
-rw-r--r--src/locale/localed.c2
-rw-r--r--src/login/logind.c2
-rw-r--r--src/machine/machined.c2
-rw-r--r--src/systemd/sd-bus-protocol.h10
-rw-r--r--src/systemd/sd-bus-vtable.h1
-rw-r--r--src/systemd/sd-bus.h8
-rw-r--r--src/timedate/timedated.c2
12 files changed, 35 insertions, 25 deletions
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 580bdf3f71..df501384bd 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -801,7 +801,7 @@ static int bus_setup_api(Manager *m, sd_bus *bus) {
* after the new connection is set up and the name installed
* to allow clients to synchronously wait for reexecution to
* finish */
- r = sd_bus_request_name(bus,"org.freedesktop.systemd1", SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_DO_NOT_QUEUE|SD_BUS_NAME_ALLOW_REPLACEMENT);
+ r = sd_bus_request_name(bus,"org.freedesktop.systemd1", SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_ALLOW_REPLACEMENT);
if (r < 0) {
log_error("Failed to register name: %s", strerror(-r));
return r;
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index ece2b41671..3f08d1c0ec 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -574,7 +574,7 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
return r;
}
- r = sd_bus_request_name(bus, "org.freedesktop.hostname1", SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_DO_NOT_QUEUE);
+ r = sd_bus_request_name(bus, "org.freedesktop.hostname1", 0);
if (r < 0) {
log_error("Failed to register name: %s", strerror(-r));
return r;
diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c
index b9700068b6..2682439427 100644
--- a/src/libsystemd-bus/bus-control.c
+++ b/src/libsystemd-bus/bus-control.c
@@ -49,7 +49,7 @@ _public_ int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
return 0;
}
-static int bus_request_name_kernel(sd_bus *bus, const char *name, unsigned flags) {
+static int bus_request_name_kernel(sd_bus *bus, const char *name, uint64_t flags) {
struct kdbus_cmd_name *n;
size_t l;
int r;
@@ -77,14 +77,21 @@ static int bus_request_name_kernel(sd_bus *bus, const char *name, unsigned flags
return 1;
}
-static int bus_request_name_dbus1(sd_bus *bus, const char *name, unsigned flags) {
+static int bus_request_name_dbus1(sd_bus *bus, const char *name, uint64_t flags) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
- uint32_t ret;
+ uint32_t ret, param = 0;
int r;
assert(bus);
assert(name);
+ if (flags & SD_BUS_NAME_ALLOW_REPLACEMENT)
+ param |= BUS_NAME_ALLOW_REPLACEMENT;
+ if (flags & SD_BUS_NAME_REPLACE_EXISTING)
+ param |= BUS_NAME_REPLACE_EXISTING;
+ if (!(flags & SD_BUS_NAME_QUEUE))
+ param |= BUS_NAME_DO_NOT_QUEUE;
+
r = sd_bus_call_method(
bus,
"org.freedesktop.DBus",
@@ -95,7 +102,7 @@ static int bus_request_name_dbus1(sd_bus *bus, const char *name, unsigned flags)
&reply,
"su",
name,
- flags);
+ param);
if (r < 0)
return r;
@@ -115,13 +122,13 @@ static int bus_request_name_dbus1(sd_bus *bus, const char *name, unsigned flags)
return -EIO;
}
-_public_ int sd_bus_request_name(sd_bus *bus, const char *name, unsigned flags) {
+_public_ int sd_bus_request_name(sd_bus *bus, const char *name, uint64_t flags) {
assert_return(bus, -EINVAL);
assert_return(name, -EINVAL);
assert_return(bus->bus_client, -EINVAL);
assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
- assert_return(!(flags & ~(SD_BUS_NAME_ALLOW_REPLACEMENT|SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_DO_NOT_QUEUE)), -EINVAL);
+ assert_return(!(flags & ~(SD_BUS_NAME_ALLOW_REPLACEMENT|SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_QUEUE)), -EINVAL);
if (bus->is_kernel)
return bus_request_name_kernel(bus, name, flags);
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 81dfba7476..0437c96a9e 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -1020,7 +1020,7 @@ int kdbus_translate_request_name_flags(uint64_t flags, uint64_t *kdbus_flags) {
if (flags & SD_BUS_NAME_REPLACE_EXISTING)
f |= KDBUS_NAME_REPLACE_EXISTING;
- if (!(flags & SD_BUS_NAME_DO_NOT_QUEUE))
+ if (!(flags & SD_BUS_NAME_QUEUE))
f |= KDBUS_NAME_QUEUE;
*kdbus_flags = f;
diff --git a/src/libsystemd-bus/bus-protocol.h b/src/libsystemd-bus/bus-protocol.h
index 982461bd9d..4726d9345d 100644
--- a/src/libsystemd-bus/bus-protocol.h
+++ b/src/libsystemd-bus/bus-protocol.h
@@ -60,6 +60,14 @@ enum {
_BUS_MESSAGE_HEADER_MAX
};
+/* RequestName parameters */
+
+enum {
+ BUS_NAME_ALLOW_REPLACEMENT = 1,
+ BUS_NAME_REPLACE_EXISTING = 2,
+ BUS_NAME_DO_NOT_QUEUE = 4
+};
+
/* RequestName returns */
enum {
BUS_NAME_PRIMARY_OWNER = 1,
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 7c41822a2f..65318b6067 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -1094,7 +1094,7 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
return r;
}
- r = sd_bus_request_name(bus, "org.freedesktop.locale1", SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_DO_NOT_QUEUE);
+ r = sd_bus_request_name(bus, "org.freedesktop.locale1", 0);
if (r < 0) {
log_error("Failed to register name: %s", strerror(-r));
return r;
diff --git a/src/login/logind.c b/src/login/logind.c
index 5ce79b23c2..222608743e 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -727,7 +727,7 @@ static int manager_connect_bus(Manager *m) {
return r;
}
- r = sd_bus_request_name(m->bus, "org.freedesktop.login1", SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_DO_NOT_QUEUE);
+ r = sd_bus_request_name(m->bus, "org.freedesktop.login1", 0);
if (r < 0) {
log_error("Failed to register name: %s", strerror(-r));
return r;
diff --git a/src/machine/machined.c b/src/machine/machined.c
index d639603527..6550075b56 100644
--- a/src/machine/machined.c
+++ b/src/machine/machined.c
@@ -219,7 +219,7 @@ static int manager_connect_bus(Manager *m) {
return r;
}
- r = sd_bus_request_name(m->bus, "org.freedesktop.machine1", SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_DO_NOT_QUEUE);
+ r = sd_bus_request_name(m->bus, "org.freedesktop.machine1", 0);
if (r < 0) {
log_error("Failed to register name: %s", strerror(-r));
return r;
diff --git a/src/systemd/sd-bus-protocol.h b/src/systemd/sd-bus-protocol.h
index b2db7e46b8..1967fa8f04 100644
--- a/src/systemd/sd-bus-protocol.h
+++ b/src/systemd/sd-bus-protocol.h
@@ -22,8 +22,6 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <endian.h>
-
#include "_sd-common.h"
_SD_BEGIN_DECLARATIONS;
@@ -66,14 +64,6 @@ enum {
SD_BUS_TYPE_DICT_ENTRY_END = '}',
};
-/* RequestName parameters */
-
-enum {
- SD_BUS_NAME_ALLOW_REPLACEMENT = 1,
- SD_BUS_NAME_REPLACE_EXISTING = 2,
- SD_BUS_NAME_DO_NOT_QUEUE = 4
-};
-
/* Well-known errors. Note that this is only a sanitized subset of the
* errors that the reference implementation generates. */
diff --git a/src/systemd/sd-bus-vtable.h b/src/systemd/sd-bus-vtable.h
index 5400e9a661..cc029eb1a7 100644
--- a/src/systemd/sd-bus-vtable.h
+++ b/src/systemd/sd-bus-vtable.h
@@ -37,7 +37,6 @@ enum {
_SD_BUS_VTABLE_SIGNAL = 'S',
_SD_BUS_VTABLE_PROPERTY = 'P',
_SD_BUS_VTABLE_WRITABLE_PROPERTY = 'W',
- _SD_BUS_VTABLE_CHILDREN = 'C',
};
enum {
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index 402fc55f93..3c3cea042e 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -75,6 +75,12 @@ enum {
_SD_BUS_CREDS_ALL = (1ULL << 24) -1,
};
+enum {
+ SD_BUS_NAME_REPLACE_EXISTING = 1ULL << 0,
+ SD_BUS_NAME_ALLOW_REPLACEMENT = 1ULL << 1,
+ SD_BUS_NAME_QUEUE = 1ULL << 2,
+};
+
/* Callbacks */
typedef int (*sd_bus_message_handler_t)(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *ret_error);
@@ -234,7 +240,7 @@ int sd_bus_message_rewind(sd_bus_message *m, int complete);
/* Bus management */
int sd_bus_get_unique_name(sd_bus *bus, const char **unique);
-int sd_bus_request_name(sd_bus *bus, const char *name, unsigned flags);
+int sd_bus_request_name(sd_bus *bus, const char *name, uint64_t flags);
int sd_bus_release_name(sd_bus *bus, const char *name);
int sd_bus_list_names(sd_bus *bus, char ***acquired, char ***activatable); /* free the results */
int sd_bus_get_owner(sd_bus *bus, const char *name, uint64_t mask, sd_bus_creds **creds); /* unref the result! */
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index e3421c24a9..37173a252c 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -791,7 +791,7 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
return r;
}
- r = sd_bus_request_name(bus, "org.freedesktop.timedate1", SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_DO_NOT_QUEUE);
+ r = sd_bus_request_name(bus, "org.freedesktop.timedate1", 0);
if (r < 0) {
log_error("Failed to register name: %s", strerror(-r));
return r;