bus-kernel.c revision eef46c372f64f40dd75415b2c504c73138719c8d
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering This file is part of systemd.
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering Copyright 2013 Lennart Poettering
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering systemd is free software; you can redistribute it and/or modify it
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering under the terms of the GNU Lesser General Public License as published by
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering (at your option) any later version.
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering systemd is distributed in the hope that it will be useful, but
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering Lesser General Public License for more details.
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering You should have received a copy of the GNU Lesser General Public License
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering/* When we include libgen.h because we need dirname() we immediately
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * undefine basename() since libgen.h defines it as a macro to the XDG
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * version which is really broken. */
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering#define UNIQUE_NAME_MAX (3+DECIMAL_STR_MAX(uint64_t))
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poetteringint bus_kernel_parse_unique_name(const char *s, uint64_t *id) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poetteringstatic void append_payload_vec(struct kdbus_item **d, const void *p, size_t sz) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* Note that p can be NULL, which encodes a region full of
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * zeroes, which is useful to optimize certain padding
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * conditions */
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering (*d)->size = offsetof(struct kdbus_item, vec) + sizeof(struct kdbus_vec);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poetteringstatic void append_payload_memfd(struct kdbus_item **d, int memfd, size_t start, size_t sz) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering (*d)->size = offsetof(struct kdbus_item, memfd) + sizeof(struct kdbus_memfd);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poetteringstatic void append_destination(struct kdbus_item **d, const char *s, size_t length) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering (*d)->size = offsetof(struct kdbus_item, str) + length + 1;
baed47c3c20512507e497058d388782400a072f6Lennart Poettering *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poetteringstatic struct kdbus_bloom_filter *append_bloom(struct kdbus_item **d, size_t length) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering i->size = offsetof(struct kdbus_item, bloom_filter) +
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering offsetof(struct kdbus_bloom_filter, data) +
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering *d = (struct kdbus_item *) ((uint8_t*) i + i->size);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poetteringstatic void append_fds(struct kdbus_item **d, const int fds[], unsigned n_fds) {
baed47c3c20512507e497058d388782400a072f6Lennart Poettering (*d)->size = offsetof(struct kdbus_item, fds) + sizeof(int) * n_fds;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering memcpy((*d)->fds, fds, sizeof(int) * n_fds);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poetteringstatic void add_bloom_arg(void *data, size_t size, unsigned n_hash, unsigned i, const char *t) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering char buf[sizeof("arg")-1 + 2 + sizeof("-slash-prefix")];
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering *(e++) = '0' + (char) i;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering bloom_add_pair(data, size, n_hash, buf, t);
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering bloom_add_prefixes(data, size, n_hash, buf, t, '.');
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering bloom_add_prefixes(data, size, n_hash, buf, t, '/');
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poetteringstatic int bus_message_setup_bloom(sd_bus_message *m, struct kdbus_bloom_filter *bloom) {
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, "message-type", bus_message_type_to_string(m->header->type));
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, "interface", m->interface);
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, "member", m->member);
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, "path", m->path);
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering bloom_add_pair(data, m->bus->bloom_size, m->bus->bloom_n_hash, "path-slash-prefix", m->path);
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering bloom_add_prefixes(data, m->bus->bloom_size, m->bus->bloom_n_hash, "path-slash-prefix", m->path, '/');
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering for (i = 0; i < 64; i++) {
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering const char *t, *contents;
14d10188de1fd58e663d73683a400d8d7dc67dbaLennart Poettering r = sd_bus_message_peek_type(m, &type, &contents);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering if (IN_SET(type, SD_BUS_TYPE_STRING, SD_BUS_TYPE_OBJECT_PATH, SD_BUS_TYPE_SIGNATURE)) {
baed47c3c20512507e497058d388782400a072f6Lennart Poettering /* The bloom filter includes simple strings of any kind */
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering r = sd_bus_message_read_basic(m, type, &t);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering add_bloom_arg(data, m->bus->bloom_size, m->bus->bloom_n_hash, i, t);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering } if (type == SD_BUS_TYPE_ARRAY && STR_IN_SET(contents, "s", "o", "g")) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* As well as array of simple strings of any kinds */
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering r = sd_bus_message_enter_container(m, type, contents);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering while ((r = sd_bus_message_read_basic(m, contents[0], &t)) > 0)
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering add_bloom_arg(data, m->bus->bloom_size, m->bus->bloom_n_hash, i, t);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* Stop adding to bloom filter as soon as we
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * run into the first argument we cannot add
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poetteringstatic int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* We put this together only once, if this message is reused
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * we reuse the earlier-built version */
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering destination = m->destination ?: m->destination_ptr;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering r = bus_kernel_parse_unique_name(destination, &unique);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* Add in fixed header, fields header and payload */
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering sz += (1 + m->n_body_parts) * ALIGN8(offsetof(struct kdbus_item, vec) +
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering sizeof(struct kdbus_memfd)));
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* Add space for bloom filter */
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering sz += ALIGN8(offsetof(struct kdbus_item, bloom_filter) +
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering offsetof(struct kdbus_bloom_filter, data) +
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* Add in well-known destination header */
baed47c3c20512507e497058d388782400a072f6Lennart Poettering sz += ALIGN8(offsetof(struct kdbus_item, str) + dl + 1);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* Add space for unix fds */
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering sz += ALIGN8(offsetof(struct kdbus_item, fds) + sizeof(int)*m->n_fds);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering ((m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) ? 0 : KDBUS_MSG_EXPECT_REPLY) |
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering ((m->header->flags & BUS_MESSAGE_NO_AUTO_START) ? KDBUS_MSG_NO_AUTO_START : 0) |
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering ((m->header->type == SD_BUS_MESSAGE_SIGNAL) ? KDBUS_MSG_SIGNAL : 0);
baed47c3c20512507e497058d388782400a072f6Lennart Poettering /* verify_destination_id will usually be 0, which makes the kernel driver only look
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * at the provided well-known name. Otherwise, the kernel will make sure the provided
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * destination id matches the owner of the provided weel-known-name, and fail if they
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * differ. Currently, this is only needed for bus-proxyd. */
baed47c3c20512507e497058d388782400a072f6Lennart Poettering m->kdbus->dst_id = m->verify_destination_id;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering m->kdbus->dst_id = destination ? unique : KDBUS_DST_ID_BROADCAST;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering m->kdbus->payload_type = KDBUS_PAYLOAD_DBUS;
baed47c3c20512507e497058d388782400a072f6Lennart Poettering m->kdbus->cookie = (uint64_t) m->header->serial;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering if (m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering m->kdbus->cookie_reply = m->reply_cookie;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering assert_se(clock_gettime(CLOCK_MONOTONIC_COARSE, &now) == 0);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering m->kdbus->timeout_ns = now.tv_sec * NSEC_PER_SEC + now.tv_nsec +
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering append_payload_vec(&d, m->header, BUS_MESSAGE_BODY_BEGIN(m));
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* If this is padding then simply send a
baed47c3c20512507e497058d388782400a072f6Lennart Poettering * vector with a NULL data pointer which the
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * kernel will just pass through. This is the
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * most efficient way to encode zeroes */
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering append_payload_vec(&d, NULL, part->size);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering if (part->memfd >= 0 && part->sealed && destination) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* Try to send a memfd, if the part is
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * sealed and this is not a broadcast. Since we can only */
baed47c3c20512507e497058d388782400a072f6Lennart Poettering append_payload_memfd(&d, part->memfd, part->memfd_offset, part->size);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* Otherwise, let's send a vector to the actual data.
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering * For that, we need to map it first. */
baed47c3c20512507e497058d388782400a072f6Lennart Poettering append_payload_vec(&d, part->data, part->size);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering if (m->header->type == SD_BUS_MESSAGE_SIGNAL) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering bloom = append_bloom(&d, m->bus->bloom_size);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering m->kdbus->size = (uint8_t*) d - (uint8_t*) m->kdbus;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poetteringstatic void unset_memfds(struct sd_bus_message *m) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering /* Make sure the memfds are not freed twice */
baed47c3c20512507e497058d388782400a072f6Lennart Poetteringstatic void message_set_timestamp(sd_bus *bus, sd_bus_message *m, const struct kdbus_timestamp *ts) {
baed47c3c20512507e497058d388782400a072f6Lennart Poettering if (!(bus->attach_flags & KDBUS_ATTACH_TIMESTAMP))
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering m->realtime = ts->realtime_ns / NSEC_PER_USEC;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering m->monotonic = ts->monotonic_ns / NSEC_PER_USEC;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poetteringstatic int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering const char *destination = NULL, *seclabel = NULL;
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering assert(k->payload_type == KDBUS_PAYLOAD_DBUS);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering l = d->size - offsetof(struct kdbus_item, data);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering h = (struct bus_header *)((uint8_t *)bus->kdbus_buffer + d->vec.offset);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering if (!bus_header_is_complete(h, d->vec.size))
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering j = l / sizeof(int);
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering f = realloc(fds, sizeof(int) * (n_fds + j));
0284adc6a60ce0af1107cb0b50041a65d731f39eLennart Poettering memcpy(fds + n_fds, d->fds, sizeof(int) * j);
return -EBADMSG;
return -EBADMSG;
return -EPROTOTYPE;
size_t l;
switch (d->type) {
case KDBUS_ITEM_PAYLOAD_OFF: {
if (!part) {
r = -ENOMEM;
goto fail;
case KDBUS_ITEM_PAYLOAD_MEMFD: {
r = -EBADMSG;
goto fail;
if (!part) {
r = -ENOMEM;
goto fail;
case KDBUS_ITEM_PIDS:
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:
r = -EBADMSG;
goto fail;
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:
r = -EBADMSG;
goto fail;
case KDBUS_ITEM_OWNED_NAME:
r = -EBADMSG;
goto fail;
char **wkn;
size_t n;
if (!wkn) {
r = -ENOMEM;
goto fail;
case KDBUS_ITEM_AUXGROUPS:
case KDBUS_ITEM_FDS:
case KDBUS_ITEM_SECLABEL:
r = bus_message_parse_fields(m);
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
goto fail;
r = -EBADMSG;
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_pids_valid)
if (b->fake_label) {
if (b->fake_creds_valid) {
if (b->fake_pids_valid) {
if (b->fake_label) {
return -errno;
if (!b->kdbus_buffer) {
r = -errno;
goto fail;
r = -ENOTSUP;
goto fail;
r = -ENOTSUP;
goto fail;
r = -ENOMEM;
goto fail;
b->is_kernel = true;
b->bus_client = true;
return bus_start_running(b);
fail:
assert(b);
if (b->is_server)
return -EINVAL;
if (b->input_fd < 0)
return -errno;
return bus_kernel_take_fd(b);
return -errno;
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(
const char *name,
const char *old_owner,
const char *new_owner,
bus,
"/org/freedesktop/DBus",
m = NULL;
static int translate_name_change(
const struct kdbus_msg *k,
const struct kdbus_item *d,
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;
static int translate_id_change(
const struct kdbus_msg *k,
const struct kdbus_item *d,
assert(k);
assert(d);
return push_name_owner_changed(
ts);
static int translate_reply(
const struct kdbus_msg *k,
const struct kdbus_item *d,
assert(k);
assert(d);
bus,
k->cookie_reply,
m = NULL;
static int (* const translate[])(sd_bus *bus, const struct kdbus_msg *k, const struct kdbus_item *d, const struct kdbus_timestamp *ts) = {
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) {
log_debug("%s: kdbus reports %" PRIu64 " dropped broadcast messages, ignoring.", strna(bus->description), (uint64_t) recv.dropped_msgs);
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;
uint64_t m = 0;
m |= KDBUS_ATTACH_CREDS;
m |= KDBUS_ATTACH_PIDS;
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;
m |= KDBUS_ATTACH_AUXGROUPS;
struct kdbus_item *n;
size_t l;
int fd;
assert(s);
if (fd < 0)
return -errno;
sizeof(struct kdbus_bloom_parameter);
n = KDBUS_ITEM_NEXT(n);
n = KDBUS_ITEM_NEXT(n);
n = KDBUS_ITEM_NEXT(n);
return -errno;
return -ENOMEM;
return fd;
int fd;
if (path) {
return -ENOMEM;
if (fd < 0) {
if (path)
free(p);
return -errno;
if (path)
*path = p;
return fd;
struct kdbus_item *n;
const char *name;
int fd;
if (fd < 0)
return fd;
return -errno;
if (ep_path) {
return -ENOMEM;
*ep_path = p;
return fd;
return -errno;
return -errno;
struct kdbus_item *n;
return -errno;
int bus_kernel_fix_attach_mask(void) {
char *n = NULL;
return -errno;
return -EIO;
*name = n;