summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/sd-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-21 15:02:07 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-21 21:42:49 +0100
commit069f5e61eb128aa08b6fdff12fc6ac71c3897b48 (patch)
treecd22cc5bdce3f1f19fd1fb08325665c220bfe772 /src/libsystemd/sd-bus/sd-bus.c
parent607553f9306286fdccf0b356bc3d1087adfe21c4 (diff)
bus: implement synchronous message calls via kernel ioctl
Diffstat (limited to 'src/libsystemd/sd-bus/sd-bus.c')
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 95d80db240..2c458f311c 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -1371,14 +1371,14 @@ int bus_seal_synthetic_message(sd_bus *b, sd_bus_message *m) {
return bus_message_seal(m, 0xFFFFFFFFULL, 0);
}
-static int bus_write_message(sd_bus *bus, sd_bus_message *m, size_t *idx) {
+static int bus_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call, size_t *idx) {
int r;
assert(bus);
assert(m);
if (bus->is_kernel)
- r = bus_kernel_write_message(bus, m);
+ r = bus_kernel_write_message(bus, m, hint_sync_call);
else
r = bus_socket_write_message(bus, m, idx);
@@ -1408,7 +1408,7 @@ static int dispatch_wqueue(sd_bus *bus) {
while (bus->wqueue_size > 0) {
- r = bus_write_message(bus, bus->wqueue[0], &bus->windex);
+ r = bus_write_message(bus, bus->wqueue[0], false, &bus->windex);
if (r < 0)
return r;
else if (r == 0)
@@ -1486,7 +1486,7 @@ static int dispatch_rqueue(sd_bus *bus, sd_bus_message **m) {
}
}
-_public_ int sd_bus_send(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie) {
+static int bus_send_internal(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie, bool hint_sync_call) {
_cleanup_bus_message_unref_ sd_bus_message *m = sd_bus_message_ref(_m);
int r;
@@ -1526,7 +1526,7 @@ _public_ int sd_bus_send(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie) {
if ((bus->state == BUS_RUNNING || bus->state == BUS_HELLO) && bus->wqueue_size <= 0) {
size_t idx = 0;
- r = bus_write_message(bus, m, &idx);
+ r = bus_write_message(bus, m, hint_sync_call, &idx);
if (r < 0) {
if (r == -ENOTCONN || r == -ECONNRESET || r == -EPIPE || r == -ESHUTDOWN) {
bus_enter_closing(bus);
@@ -1562,6 +1562,10 @@ _public_ int sd_bus_send(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie) {
return 1;
}
+_public_ int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *cookie) {
+ return bus_send_internal(bus, m, cookie, false);
+}
+
_public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *cookie) {
int r;
@@ -1755,7 +1759,7 @@ _public_ int sd_bus_call(
if (r < 0)
return r;
- r = sd_bus_send(bus, m, &cookie);
+ r = bus_send_internal(bus, m, &cookie, true);
if (r < 0)
return r;