summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-01-20 23:42:05 +0100
committerKay Sievers <kay@vrfy.org>2014-01-20 23:45:36 +0100
commit97f82db3253fcaa557570eccfc55dae9ac2b16d5 (patch)
tree6bb90bff01caa726609a41af7bc967fcc156783d /src
parent49e6fdbf14b35d8840c3b263fd15259624b07818 (diff)
Revert "sd-bus: let sd_bus_call() use the synchronous kdbus method"
This reverts commit 021b89861d0b1defcbd6ba71d1aaf6271785a942. Something is not quite right, "KillUnit" sent from systemctl is not handled correctly and shutdown has problems.
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/bus-kernel.c36
-rw-r--r--src/libsystemd/bus-kernel.h1
-rw-r--r--src/libsystemd/bus-message.h1
-rw-r--r--src/libsystemd/sd-bus.c62
4 files changed, 25 insertions, 75 deletions
diff --git a/src/libsystemd/bus-kernel.c b/src/libsystemd/bus-kernel.c
index 5ace72440f..f85b4d5676 100644
--- a/src/libsystemd/bus-kernel.c
+++ b/src/libsystemd/bus-kernel.c
@@ -251,8 +251,7 @@ static int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) {
m->kdbus->flags =
((m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) ? 0 : KDBUS_MSG_FLAGS_EXPECT_REPLY) |
- ((m->header->flags & BUS_MESSAGE_NO_AUTO_START) ? KDBUS_MSG_FLAGS_NO_AUTO_START : 0) |
- (m->reply_sync ? KDBUS_MSG_FLAGS_SYNC_REPLY : 0);
+ ((m->header->flags & BUS_MESSAGE_NO_AUTO_START) ? KDBUS_MSG_FLAGS_NO_AUTO_START : 0);
m->kdbus->dst_id =
well_known ? 0 :
m->destination ? unique : KDBUS_DST_ID_BROADCAST;
@@ -789,39 +788,6 @@ int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m) {
return 0;
}
- if (m->reply_sync) {
- struct kdbus_msg *k;
-
- k = (struct kdbus_msg *)((uint8_t *)bus->kdbus_buffer + m->kdbus->offset_reply);
- r = bus_kernel_make_message(bus, k);
- if (r < 0)
- return r;
- }
-
- return 1;
-}
-
-int bus_call_kernel(
- sd_bus *bus,
- sd_bus_message *m,
- uint64_t usec,
- sd_bus_error *error,
- sd_bus_message **reply) {
-
- int r;
- uint64_t cookie;
-
- m->reply_sync = !!reply;
-
- r = sd_bus_send(bus, m, &cookie);
- if (r < 0)
- return r;
-
- if (reply) {
- assert(bus->rqueue_size > 0);
- *reply = bus->rqueue[--bus->rqueue_size];
- }
-
return 1;
}
diff --git a/src/libsystemd/bus-kernel.h b/src/libsystemd/bus-kernel.h
index 88954aa5cd..2aba0bbe0a 100644
--- a/src/libsystemd/bus-kernel.h
+++ b/src/libsystemd/bus-kernel.h
@@ -62,7 +62,6 @@ int bus_kernel_take_fd(sd_bus *b);
int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m);
int bus_kernel_read_message(sd_bus *bus);
-int bus_call_kernel(sd_bus *bus, sd_bus_message *m, uint64_t usec, sd_bus_error *error, sd_bus_message **reply);
int bus_kernel_create_bus(const char *name, bool world, char **s);
int bus_kernel_create_namespace(const char *name, char **s);
diff --git a/src/libsystemd/bus-message.h b/src/libsystemd/bus-message.h
index efddc97345..5322375ef1 100644
--- a/src/libsystemd/bus-message.h
+++ b/src/libsystemd/bus-message.h
@@ -107,7 +107,6 @@ struct sd_bus_message {
bool free_fds:1;
bool release_kdbus:1;
bool poisoned:1;
- bool reply_sync:1;
struct bus_header *header;
struct bus_body_part body;
diff --git a/src/libsystemd/sd-bus.c b/src/libsystemd/sd-bus.c
index fa045a6725..95d80db240 100644
--- a/src/libsystemd/sd-bus.c
+++ b/src/libsystemd/sd-bus.c
@@ -1720,19 +1720,41 @@ int bus_ensure_running(sd_bus *bus) {
}
}
-static int bus_call_dbus1(
+_public_ int sd_bus_call(
sd_bus *bus,
- sd_bus_message *m,
+ sd_bus_message *_m,
uint64_t usec,
sd_bus_error *error,
sd_bus_message **reply) {
+ _cleanup_bus_message_unref_ sd_bus_message *m = sd_bus_message_ref(_m);
usec_t timeout;
uint64_t cookie;
unsigned i;
int r;
+ assert_return(bus, -EINVAL);
+ assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
+ assert_return(m, -EINVAL);
+ assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
+ assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL);
+ assert_return(!bus_error_is_dirty(error), -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ r = bus_ensure_running(bus);
+ if (r < 0)
+ return r;
+
i = bus->rqueue_size;
+
+ r = bus_seal_message(bus, m, usec);
+ if (r < 0)
+ return r;
+
+ r = bus_remarshal_message(bus, &m);
+ if (r < 0)
+ return r;
+
r = sd_bus_send(bus, m, &cookie);
if (r < 0)
return r;
@@ -1831,42 +1853,6 @@ static int bus_call_dbus1(
}
}
-_public_ int sd_bus_call(
- sd_bus *bus,
- sd_bus_message *_m,
- uint64_t usec,
- sd_bus_error *error,
- sd_bus_message **reply) {
-
- _cleanup_bus_message_unref_ sd_bus_message *m = sd_bus_message_ref(_m);
- int r;
-
- assert_return(bus, -EINVAL);
- assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
- assert_return(m, -EINVAL);
- assert_return(m->header->type == SD_BUS_MESSAGE_METHOD_CALL, -EINVAL);
- assert_return(!(m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED), -EINVAL);
- assert_return(!bus_error_is_dirty(error), -EINVAL);
- assert_return(!bus_pid_changed(bus), -ECHILD);
-
- r = bus_ensure_running(bus);
- if (r < 0)
- return r;
-
- r = bus_seal_message(bus, m, usec);
- if (r < 0)
- return r;
-
- r = bus_remarshal_message(bus, &m);
- if (r < 0)
- return r;
-
- if (bus->is_kernel)
- return bus_call_kernel(bus, m, usec, error, reply);
- else
- return bus_call_dbus1(bus, m, usec, error, reply);
-}
-
_public_ int sd_bus_get_fd(sd_bus *bus) {
assert_return(bus, -EINVAL);