[systemd-commits] 4 commits - src/libsystemd-bus src/shared
Lennart Poettering
lennart at kemper.freedesktop.org
Fri Apr 12 12:45:44 PDT 2013
src/libsystemd-bus/bus-internal.c | 1 -
src/libsystemd-bus/bus-kernel.c | 10 ++++++++--
src/libsystemd-bus/kdbus.h | 9 +++++++++
src/libsystemd-bus/test-bus-kernel.c | 8 ++++----
src/shared/macro.h | 2 ++
5 files changed, 23 insertions(+), 7 deletions(-)
New commits:
commit ed7d0b225bde939b552ca9493edf8642530fe9c1
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 12 21:45:14 2013 +0200
kdbus: use a valid service name for testing
diff --git a/src/libsystemd-bus/test-bus-kernel.c b/src/libsystemd-bus/test-bus-kernel.c
index 19fae1d..8266272 100644
--- a/src/libsystemd-bus/test-bus-kernel.c
+++ b/src/libsystemd-bus/test-bus-kernel.c
@@ -88,10 +88,10 @@ int main(int argc, char *argv[]) {
sd_bus_message_unref(m);
m = NULL;
- r = sd_bus_request_name(a, "net.0pointer.foobar", 0);
+ r = sd_bus_request_name(a, "net.x0pointer.foobar", 0);
assert_se(r >= 0);
- r = sd_bus_message_new_method_call(b, "net.0pointer.foobar", "/a/path", "an.inter.face", "AMethod", &m);
+ r = sd_bus_message_new_method_call(b, "net.x0pointer.foobar", "/a/path", "an.inter.face", "AMethod", &m);
assert_se(r >= 0);
r = sd_bus_send(b, m, NULL);
@@ -108,10 +108,10 @@ int main(int argc, char *argv[]) {
assert_se(sd_bus_message_rewind(m, true) >= 0);
}
- r = sd_bus_release_name(a, "net.0pointer.foobar");
+ r = sd_bus_release_name(a, "net.x0pointer.foobar");
assert_se(r >= 0);
- r = sd_bus_release_name(a, "net.0pointer.foobar");
+ r = sd_bus_release_name(a, "net.x0pointer.foobar");
assert_se(r == -ENXIO);
sd_bus_unref(a);
commit cfde0327ad83f1a31597cd8eb83e97f541d2f2db
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 12 21:44:55 2013 +0200
kdbus: update kdbus.h from upstream
diff --git a/src/libsystemd-bus/kdbus.h b/src/libsystemd-bus/kdbus.h
index 16a3a49..7f65375 100644
--- a/src/libsystemd-bus/kdbus.h
+++ b/src/libsystemd-bus/kdbus.h
@@ -70,6 +70,7 @@ enum {
KDBUS_MSG_TIMESTAMP, /* .ts_ns of CLOCK_MONOTONIC */
KDBUS_MSG_SRC_CREDS, /* .creds */
KDBUS_MSG_SRC_COMM, /* optional */
+ KDBUS_MSG_SRC_THREAD_COMM, /* optional */
KDBUS_MSG_SRC_EXE, /* optional */
KDBUS_MSG_SRC_CMDLINE, /* optional */
KDBUS_MSG_SRC_CGROUP, /* optional, specified which one */
@@ -360,3 +361,11 @@ enum kdbus_cmd {
KDBUS_CMD_EP_POLICY_SET = _IOWR(KDBUS_IOC_MAGIC, 0x70, struct kdbus_cmd_policy),
};
#endif
+
+/* Think about:
+ *
+ * - allow HELLO to change unique names
+ * - allow HELLO without assigning a unique name at all
+ * - when receive fails due to too small buffer return real size
+ * - when receiving maybe allow read-only mmaping into reciving process memory space or so?
+ */
commit d9115e1852ae8e0cb254cf170040e48e5e6c2923
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 12 21:44:14 2013 +0200
kdbus: make sure msg structure is properly initialized
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 878cd9c..c190138 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -117,6 +117,8 @@ static int bus_message_setup_kmsg(sd_bus_message *m) {
if (!m->kdbus)
return -ENOMEM;
+ memset(m->kdbus, 0, sz);
+
m->kdbus->flags =
((m->header->flags & SD_BUS_MESSAGE_NO_REPLY_EXPECTED) ? 0 : KDBUS_MSG_FLAGS_EXPECT_REPLY) |
((m->header->flags & SD_BUS_MESSAGE_NO_AUTO_START) ? KDBUS_MSG_FLAGS_NO_AUTO_START : 0);
commit e86b80b834016d273196c5ec9687fddcddcf9381
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 12 21:43:50 2013 +0200
bus: don't calculate kmsg message too large
diff --git a/src/libsystemd-bus/bus-internal.c b/src/libsystemd-bus/bus-internal.c
index 317f6a8..df29553 100644
--- a/src/libsystemd-bus/bus-internal.c
+++ b/src/libsystemd-bus/bus-internal.c
@@ -141,7 +141,6 @@ bool service_name_is_valid(const char *p) {
return false;
return true;
-
}
bool member_name_is_valid(const char *p) {
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index dc6f5b9..878cd9c 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -57,23 +57,27 @@ static void append_payload_vec(struct kdbus_msg_data **d, const void *p, size_t
assert(p);
assert(sz > 0);
+ *d = ALIGN8_PTR(*d);
+
(*d)->size = offsetof(struct kdbus_msg_data, vec) + sizeof(struct kdbus_vec);
(*d)->type = KDBUS_MSG_PAYLOAD_VEC;
(*d)->vec.address = (uint64_t) p;
(*d)->vec.size = sz;
- *d = (struct kdbus_msg_data*) ((uint8_t*) *d + ALIGN8((*d)->size));
+ *d = (struct kdbus_msg_data*) ((uint8_t*) *d + (*d)->size);
}
static void append_destination(struct kdbus_msg_data **d, const char *s, size_t length) {
assert(d);
assert(d);
+ *d = ALIGN8_PTR(*d);
+
(*d)->size = offsetof(struct kdbus_msg_data, str) + length + 1;
(*d)->type = KDBUS_MSG_DST_NAME;
memcpy((*d)->str, s, length + 1);
- *d = (struct kdbus_msg_data*) ((uint8_t*) *d + ALIGN8((*d)->size));
+ *d = (struct kdbus_msg_data*) ((uint8_t*) *d + (*d)->size);
}
static int bus_message_setup_kmsg(sd_bus_message *m) {
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 84a453a..99dc733 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -65,6 +65,8 @@
#error "Wut? Pointers are neither 4 nor 8 bytes long?"
#endif
+#define ALIGN8_PTR(p) ((void*) ALIGN8((unsigned long) p))
+
static inline size_t ALIGN_TO(size_t l, size_t ali) {
return ((l + ali - 1) & ~(ali - 1));
}
More information about the systemd-commits
mailing list