[systemd-commits] 3 commits - TODO src/libsystemd-bus

Lennart Poettering lennart at kemper.freedesktop.org
Wed Dec 11 16:51:59 PST 2013


 TODO                            |    8 +++-----
 src/libsystemd-bus/bus-creds.c  |    2 +-
 src/libsystemd-bus/bus-kernel.c |   13 +++++++------
 src/libsystemd-bus/kdbus.h      |    6 ++++--
 4 files changed, 15 insertions(+), 14 deletions(-)

New commits:
commit d78bf250b0e31b42eb8b86ebe3ee775b247bfcf8
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Dec 12 01:42:41 2013 +0100

    bus: properly generate NameOwnerChanged messages when we take from/give back to queue/starter

diff --git a/TODO b/TODO
index e60211a..7f56a26 100644
--- a/TODO
+++ b/TODO
@@ -127,7 +127,6 @@ Features:
   - kdbus: matches against source or destination pids for an "strace -p"-like feel. Problem: The PID info needs to be available in userspace too...
   - kdbus: we need a way to distuingish messages we got due to monitoring from normal messages, since we want to bind methods only to the latter
   - figure out what to do when fields in the kdbus header and in the payload header do not match
-  - nameownerchange cannot be properly synthesized since we cannot distuingish messages from kernel when a name changed ownership starter → real from real → starter
   - longer term:
     * priority queues
     * priority inheritance
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 92acbee..81dfba7 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -514,17 +514,18 @@ static int translate_name_change(sd_bus *bus, struct kdbus_msg *k, struct kdbus_
         assert(k);
         assert(d);
 
-        if (d->name_change.flags & (KDBUS_NAME_IN_QUEUE|KDBUS_NAME_STARTER))
-                return 0;
-
-        if (d->type == KDBUS_ITEM_NAME_ADD)
+        if (d->type == KDBUS_ITEM_NAME_ADD || (d->name_change.old_flags & (KDBUS_NAME_IN_QUEUE|KDBUS_NAME_STARTER)))
                 old_owner[0] = 0;
         else
                 sprintf(old_owner, ":1.%llu", (unsigned long long) d->name_change.old_id);
 
-        if (d->type == KDBUS_ITEM_NAME_REMOVE)
+        if (d->type == KDBUS_ITEM_NAME_REMOVE || (d->name_change.new_flags & (KDBUS_NAME_IN_QUEUE|KDBUS_NAME_STARTER))) {
+
+                if (isempty(old_owner))
+                        return 0;
+
                 new_owner[0] = 0;
-        else
+        } else
                 sprintf(new_owner, ":1.%llu", (unsigned long long) d->name_change.new_id);
 
         return push_name_owner_changed(bus, d->name_change.name, old_owner, new_owner);
diff --git a/src/libsystemd-bus/kdbus.h b/src/libsystemd-bus/kdbus.h
index ccc65cb..168d08a 100644
--- a/src/libsystemd-bus/kdbus.h
+++ b/src/libsystemd-bus/kdbus.h
@@ -30,7 +30,8 @@
  * struct kdbus_notify_name_change - name registry change message
  * @old_id:		Former owner of a name
  * @new_id:		New owner of a name
- * @flags:		flags from KDBUS_NAME_*
+ * @old_flags:		flags from KDBUS_NAME_* the name entry used to have
+ * @new_flags:		flags from KDBUS_NAME_* the name entry has now
  * @name:		Well-known name
  *
  * Sent from kernel to userspace when the owner or starter of
@@ -44,7 +45,8 @@
 struct kdbus_notify_name_change {
 	__u64 old_id;
 	__u64 new_id;
-	__u64 flags;
+	__u64 old_flags;
+	__u64 new_flags;
 	char name[0];
 };
 

commit 689bd78d108819b362e75af42536725c56b5e939
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Dec 12 01:39:32 2013 +0100

    bus: fix order in which we check creds

diff --git a/src/libsystemd-bus/bus-creds.c b/src/libsystemd-bus/bus-creds.c
index d69a316..ffd72a7 100644
--- a/src/libsystemd-bus/bus-creds.c
+++ b/src/libsystemd-bus/bus-creds.c
@@ -369,11 +369,11 @@ _public_ int sd_bus_creds_get_owner_uid(sd_bus_creds *c, uid_t *uid) {
 
 _public_ int sd_bus_creds_get_cmdline(sd_bus_creds *c, char ***cmdline) {
         assert_return(c, -EINVAL);
-        assert_return(c->cmdline, -ESRCH);
 
         if (!(c->mask & SD_BUS_CREDS_CMDLINE))
                 return -ENODATA;
 
+        assert_return(c->cmdline, -ESRCH);
         assert(c->cmdline);
 
         if (!c->cmdline_array) {

commit 0a825b5cd4adb4d9dadfb2e237cdceae09399804
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Dec 12 01:39:21 2013 +0100

    update TODO

diff --git a/TODO b/TODO
index a4cffb3..e60211a 100644
--- a/TODO
+++ b/TODO
@@ -123,15 +123,14 @@ Features:
   - support "const" properties as flag
   - add API to clone sd_bus_message objects
   - SD_BUS_COMMENT() macro for inclusion in vtables, syntax inspired by gdbus
-  - make sd_bus_open_system_container() kdbus aware
-  - longer term:
-    * priority queues
-    * priority inheritance
   - sort out error codes for sd_bus_release_name(), distuingish: successful removal from foreign name, from non-existing name
-  - bug in kdbus: nameownerchange is not generated for names, only ids.
   - kdbus: matches against source or destination pids for an "strace -p"-like feel. Problem: The PID info needs to be available in userspace too...
   - kdbus: we need a way to distuingish messages we got due to monitoring from normal messages, since we want to bind methods only to the latter
   - figure out what to do when fields in the kdbus header and in the payload header do not match
+  - nameownerchange cannot be properly synthesized since we cannot distuingish messages from kernel when a name changed ownership starter → real from real → starter
+  - longer term:
+    * priority queues
+    * priority inheritance
 
 * sd-event
   - allow multiple signal handlers per signal



More information about the systemd-commits mailing list