bus-kernel.c revision 022fb8558e797483709ab3e9fe846f04f7026dac
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering This file is part of systemd.
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering Copyright 2013 Lennart Poettering
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering systemd is free software; you can redistribute it and/or modify it
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering under the terms of the GNU Lesser General Public License as published by
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering (at your option) any later version.
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering systemd is distributed in the hope that it will be useful, but
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering Lesser General Public License for more details.
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering You should have received a copy of the GNU Lesser General Public License
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering#define UNIQUE_NAME_MAX (3+DECIMAL_STR_MAX(uint64_t))
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poetteringint bus_kernel_parse_unique_name(const char *s, uint64_t *id) {
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poetteringstatic void append_payload_vec(struct kdbus_item **d, const void *p, size_t sz) {
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* Note that p can be NULL, which encodes a region full of
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering * zeroes, which is useful to optimize certain padding
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering * conditions */
968f319679d9069af037240d0c3bcd126181cdacZbigniew Jędrzejewski-Szmek (*d)->size = offsetof(struct kdbus_item, vec) + sizeof(struct kdbus_vec);
968f319679d9069af037240d0c3bcd126181cdacZbigniew Jędrzejewski-Szmek (*d)->type = KDBUS_ITEM_PAYLOAD_VEC;
968f319679d9069af037240d0c3bcd126181cdacZbigniew Jędrzejewski-Szmek (*d)->vec.address = PTR_TO_UINT64(p);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poetteringstatic void append_payload_memfd(struct kdbus_item **d, int memfd, size_t sz) {
874bc134ac6504c45e94174e37af13ff21a6bfe2Zbigniew Jędrzejewski-Szmek (*d)->size = offsetof(struct kdbus_item, memfd) + sizeof(struct kdbus_memfd);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poetteringstatic void append_destination(struct kdbus_item **d, const char *s, size_t length) {
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering (*d)->size = offsetof(struct kdbus_item, str) + length + 1;
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poetteringstatic struct kdbus_bloom_filter *append_bloom(struct kdbus_item **d, size_t length) {
874bc134ac6504c45e94174e37af13ff21a6bfe2Zbigniew Jędrzejewski-Szmek i->size = offsetof(struct kdbus_item, bloom_filter) +
874bc134ac6504c45e94174e37af13ff21a6bfe2Zbigniew Jędrzejewski-Szmek offsetof(struct kdbus_bloom_filter, data) +
874bc134ac6504c45e94174e37af13ff21a6bfe2Zbigniew Jędrzejewski-Szmek *d = (struct kdbus_item *) ((uint8_t*) i + i->size);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poetteringstatic void append_fds(struct kdbus_item **d, const int fds[], unsigned n_fds) {
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering (*d)->size = offsetof(struct kdbus_item, fds) + sizeof(int) * n_fds;
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering memcpy((*d)->fds, fds, sizeof(int) * n_fds);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size);
8c0b803b97bb0ee6603d9be85fb6b69cd6081eafLennart Poetteringstatic int bus_message_setup_bloom(sd_bus_message *m, struct kdbus_bloom_filter *bloom) {
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, "message-type", bus_message_type_to_string(m->header->type));
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, "interface", m->interface);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, "member", m->member);
a174f94d529c7ae9be589867308b669ec9b4dcc0Lennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, "path", m->path);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, "path-slash-prefix", m->path);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering bloom_add_prefixes(data, m->bus->bloom_size, m->bus->bloom_n_hash, "path-slash-prefix", m->path, '/');
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering for (i = 0; i < 64; i++) {
2a0e0692565f0435657c93498e09cbb2d3517152Shawn Landden const char *t;
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering char buf[sizeof("arg")-1 + 2 + sizeof("-slash-prefix")];
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering r = sd_bus_message_peek_type(m, &type, NULL);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering r = sd_bus_message_read_basic(m, type, &t);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering *(e++) = '0' + (char) i;
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, buf, t);
968f319679d9069af037240d0c3bcd126181cdacZbigniew Jędrzejewski-Szmek bloom_add_prefixes(data, m->bus->bloom_size, m->bus->bloom_n_hash, buf, t, '.');
968f319679d9069af037240d0c3bcd126181cdacZbigniew Jędrzejewski-Szmek bloom_add_prefixes(data, m->bus->bloom_size, m->bus->bloom_n_hash, buf, t, '/');
968f319679d9069af037240d0c3bcd126181cdacZbigniew Jędrzejewski-Szmekstatic int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) {
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* We put this together only once, if this message is reused
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering * we reuse the earlier-built version */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering destination = m->destination ?: m->destination_ptr;
505b6a61c22d5565e9308045c7b9bf79f7d0517eLennart Poettering r = bus_kernel_parse_unique_name(destination, &unique);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering assert_cc(ALIGN8(offsetof(struct kdbus_item, vec) + sizeof(struct kdbus_vec)) ==
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering ALIGN8(offsetof(struct kdbus_item, memfd) + sizeof(struct kdbus_memfd)));
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* Add in fixed header, fields header and payload */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering ALIGN8(offsetof(struct kdbus_item, vec) + sizeof(struct kdbus_vec));
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* Add space for bloom filter */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering sz += ALIGN8(offsetof(struct kdbus_item, bloom_filter) +
d18d46ecea80a7f07415edb9264af6a254fd70bbZbigniew Jędrzejewski-Szmek offsetof(struct kdbus_bloom_filter, data) +
874bc134ac6504c45e94174e37af13ff21a6bfe2Zbigniew Jędrzejewski-Szmek /* Add in well-known destination header */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering sz += ALIGN8(offsetof(struct kdbus_item, str) + dl + 1);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* Add space for unix fds */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering sz += ALIGN8(offsetof(struct kdbus_item, fds) + sizeof(int)*m->n_fds);
874bc134ac6504c45e94174e37af13ff21a6bfe2Zbigniew Jędrzejewski-Szmek ((m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) ? 0 : KDBUS_MSG_FLAGS_EXPECT_REPLY) |
874bc134ac6504c45e94174e37af13ff21a6bfe2Zbigniew Jędrzejewski-Szmek ((m->header->flags & BUS_MESSAGE_NO_AUTO_START) ? KDBUS_MSG_FLAGS_NO_AUTO_START : 0);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* verify_destination_id will usually be 0, which makes the kernel driver only look
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering * at the provided well-known name. Otherwise, the kernel will make sure the provided
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering * destination id matches the owner of the provided weel-known-name, and fail if they
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering * differ. Currently, this is only needed for bus-proxyd. */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering m->kdbus->dst_id = m->verify_destination_id;
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering m->kdbus->dst_id = destination ? unique : KDBUS_DST_ID_BROADCAST;
40b71e89bae4e51768db4dc50ec64c1e9c96eec4Sebastian Thorarensen m->kdbus->payload_type = KDBUS_PAYLOAD_DBUS;
40b71e89bae4e51768db4dc50ec64c1e9c96eec4Sebastian Thorarensen m->kdbus->cookie = (uint64_t) m->header->serial;
968f319679d9069af037240d0c3bcd126181cdacZbigniew Jędrzejewski-Szmek if (m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) {
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering m->kdbus->cookie_reply = m->reply_cookie;
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering assert_se(clock_gettime(CLOCK_MONOTONIC_COARSE, &now) == 0);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering m->kdbus->timeout_ns = now.tv_sec * NSEC_PER_SEC + now.tv_nsec +
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering append_payload_vec(&d, m->header, BUS_MESSAGE_BODY_BEGIN(m));
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* If this is padding then simply send a
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering * vector with a NULL data pointer which the
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering * kernel will just pass through. This is the
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering * most efficient way to encode zeroes */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering append_payload_vec(&d, NULL, part->size);
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering if (part->memfd >= 0 && part->sealed && destination) {
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering /* Try to send a memfd, if the part is
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering * sealed and this is not a broadcast. Since we can only */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering append_payload_memfd(&d, part->memfd, part->size);
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering /* Otherwise, let's send a vector to the actual data.
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering * For that, we need to map it first. */
1dfa7e79a60de680086b1d93fcc3629b463f58bdLennart Poettering append_payload_vec(&d, part->data, part->size);
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering if (m->kdbus->dst_id == KDBUS_DST_ID_BROADCAST) {
1dfa7e79a60de680086b1d93fcc3629b463f58bdLennart Poettering bloom = append_bloom(&d, m->bus->bloom_size);
1dfa7e79a60de680086b1d93fcc3629b463f58bdLennart Poettering m->kdbus->size = (uint8_t*) d - (uint8_t*) m->kdbus;
1dfa7e79a60de680086b1d93fcc3629b463f58bdLennart Poetteringstatic void unset_memfds(struct sd_bus_message *m) {
1dfa7e79a60de680086b1d93fcc3629b463f58bdLennart Poettering /* Make sure the memfds are not freed twice */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poetteringstatic int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering const char *destination = NULL, *seclabel = NULL;
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering assert(k->payload_type == KDBUS_PAYLOAD_DBUS);
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering l = d->size - offsetof(struct kdbus_item, data);
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering h = (struct bus_header *)((uint8_t *)k + d->vec.offset);
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering if (!bus_header_is_complete(h, d->vec.size))
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering j = l / sizeof(int);
c79e98eadd3056a36a662699fa650db5b1bca0c3Lennart Poettering f = realloc(fds, sizeof(int) * (n_fds + j));
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering memcpy(fds + n_fds, d->fds, sizeof(int) * j);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* on kdbus we only speak native endian gvariant, never dbus1
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering * marshalling or reverse endian */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering r = bus_message_from_header(bus, h, sizeof(struct bus_header), fds, n_fds, NULL, seclabel, 0, &m);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* The well-known names list is different from the other
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering credentials. If we asked for it, but nothing is there, this
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering means that the list of well-known names is simply empty, not
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering that we lack any data */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering m->creds.mask |= (SD_BUS_CREDS_UNIQUE_NAME|SD_BUS_CREDS_WELL_KNOWN_NAMES) & bus->creds_mask;
d682b3a7e7c7c2941a4d3e193f1e330dbc9fae89Lennart Poettering l = d->size - offsetof(struct kdbus_item, data);
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* Contains body material */
0153028ae379eb7c9a463c548ef73ea392c6cdb0Lennart Poettering /* A -1 offset is NUL padding. */
case KDBUS_ITEM_PAYLOAD_MEMFD: {
r = -EBADMSG;
goto fail;
if (!part) {
r = -ENOMEM;
goto fail;
case KDBUS_ITEM_CREDS:
case KDBUS_ITEM_TIMESTAMP:
case KDBUS_ITEM_PID_COMM:
case KDBUS_ITEM_TID_COMM:
case KDBUS_ITEM_EXE:
case KDBUS_ITEM_CMDLINE:
case KDBUS_ITEM_CGROUP:
m->creds.mask |= (SD_BUS_CREDS_CGROUP|SD_BUS_CREDS_UNIT|SD_BUS_CREDS_USER_UNIT|SD_BUS_CREDS_SLICE|SD_BUS_CREDS_SESSION|SD_BUS_CREDS_OWNER_UID) & bus->creds_mask;
goto fail;
case KDBUS_ITEM_AUDIT:
case KDBUS_ITEM_CAPS:
m->creds.mask |= (SD_BUS_CREDS_EFFECTIVE_CAPS|SD_BUS_CREDS_PERMITTED_CAPS|SD_BUS_CREDS_INHERITABLE_CAPS|SD_BUS_CREDS_BOUNDING_CAPS) & bus->creds_mask;
case KDBUS_ITEM_DST_NAME:
return -EBADMSG;
case KDBUS_ITEM_OWNED_NAME:
return -EBADMSG;
goto fail;
case KDBUS_ITEM_FDS:
case KDBUS_ITEM_SECLABEL:
r = bus_message_parse_fields(m);
goto fail;
if (destination)
snprintf(m->destination_buffer, sizeof(m->destination_buffer), ":1.%llu", (unsigned long long) k->dst_id);
m->kdbus = k;
m->release_kdbus = true;
m->free_fds = true;
fail:
unset_memfds(m);
const char *name;
assert(b);
if (b->is_server)
return -EINVAL;
if (b->description) {
return -ENOMEM;
name = g;
return -ENOMEM;
return -ENOMEM;
name = g;
if (!b->description)
return -ENOMEM;
if (b->fake_creds_valid)
if (b->fake_label) {
if (b->fake_creds_valid) {
if (b->fake_label) {
return -errno;
if (!b->kdbus_buffer) {
return -errno;
return -ENOTSUP;
return -ENOTSUP;
return -ENOMEM;
b->is_kernel = true;
b->bus_client = true;
return bus_start_running(b);
assert(b);
if (b->is_server)
return -EINVAL;
if (b->input_fd < 0)
return -errno;
return bus_kernel_take_fd(b);
struct kdbus_item *d;
assert(k);
assert(m);
* kernel, so that it can pass CPU time/scheduling to the
if (hint_sync_call)
sd_bus_error_setf(&error, SD_BUS_ERROR_SERVICE_UNKNOWN, "Destination %s not known", m->destination);
log_debug("Could not deliver message to %s as destination is not known. Ignoring.", m->destination);
sd_bus_error_setf(&error, SD_BUS_ERROR_SERVICE_UNKNOWN, "Activation of %s not requested", m->destination);
log_debug("Could not deliver message to %s as destination is not activated. Ignoring.", m->destination);
return -errno;
bus,
&error,
&reply);
} else if (hint_sync_call) {
struct kdbus_msg *k;
assert(k);
log_debug("Ignoring message with unknown payload type %llu.", (unsigned long long) k->payload_type);
static int push_name_owner_changed(sd_bus *bus, const char *name, const char *old_owner, const char *new_owner) {
bus,
"/org/freedesktop/DBus",
m = NULL;
assert(k);
assert(d);
if (d->type == KDBUS_ITEM_NAME_ADD || (d->name_change.old_id.flags & (KDBUS_NAME_IN_QUEUE|KDBUS_NAME_ACTIVATOR)))
old_owner[0] = 0;
if (d->type == KDBUS_ITEM_NAME_REMOVE || (d->name_change.new_id.flags & (KDBUS_NAME_IN_QUEUE|KDBUS_NAME_ACTIVATOR))) {
new_owner[0] = 0;
assert(k);
assert(d);
return push_name_owner_changed(
assert(k);
assert(d);
bus,
k->cookie_reply,
m = NULL;
assert(k);
if (d->type >= _KDBUS_ITEM_KERNEL_BASE && d->type < _KDBUS_ITEM_KERNEL_BASE + ELEMENTSOF(translate)) {
if (found)
return -EBADMSG;
found = d;
if (!found) {
struct kdbus_msg *k;
if (hint_priority) {
return -errno;
log_debug("Ignoring message with unknown payload type %llu.", (unsigned long long) k->payload_type);
struct memfd_cache *c;
int fd;
return -ENOTSUP;
*mapped = 0;
*allocated = 0;
return fd;
if (size > 0)
struct memfd_cache *c;
assert(b);
for (i = 0; i < b->n_memfd_cache; i++)
uint64_t f = 0;
f |= KDBUS_NAME_QUEUE;
*kdbus_flags = f;
uint64_t m = 0;
if (mask & (SD_BUS_CREDS_UID|SD_BUS_CREDS_GID|SD_BUS_CREDS_PID|SD_BUS_CREDS_PID_STARTTIME|SD_BUS_CREDS_TID))
m |= KDBUS_ATTACH_CREDS;
m |= KDBUS_ATTACH_PID_COMM;
m |= KDBUS_ATTACH_TID_COMM;
m |= KDBUS_ATTACH_EXE;
m |= KDBUS_ATTACH_CMDLINE;
if (mask & (SD_BUS_CREDS_CGROUP|SD_BUS_CREDS_UNIT|SD_BUS_CREDS_USER_UNIT|SD_BUS_CREDS_SLICE|SD_BUS_CREDS_SESSION|SD_BUS_CREDS_OWNER_UID))
m |= KDBUS_ATTACH_CGROUP;
if (mask & (SD_BUS_CREDS_EFFECTIVE_CAPS|SD_BUS_CREDS_PERMITTED_CAPS|SD_BUS_CREDS_INHERITABLE_CAPS|SD_BUS_CREDS_BOUNDING_CAPS))
m |= KDBUS_ATTACH_CAPS;
m |= KDBUS_ATTACH_SECLABEL;
m |= KDBUS_ATTACH_AUDIT;
m |= KDBUS_ATTACH_NAMES;
*kdbus_mask = m;
struct kdbus_item *n;
int fd;
assert(s);
if (fd < 0)
return -errno;
sizeof(struct kdbus_bloom_parameter);
n = KDBUS_ITEM_NEXT(n);
return -errno;
return -ENOMEM;
return fd;
switch (access) {
case BUS_POLICY_ACCESS_SEE:
return KDBUS_POLICY_SEE;
case BUS_POLICY_ACCESS_TALK:
return KDBUS_POLICY_TALK;
case BUS_POLICY_ACCESS_OWN:
return KDBUS_POLICY_OWN;
case BUSNAME_POLICY_TYPE_USER: {
case BUSNAME_POLICY_TYPE_GROUP: {
int fd;
if (path) {
return -ENOMEM;
*path = p;
if (fd < 0)
return -errno;
return fd;
struct kdbus_item *n;
int fd;
if (fd < 0)
return fd;
return -errno;
if (ep_path) {
return -ENOMEM;
*ep_path = p;
return fd;
struct kdbus_item *n;
Iterator i;
n = KDBUS_ITEM_NEXT(n);
n = KDBUS_ITEM_NEXT(n);
return -errno;
int fd,
const char *name,
bool activating,
bool accept_fd,
struct kdbus_item *n;
policy_cnt++;
if (world_policy >= 0)
policy_cnt++;
policy_cnt * ALIGN8(offsetof(struct kdbus_item, policy_access) + sizeof(struct kdbus_policy_access));
n = KDBUS_ITEM_NEXT(n);
n = KDBUS_ITEM_NEXT(n);
if (world_policy >= 0) {
return -errno;
return -ENOTSUP;
return -ENOTSUP;
return fd;
struct kdbus_item *n;
int fd;
assert(s);
if (fd < 0)
return -errno;
return -errno;
return -ENOTSUP;
return -ENOMEM;
return fd;
return -errno;
return -errno;