summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-19 01:23:08 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-20 19:37:02 +0100
commit911121a7c837040454c5d0422e2a225a8d799eef (patch)
tree7347fbd3ecd0abf1eb6fcbd7319910f98bb73210 /src/libsystemd-bus
parentaea93debfa1281a7d5f1523225b043955c1c2472 (diff)
bus: add sd_bus_send_to() API call
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/libsystemd-bus.sym4
-rw-r--r--src/libsystemd-bus/sd-bus.c21
2 files changed, 22 insertions, 3 deletions
diff --git a/src/libsystemd-bus/libsystemd-bus.sym b/src/libsystemd-bus/libsystemd-bus.sym
index a1ffc439c1..8fa2cdec6d 100644
--- a/src/libsystemd-bus/libsystemd-bus.sym
+++ b/src/libsystemd-bus/libsystemd-bus.sym
@@ -43,9 +43,7 @@ global:
sd_bus_can_send;
sd_bus_get_server_id;
sd_bus_send;
- sd_bus_call;
- sd_bus_call_async;
- sd_bus_call_async_cancel;
+ sd_bus_send_to;
sd_bus_get_fd;
sd_bus_get_events;
sd_bus_get_timeout;
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 0be5a29f36..c8248e19aa 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -1435,6 +1435,27 @@ _public_ int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial) {
return 1;
}
+_public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *serial) {
+ int r;
+
+ assert_return(bus, -EINVAL);
+ assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
+ assert_return(m, -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ if (!streq_ptr(m->destination, destination)) {
+
+ if (!destination)
+ return -EEXIST;
+
+ r = sd_bus_message_set_destination(m, destination);
+ if (r < 0)
+ return r;
+ }
+
+ return sd_bus_send(bus, m, serial);
+}
+
static usec_t calc_elapse(uint64_t usec) {
if (usec == (uint64_t) -1)
return 0;