* name, then add KDBUS_MATCH_NAME_{ADD,REMOVE,CHANGE}
* matches for it */
- l = name ? strlen(name) : 0;
+ l = name ? strlen(name) + 1 : 0;
sz = ALIGN8(offsetof(struct kdbus_cmd_match, items) +
offsetof(struct kdbus_item, name_change) +
offsetof(struct kdbus_notify_name_change, name) +
- l+1);
+ l);
m = alloca0(sz);
m->size = sz;
item->size =
offsetof(struct kdbus_item, name_change) +
offsetof(struct kdbus_notify_name_change, name) +
- l+1;
+ l;
item->name_change.old.id = old_owner_id;
item->name_change.new.id = new_owner_id;
return 0;
}
-static int bus_add_match_internal_kernel(
+int bus_add_match_internal_kernel(
sd_bus *bus,
- const char *match,
+ uint64_t id,
struct bus_match_component *components,
unsigned n_components,
uint64_t cookie) {
int r;
assert(bus);
- assert(match);
zero(bloom);
m->size = sz;
m->cookie = cookie;
m->src_id = src_id;
+ m->id = id;
item = m->items;
assert(match);
if (bus->is_kernel)
- return bus_add_match_internal_kernel(bus, match, components, n_components, cookie);
+ return bus_add_match_internal_kernel(bus, 0, components, n_components, cookie);
else
return bus_add_match_internal_dbus1(bus, match);
}
-static int bus_remove_match_internal_kernel(
+int bus_remove_match_internal_kernel(
sd_bus *bus,
- const char *match,
+ uint64_t id,
uint64_t cookie) {
struct kdbus_cmd_match m;
int r;
assert(bus);
- assert(match);
zero(m);
m.size = offsetof(struct kdbus_cmd_match, items);
m.cookie = cookie;
+ m.id = id;
r = ioctl(bus->input_fd, KDBUS_CMD_MATCH_REMOVE, &m);
if (r < 0)
assert(match);
if (bus->is_kernel)
- return bus_remove_match_internal_kernel(bus, match, cookie);
+ return bus_remove_match_internal_kernel(bus, 0, cookie);
else
return bus_remove_match_internal_dbus1(bus, match);
}