summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-kernel.c
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2013-04-18 18:54:17 +0200
committerKay Sievers <kay@vrfy.org>2013-04-18 18:54:17 +0200
commita2cef833cf46ee9ec35a4e4e4861944b25cd9a23 (patch)
tree2dd40fb2380053b4440d1d72a13a10cc194e50ae /src/libsystemd-bus/bus-kernel.c
parentcee22bd3cb253734a8a0183751d786128e2ea5e4 (diff)
bus: catch up with kernel changes
Diffstat (limited to 'src/libsystemd-bus/bus-kernel.c')
-rw-r--r--src/libsystemd-bus/bus-kernel.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 2bb1b9a19a..5172b32113 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -540,6 +540,7 @@ int bus_kernel_read_message(sd_bus *bus, sd_bus_message **m) {
int bus_kernel_create(const char *name, char **s) {
struct kdbus_cmd_bus_make *make;
+ struct kdbus_cmd_make_item *n, *cg;
size_t l;
int fd;
char *p;
@@ -552,16 +553,27 @@ int bus_kernel_create(const char *name, char **s) {
return -errno;
l = strlen(name);
- make = alloca0(offsetof(struct kdbus_cmd_bus_make, name) + DECIMAL_STR_MAX(uid_t) + 1 + l + 1);
- sprintf(make->name, "%lu-%s", (unsigned long) getuid(), name);
- make->size = offsetof(struct kdbus_cmd_bus_make, name) + strlen(make->name) + 1;
+ make = alloca0(offsetof(struct kdbus_cmd_bus_make, items) +
+ sizeof(struct kdbus_cmd_make_item) + sizeof(uint64_t) +
+ sizeof(struct kdbus_cmd_make_item) + DECIMAL_STR_MAX(uid_t) + 1 + l + 1);
+
+ cg = make->items;
+ cg->type = KDBUS_CMD_MAKE_CGROUP;
+ cg->data64[0] = 1;
+ cg->size = sizeof(struct kdbus_cmd_make_item) + sizeof(uint64_t);
+
+ n = KDBUS_ITEM_NEXT(cg);
+ n->type = KDBUS_CMD_MAKE_NAME;
+ sprintf(n->str, "%lu-%s", (unsigned long) getuid(), name);
+ n->size = sizeof(struct kdbus_cmd_make_item) + strlen(n->str) + 1;
+
+ make->size = offsetof(struct kdbus_cmd_bus_make, items) + cg->size + n->size;
make->flags = KDBUS_ACCESS_WORLD | KDBUS_POLICY_OPEN;
make->bus_flags = 0;
make->bloom_size = BLOOM_SIZE;
- make->cgroup_id = 1;
assert_cc(BLOOM_SIZE % 8 == 0);
- p = strjoin("/dev/kdbus/", make->name, "/bus", NULL);
+ p = strjoin("/dev/kdbus/", n->str, "/bus", NULL);
if (!p)
return -ENOMEM;