chiark / gitweb /
bus: parse uid/gid/pid/tid meta data from kdbus messages
[elogind.git] / src / libsystemd-bus / bus-match.c
index ff1edfa..fed25c1 100644 (file)
@@ -212,6 +212,9 @@ int bus_match_run(
         if (!node)
                 return 0;
 
+        if (bus && bus->match_callbacks_modified)
+                return 0;
+
         /* Not these special semantics: when traversing the tree we
          * usually let bus_match_run() when called for a node
          * recursively invoke bus_match_run(). There's are two
@@ -241,6 +244,13 @@ int bus_match_run(
 
         case BUS_MATCH_LEAF:
 
+                if (bus) {
+                        if (node->leaf.last_iteration == bus->iteration_counter)
+                                return 0;
+
+                        node->leaf.last_iteration = bus->iteration_counter;
+                }
+
                 /* Run the callback. And then invoke siblings. */
                 assert(node->leaf.callback);
                 r = node->leaf.callback(bus, ret, m, node->leaf.userdata);
@@ -323,6 +333,9 @@ int bus_match_run(
                 }
         }
 
+        if (bus && bus->match_callbacks_modified)
+                return 0;
+
         /* And now, let's invoke our siblings */
         return bus_match_run(bus, node->next, ret, m);
 }
@@ -481,7 +494,7 @@ static int bus_match_find_compare_value(
 
 static int bus_match_add_leaf(
                 struct bus_match_node *where,
-                sd_message_handler_t callback,
+                sd_bus_message_handler_t callback,
                 void *userdata,
                 struct bus_match_node **ret) {
 
@@ -511,7 +524,7 @@ static int bus_match_add_leaf(
 
 static int bus_match_find_leaf(
                 struct bus_match_node *where,
-                sd_message_handler_t callback,
+                sd_bus_message_handler_t callback,
                 void *userdata,
                 struct bus_match_node **ret) {
 
@@ -778,7 +791,7 @@ fail:
 int bus_match_add(
                 struct bus_match_node *root,
                 const char *match,
-                sd_message_handler_t callback,
+                sd_bus_message_handler_t callback,
                 void *userdata,
                 struct bus_match_node **ret) {
 
@@ -819,7 +832,7 @@ finish:
 int bus_match_remove(
                 struct bus_match_node *root,
                 const char *match,
-                sd_message_handler_t callback,
+                sd_bus_message_handler_t callback,
                 void *userdata) {
 
         struct match_component *components = NULL;