chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sd-bus: sync kdbus.h (ABI break)
[elogind.git]
/
src
/
libsystemd
/
sd-bus
/
bus-kernel.c
diff --git
a/src/libsystemd/sd-bus/bus-kernel.c
b/src/libsystemd/sd-bus/bus-kernel.c
index 0c39e22ed78706dc066f85e77d5f6ef732e0eb88..27899c1989140d0ce193cdf14565739da9933596 100644
(file)
--- a/
src/libsystemd/sd-bus/bus-kernel.c
+++ b/
src/libsystemd/sd-bus/bus-kernel.c
@@
-332,6
+332,18
@@
fail:
return r;
}
return r;
}
+static void unset_memfds(struct sd_bus_message *m) {
+ struct bus_body_part *part;
+ unsigned i;
+
+ assert(m);
+
+ /* Make sure the memfds are not freed twice */
+ MESSAGE_FOREACH_PART(part, i, m)
+ if (part->memfd >= 0)
+ part->memfd = -1;
+}
+
static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
sd_bus_message *m = NULL;
struct kdbus_item *d;
static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
sd_bus_message *m = NULL;
struct kdbus_item *d;
@@
-627,17
+639,8
@@
static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
return 1;
fail:
return 1;
fail:
- if (m) {
- struct bus_body_part *part;
- unsigned i;
-
- /* Make sure the memfds are not freed twice */
- MESSAGE_FOREACH_PART(part, i, m)
- if (part->memfd >= 0)
- part->memfd = -1;
-
- sd_bus_message_unref(m);
- }
+ unset_memfds(m);
+ sd_bus_message_unref(m);
return r;
}
return r;
}
@@
-796,14
+799,14
@@
int bus_kernel_connect(sd_bus *b) {
}
static void close_kdbus_msg(sd_bus *bus, struct kdbus_msg *k) {
}
static void close_kdbus_msg(sd_bus *bus, struct kdbus_msg *k) {
-
uint64_t off _alignas_(8)
;
+
struct kdbus_cmd_free cmd
;
struct kdbus_item *d;
assert(bus);
assert(k);
struct kdbus_item *d;
assert(bus);
assert(k);
-
off = (uint8_t *)k - (uint8_t *)bus->kdbus_buffer
;
-
ioctl(bus->input_fd, KDBUS_CMD_FREE, &off)
;
+
cmd.flags = 0
;
+
cmd.offset = (uint8_t *)k - (uint8_t *)bus->kdbus_buffer
;
KDBUS_ITEM_FOREACH(d, k, items) {
KDBUS_ITEM_FOREACH(d, k, items) {
@@
-812,6
+815,8
@@
static void close_kdbus_msg(sd_bus *bus, struct kdbus_msg *k) {
else if (d->type == KDBUS_ITEM_PAYLOAD_MEMFD)
safe_close(d->memfd.fd);
}
else if (d->type == KDBUS_ITEM_PAYLOAD_MEMFD)
safe_close(d->memfd.fd);
}
+
+ (void) ioctl(bus->input_fd, KDBUS_CMD_FREE, &cmd);
}
int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call) {
}
int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call) {
@@
-1302,9
+1307,9
@@
int bus_kernel_create_bus(const char *name, bool world, char **s) {
return -errno;
}
return -errno;
}
- /* The
higher 32bit of the flags field are considered
- *
'incompatible flags'.
Refuse them all for now. */
- if (make->f
lags > 0xFFFFFFFFULL
) {
+ /* The
features field are considered 'incompatible flags'.
+ * Refuse them all for now. */
+ if (make->f
eatures
) {
safe_close(fd);
return -ENOTSUP;
}
safe_close(fd);
return -ENOTSUP;
}
@@
-1434,14
+1439,14
@@
int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char *
n->size = offsetof(struct kdbus_item, str) + strlen(ep_name) + 1;
strcpy(n->str, ep_name);
n->size = offsetof(struct kdbus_item, str) + strlen(ep_name) + 1;
strcpy(n->str, ep_name);
- if (ioctl(fd, KDBUS_CMD_E
P
_MAKE, make) < 0) {
+ if (ioctl(fd, KDBUS_CMD_E
NDPOINT
_MAKE, make) < 0) {
safe_close(fd);
return -errno;
}
safe_close(fd);
return -errno;
}
- /* The
higher 32bit of the flags field are considered
- *
'incompatible flags'.
Refuse them all for now. */
- if (make->f
lags > 0xFFFFFFFFULL
) {
+ /* The
features field are considered 'incompatible flags'.
+ * Refuse them all for now. */
+ if (make->f
eatures
) {
safe_close(fd);
return -ENOTSUP;
}
safe_close(fd);
return -ENOTSUP;
}
@@
-1498,7
+1503,7
@@
int bus_kernel_set_endpoint_policy(int fd, uid_t uid, BusEndpoint *ep) {
n = KDBUS_ITEM_NEXT(n);
}
n = KDBUS_ITEM_NEXT(n);
}
- r = ioctl(fd, KDBUS_CMD_E
P
_UPDATE, update);
+ r = ioctl(fd, KDBUS_CMD_E
NDPOINT
_UPDATE, update);
if (r < 0)
return -errno;
if (r < 0)
return -errno;
@@
-1561,6
+1566,7
@@
int bus_kernel_make_starter(
hello->size = size;
hello->conn_flags =
hello->size = size;
hello->conn_flags =
+ KDBUS_HELLO_ACCEPT_MEMFD |
(activating ? KDBUS_HELLO_ACTIVATOR : KDBUS_HELLO_POLICY_HOLDER) |
(accept_fd ? KDBUS_HELLO_ACCEPT_FD : 0);
hello->pool_size = KDBUS_POOL_SIZE;
(activating ? KDBUS_HELLO_ACTIVATOR : KDBUS_HELLO_POLICY_HOLDER) |
(accept_fd ? KDBUS_HELLO_ACCEPT_FD : 0);
hello->pool_size = KDBUS_POOL_SIZE;
@@
-1571,7
+1577,8
@@
int bus_kernel_make_starter(
/* The higher 32bit of both flags fields are considered
* 'incompatible flags'. Refuse them all for now. */
/* The higher 32bit of both flags fields are considered
* 'incompatible flags'. Refuse them all for now. */
- if (hello->bus_flags > 0xFFFFFFFFULL ||
+ if (hello->features ||
+ hello->bus_flags > 0xFFFFFFFFULL ||
hello->conn_flags > 0xFFFFFFFFULL)
return -ENOTSUP;
hello->conn_flags > 0xFFFFFFFFULL)
return -ENOTSUP;