summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2014-10-27 17:02:31 +0100
committerDaniel Mack <daniel@zonque.org>2014-10-27 17:02:31 +0100
commit5ebe2ce782a5f4614b3381ba093cbebded3d3ce6 (patch)
tree399a734f2f97dc9a3f95450c8d5cfa42e8f32eac /src/libsystemd
parente0104622b33f39ea8fd54f0a286d938401c08e3d (diff)
sd-bus: sync kdbus.h (ABI break)
Some comment fixes and header cleanups in kdbus.h, and the task capability meta information has been factored out to its own struct.
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c4
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c4
-rw-r--r--src/libsystemd/sd-bus/kdbus.h41
3 files changed, 28 insertions, 21 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 39f4fc83a7..5a052d455e 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -495,8 +495,8 @@ static int bus_populate_creds_from_items(sd_bus *bus,
SD_BUS_CREDS_INHERITABLE_CAPS | SD_BUS_CREDS_BOUNDING_CAPS) & mask;
if (m) {
- c->capability_size = item->size - KDBUS_ITEM_HEADER_SIZE;
- c->capability = memdup(item->data, c->capability_size);
+ c->capability_size = item->size - offsetof(struct kdbus_item, caps.caps);
+ c->capability = memdup(item->caps.caps, c->capability_size);
if (!c->capability)
return -ENOMEM;
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index c23065edfe..0327614742 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -575,8 +575,8 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
break;
case KDBUS_ITEM_CAPS:
- m->creds.capability = d->data;
- m->creds.capability_size = l;
+ m->creds.capability = (uint8_t *) d->caps.caps;
+ m->creds.capability_size = d->size - offsetof(struct kdbus_item, caps.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;
break;
diff --git a/src/libsystemd/sd-bus/kdbus.h b/src/libsystemd/sd-bus/kdbus.h
index 7a715a0994..2ebf405d7d 100644
--- a/src/libsystemd/sd-bus/kdbus.h
+++ b/src/libsystemd/sd-bus/kdbus.h
@@ -1,18 +1,8 @@
/*
- * Copyright (C) 2013-2014 Kay Sievers
- * Copyright (C) 2013-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- * Copyright (C) 2013-2014 Linux Foundation
- * Copyright (C) 2013-2014 Lennart Poettering
- * Copyright (C) 2013-2014 Daniel Mack <daniel@zonque.org>
- * Copyright (C) 2013-2014 David Herrmann <dh.herrmann@gmail.com>
- *
* kdbus is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
- *
- * "Everything should be made as simple as possible, but not simpler."
- * -- Albert Einstein
*/
#ifndef _KDBUS_UAPI_H_
@@ -90,6 +80,21 @@ struct kdbus_creds {
};
/**
+ * struct kdbus_caps - process capabilities
+ * @last_cap: Highest currently known capability bit
+ * @caps: Variable number of 32-bit capabilities flags
+ *
+ * Contains a variable number of 32-bit capabilities flags.
+ *
+ * Attached to:
+ * KDBUS_ITEM_CAPS
+ */
+struct kdbus_caps {
+ __u32 last_cap;
+ __u32 caps[0];
+};
+
+/**
* struct kdbus_audit - audit information
* @sessionid: The audit session ID
* @loginuid: The audit login uid
@@ -322,6 +327,7 @@ struct kdbus_item {
struct kdbus_vec vec;
struct kdbus_creds creds;
struct kdbus_audit audit;
+ struct kdbus_caps caps;
struct kdbus_timestamp timestamp;
struct kdbus_name name;
struct kdbus_bloom_parameter bloom_parameter;
@@ -731,8 +737,9 @@ struct kdbus_name_list {
* @offset: Returned offset in the caller's pool buffer where the
* kdbus_info struct result is stored. The user must
* use KDBUS_CMD_FREE to free the allocated memory.
- * @name: The optional well-known name to look up. Only needed in
- * case @id is zero.
+ * @items: The optional item list, containing the
+ * well-known name to look up as a KDBUS_ITEM_NAME.
+ * Only needed in case @id is zero.
*
* On success, the KDBUS_CMD_CONN_INFO ioctl will return 0 and @offset will
* tell the user the offset in the connection pool buffer at which to find the
@@ -748,10 +755,10 @@ struct kdbus_cmd_info {
} __attribute__((aligned(8)));
/**
- * struct kdbus_info - information returned by KDBUS_CMD_CONN_INFO
+ * struct kdbus_info - information returned by KDBUS_CMD_*_INFO
* @size: The total size of the struct
- * @id: The connection's 64-bit ID
- * @flags: The connection's flags
+ * @id: The connection's or bus' 64-bit ID
+ * @flags: The connection's or bus' flags
* @items: A list of struct kdbus_item
*
* Note that the user is responsible for freeing the allocated memory with
@@ -800,8 +807,8 @@ enum kdbus_cmd_match_flags {
* @kernel_flags: Supported flags of the used command, kernel → userspace
* @items: A list of items for additional information
*
- * This structure is used with the KDBUS_CMD_ADD_MATCH and
- * KDBUS_CMD_REMOVE_MATCH ioctl.
+ * This structure is used with the KDBUS_CMD_MATCH_ADD and
+ * KDBUS_CMD_MATCH_REMOVE ioctl.
*/
struct kdbus_cmd_match {
__u64 size;