kdbus.h revision f8c2425287c8362ae3a3c9acfb9e23a16862b38a
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt/*
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * Copyright (C) 2013-2014 Kay Sievers
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * Copyright (C) 2013-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * Copyright (C) 2013-2014 Linux Foundation
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * Copyright (C) 2013-2014 Lennart Poettering
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * Copyright (C) 2013-2014 Daniel Mack <daniel@zonque.org>
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt *
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * kdbus is free software; you can redistribute it and/or modify it under
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * the terms of the GNU Lesser General Public License as published by the
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * Free Software Foundation; either version 2.1 of the License, or (at
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * your option) any later version.
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt *
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * "Everything should be made as simple as possible, but not simpler."
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * -- Albert Einstein
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt */
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt#ifndef _KDBUS_UAPI_H_
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt#define _KDBUS_UAPI_H_
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt#include <linux/ioctl.h>
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt#include <linux/types.h>
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt#define KDBUS_IOCTL_MAGIC 0x95
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt#define KDBUS_SRC_ID_KERNEL (0)
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt#define KDBUS_DST_ID_NAME (0)
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering#define KDBUS_MATCH_ID_ANY (~0ULL)
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt#define KDBUS_DST_ID_BROADCAST (~0ULL)
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering/**
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * struct kdbus_notify_id_change - name registry change message
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * @id: New or former owner of the name
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @flags: flags field from KDBUS_HELLO_*
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt *
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * Sent from kernel to userspace when the owner or activator of
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * a well-known name changes.
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering *
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * Attached to:
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * KDBUS_ITEM_ID_ADD
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * KDBUS_ITEM_ID_REMOVE
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt */
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flyktstruct kdbus_notify_id_change {
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt __u64 id;
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt __u64 flags;
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt};
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt/**
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * struct kdbus_notify_name_change - name registry change message
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @old: ID and flags of former owner of a name
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @new: ID and flags of new owner of a name
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @name: Well-known name
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt *
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * Sent from kernel to userspace when the owner or activator of
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * a well-known name changes.
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt *
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * Attached to:
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * KDBUS_ITEM_NAME_ADD
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * KDBUS_ITEM_NAME_REMOVE
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * KDBUS_ITEM_NAME_CHANGE
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt */
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flyktstruct kdbus_notify_name_change {
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt struct kdbus_notify_id_change old;
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt struct kdbus_notify_id_change new;
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt char name[0];
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt};
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt/**
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * struct kdbus_creds - process credentials
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * @uid: User ID
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * @gid: Group ID
76253e73f9c9c24fec755e485516f3b55d0707b4Dan Williams * @pid: Process ID
76253e73f9c9c24fec755e485516f3b55d0707b4Dan Williams * @tid: Thread ID
76253e73f9c9c24fec755e485516f3b55d0707b4Dan Williams * @starttime: Starttime of the process
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt *
da6fe470e17fa02f3adedc779585caf8669252bdPatrik Flykt * The starttime of the process PID. This is useful to detect PID overruns
da6fe470e17fa02f3adedc779585caf8669252bdPatrik Flykt * from the client side. i.e. if you use the PID to look something up in
da6fe470e17fa02f3adedc779585caf8669252bdPatrik Flykt * /proc/$PID/ you can afterwards check the starttime field of it, to ensure
41e4615d4f4f5c61afa84ba857f23c0ac496687bPatrik Flykt * you didn't run into a PID overrun.
da6fe470e17fa02f3adedc779585caf8669252bdPatrik Flykt *
da6fe470e17fa02f3adedc779585caf8669252bdPatrik Flykt * Attached to:
da6fe470e17fa02f3adedc779585caf8669252bdPatrik Flykt * KDBUS_ITEM_CREDS
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt */
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flyktstruct kdbus_creds {
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt __u64 uid;
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt __u64 gid;
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt __u64 pid;
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt __u64 tid;
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt __u64 starttime;
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt};
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt/**
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * struct kdbus_audit - audit information
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @sessionid: The audit session ID
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @loginuid: The audit login uid
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt *
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * Attached to:
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * KDBUS_ITEM_AUDIT
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt */
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flyktstruct kdbus_audit {
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 sessionid;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 loginuid;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt};
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt/**
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * struct kdbus_timestamp
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @seqnum: Global per-domain message sequence number
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @monotonic_ns: Monotonic timestamp, in nanoseconds
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @realtime_ns: Realtime timestamp, in nanoseconds
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt *
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * Attached to:
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * KDBUS_ITEM_TIMESTAMP
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt */
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flyktstruct kdbus_timestamp {
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 seqnum;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 monotonic_ns;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 realtime_ns;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt};
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt/**
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * struct kdbus_vec - I/O vector for kdbus payload items
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @size: The size of the vector
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @address: Memory address of data buffer
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @offset: Offset in the in-message payload memory,
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * relative to the message head
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt *
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * Attached to:
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * KDBUS_ITEM_PAYLOAD_VEC, KDBUS_ITEM_PAYLOAD_OFF
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt */
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flyktstruct kdbus_vec {
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 size;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt union {
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 address;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 offset;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt };
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt};
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt/**
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * struct kdbus_bloom_parameter - bus-wide bloom parameters
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @size: Size of the bit field in bytes (m / 8)
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @n_hash: Number of hash functions used (k)
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt */
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flyktstruct kdbus_bloom_parameter {
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 size;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 n_hash;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt};
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt/**
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * struct kdbus_bloom_filter - bloom filter containing n elements
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @generation: Generation of the element set in the filter
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @data: Bit field, multiple of 8 bytes
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt */
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flyktstruct kdbus_bloom_filter {
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 generation;
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt __u64 data[0];
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt};
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt/**
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * struct kdbus_memfd - a kdbus memfd
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @size: The memfd's size
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @fd: The file descriptor number
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @__pad: Padding to ensure proper alignment and size
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt *
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * Attached to:
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * KDBUS_ITEM_PAYLOAD_MEMFD
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt */
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flyktstruct kdbus_memfd {
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt __u64 size;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt int fd;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt __u32 __pad;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt};
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt/**
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * struct kdbus_name - a registered well-known name with its flags
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @flags: Flags from KDBUS_NAME_*
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @name: Well-known name
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt *
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * Attached to:
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * KDBUS_ITEM_NAME
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt */
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flyktstruct kdbus_name {
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt __u64 flags;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt char name[0];
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt};
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt/**
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * struct kdbus_policy_access - policy access item
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @type: One of KDBUS_POLICY_ACCESS_* types
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @access: Access to grant
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @id: For KDBUS_POLICY_ACCESS_USER, the uid
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * For KDBUS_POLICY_ACCESS_GROUP, the gid
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt */
947527f8326d3591f252c48fee5426a563f03544Patrik Flyktstruct kdbus_policy_access {
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 type; /* USER, GROUP, WORLD */
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 access; /* OWN, TALK, SEE */
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 id; /* uid, gid, 0 */
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt};
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt/**
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * enum kdbus_item_type - item types to chain data in a list
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @_KDBUS_ITEM_NULL: Uninitialized/invalid
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @_KDBUS_ITEM_USER_BASE: Start of user items
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @KDBUS_ITEM_PAYLOAD_VEC: Vector to data
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @KDBUS_ITEM_PAYLOAD_OFF: Data at returned offset to message head
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @KDBUS_ITEM_PAYLOAD_MEMFD: Data as sealed memfd
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @KDBUS_ITEM_FDS: Attached file descriptors
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @KDBUS_ITEM_BLOOM_PARAMETER: Bus-wide bloom parameters, used with
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * KDBUS_CMD_BUS_MAKE, carries a
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * struct kdbus_bloom_parameter
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_BLOOM_FILTER: Bloom filter carried with a message, used to
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * match against a bloom mask of a connection,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * carries a struct kdbus_bloom_filter
44481a8b537839cd9ffead4d261491641f5b5260Zbigniew Jędrzejewski-Szmek * @KDBUS_ITEM_BLOOM_MASK: Bloom mask used to match against a message's
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * bloom filter
d182960ae974a0074010a058d0d909846a2f3f79Patrik Flykt * @KDBUS_ITEM_DST_NAME: Destination's well-known name
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_MAKE_NAME: Name of domain, bus, endpoint
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_MEMFD_NAME: The human readable name of a memfd (debugging)
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_ATTACH_FLAGS: Attach-flags, used for updating which metadata
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * a connection subscribes to
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @_KDBUS_ITEM_ATTACH_BASE: Start of metadata attach items
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_NAME: Well-know name with flags
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @KDBUS_ITEM_ID: Connection ID
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @KDBUS_ITEM_TIMESTAMP: Timestamp
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_CREDS: Process credential
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_AUXGROUPS: Auxiliary process groups
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_PID_COMM: Process ID "comm" identifier
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_TID_COMM: Thread ID "comm" identifier
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_EXE: The path of the executable
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_CMDLINE: The process command line
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_CGROUP: The croup membership
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_CAPS: The process capabilities
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_SECLABEL: The security label
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_AUDIT: The audit IDs
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_CONN_NAME: The connection's human-readable name (debugging)
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @_KDBUS_ITEM_POLICY_BASE: Start of policy items
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_POLICY_ACCESS: Policy access block
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @_KDBUS_ITEM_KERNEL_BASE: Start of kernel-generated message items
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_NAME_ADD: Notify in struct kdbus_notify_name_change
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_NAME_REMOVE: Notify in struct kdbus_notify_name_change
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_NAME_CHANGE: Notify in struct kdbus_notify_name_change
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_ID_ADD: Notify in struct kdbus_notify_id_change
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_ID_REMOVE: Notify in struct kdbus_notify_id_change
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_REPLY_TIMEOUT: Timeout has been reached
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_ITEM_REPLY_DEAD: Destination died
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt */
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flyktenum kdbus_item_type {
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt _KDBUS_ITEM_NULL,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt _KDBUS_ITEM_USER_BASE,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_PAYLOAD_VEC = _KDBUS_ITEM_USER_BASE,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_PAYLOAD_OFF,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_PAYLOAD_MEMFD,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_FDS,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_BLOOM_PARAMETER,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_BLOOM_FILTER,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_BLOOM_MASK,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_DST_NAME,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_MAKE_NAME,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_MEMFD_NAME,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_ATTACH_FLAGS,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt _KDBUS_ITEM_ATTACH_BASE = 0x1000,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_NAME = _KDBUS_ITEM_ATTACH_BASE,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_ID,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_TIMESTAMP,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_CREDS,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_AUXGROUPS,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_PID_COMM,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_TID_COMM,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_EXE,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_CMDLINE,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_CGROUP,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_CAPS,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_SECLABEL,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_AUDIT,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_CONN_NAME,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt _KDBUS_ITEM_POLICY_BASE = 0x2000,
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt KDBUS_ITEM_POLICY_ACCESS = _KDBUS_ITEM_POLICY_BASE,
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt _KDBUS_ITEM_KERNEL_BASE = 0x8000,
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt KDBUS_ITEM_NAME_ADD = _KDBUS_ITEM_KERNEL_BASE,
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt KDBUS_ITEM_NAME_REMOVE,
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt KDBUS_ITEM_NAME_CHANGE,
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt KDBUS_ITEM_ID_ADD,
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt KDBUS_ITEM_ID_REMOVE,
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt KDBUS_ITEM_REPLY_TIMEOUT,
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt KDBUS_ITEM_REPLY_DEAD,
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt};
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt/**
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * struct kdbus_item - chain of data blocks
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @size: Overall data record size
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @type: Kdbus_item type of data
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @data: Generic bytes
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @data32: Generic 32 bit array
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @data64: Generic 64 bit array
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @str: Generic string
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @id: Connection ID
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @vec: KDBUS_ITEM_PAYLOAD_VEC
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @creds: KDBUS_ITEM_CREDS
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @audit: KDBUS_ITEM_AUDIT
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @timestamp: KDBUS_ITEM_TIMESTAMP
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @name: KDBUS_ITEM_NAME
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @bloom_parameter: KDBUS_ITEM_BLOOM_PARAMETER
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @bloom_filter: KDBUS_ITEM_BLOOM_FILTER
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @memfd: KDBUS_ITEM_PAYLOAD_MEMFD
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @name_change: KDBUS_ITEM_NAME_ADD
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * KDBUS_ITEM_NAME_REMOVE
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * KDBUS_ITEM_NAME_CHANGE
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @id_change: KDBUS_ITEM_ID_ADD
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * KDBUS_ITEM_ID_REMOVE
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt * @policy: KDBUS_ITEM_POLICY_ACCESS
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt */
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flyktstruct kdbus_item {
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt __u64 size;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt __u64 type;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt union {
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt __u8 data[0];
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt __u32 data32[0];
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt __u64 data64[0];
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt char str[0];
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt __u64 id;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt struct kdbus_vec vec;
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt struct kdbus_creds creds;
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt struct kdbus_audit audit;
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt struct kdbus_timestamp timestamp;
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt struct kdbus_name name;
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt struct kdbus_bloom_parameter bloom_parameter;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt struct kdbus_bloom_filter bloom_filter;
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt struct kdbus_memfd memfd;
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt int fds[0];
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt struct kdbus_notify_name_change name_change;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt struct kdbus_notify_id_change id_change;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt struct kdbus_policy_access policy_access;
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt };
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt};
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt/**
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * enum kdbus_msg_flags - type of message
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @KDBUS_MSG_FLAGS_EXPECT_REPLY: Expect a reply message, used for
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * method calls. The userspace-supplied
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * cookie identifies the message and the
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * respective reply carries the cookie
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * in cookie_reply
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @KDBUS_MSG_FLAGS_SYNC_REPLY: Wait for destination connection to
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * reply to this message. The
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * KDBUS_CMD_MSG_SEND ioctl() will block
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * until the reply is received, and
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * offset_reply in struct kdbus_msg will
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * yield the offset in the sender's pool
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * where the reply can be found.
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * This flag is only valid if
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_MSG_FLAGS_EXPECT_REPLY is set as
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * well.
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_MSG_FLAGS_NO_AUTO_START: Do not start a service, if the addressed
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * name is not currently active
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt */
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flyktenum kdbus_msg_flags {
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_MSG_FLAGS_EXPECT_REPLY = 1ULL << 0,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_MSG_FLAGS_SYNC_REPLY = 1ULL << 1,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_MSG_FLAGS_NO_AUTO_START = 1ULL << 2,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt};
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt/**
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * enum kdbus_payload_type - type of payload carried by message
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @KDBUS_PAYLOAD_KERNEL: Kernel-generated simple message
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @KDBUS_PAYLOAD_DBUS: D-Bus marshalling "DBusDBus"
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt */
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flyktenum kdbus_payload_type {
10c9ce615d98e125bc520efa94aebaef250a4061David Herrmann KDBUS_PAYLOAD_KERNEL,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_PAYLOAD_DBUS = 0x4442757344427573ULL,
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt};
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt/**
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * struct kdbus_msg - the representation of a kdbus message
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @size: Total size of the message
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @flags: Message flags (KDBUS_MSG_FLAGS_*)
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @priority: Message queue priority value
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @dst_id: 64-bit ID of the destination connection
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @src_id: 64-bit ID of the source connection
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @payload_type: Payload type (KDBUS_PAYLOAD_*)
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @cookie: Userspace-supplied cookie, for the connection
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * to identify its messages
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @timeout_ns: The time to wait for a message reply from the peer.
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * If there is no reply, a kernel-generated message
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * with an attached KDBUS_ITEM_REPLY_TIMEOUT item
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * is sent to @src_id.
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @cookie_reply: A reply to the requesting message with the same
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * cookie. The requesting connection can match its
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * request and the reply with this value
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @offset_reply: If KDBUS_MSG_FLAGS_EXPECT_REPLY, this field will
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * contain the offset in the sender's pool where the
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * reply is stored.
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt * @items: A list of kdbus_items containing the message payload
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt */
947527f8326d3591f252c48fee5426a563f03544Patrik Flyktstruct kdbus_msg {
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 size;
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 flags;
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __s64 priority;
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 dst_id;
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 src_id;
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 payload_type;
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 cookie;
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt union {
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 timeout_ns;
947527f8326d3591f252c48fee5426a563f03544Patrik Flykt __u64 cookie_reply;
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt __u64 offset_reply;
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt };
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt struct kdbus_item items[0];
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt} __attribute__((aligned(8)));
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt/**
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * enum kdbus_recv_flags - flags for de-queuing messages
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_RECV_PEEK: Return the next queued message without
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * actually de-queuing it, and without installing
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * any file descriptors or other resources. It is
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * usually used to determine the activating
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * connection of a bus name.
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_RECV_DROP: Drop and free the next queued message and all
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * its resources without actually receiving it.
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_RECV_USE_PRIORITY: Only de-queue messages with the specified or
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * higher priority (lowest values); if not set,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * the priority value is ignored.
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt */
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flyktenum kdbus_recv_flags {
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt KDBUS_RECV_PEEK = 1ULL << 0,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt KDBUS_RECV_DROP = 1ULL << 1,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt KDBUS_RECV_USE_PRIORITY = 1ULL << 2,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt};
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt/**
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * struct kdbus_cmd_recv - struct to de-queue a buffered message
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @flags: KDBUS_RECV_* flags
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @priority: Minimum priority of the messages to de-queue. Lowest
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * values have the highest priority.
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @offset: Returned offset in the pool where the message is
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * stored. The user must use KDBUS_CMD_FREE to free
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * the allocated memory.
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt *
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * This struct is used with the KDBUS_CMD_MSG_RECV ioctl.
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt */
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flyktstruct kdbus_cmd_recv {
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt __u64 flags;
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt __s64 priority;
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt __u64 offset;
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt} __attribute__((aligned(8)));
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt/**
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * enum kdbus_policy_access_type - permissions of a policy record
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @_KDBUS_POLICY_ACCESS_NULL: Uninitialized/invalid
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_POLICY_ACCESS_USER: Grant access to a uid
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_POLICY_ACCESS_GROUP: Grant access to gid
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_POLICY_ACCESS_WORLD: World-accessible
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt */
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flyktenum kdbus_policy_access_type {
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt _KDBUS_POLICY_ACCESS_NULL,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt KDBUS_POLICY_ACCESS_USER,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt KDBUS_POLICY_ACCESS_GROUP,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt KDBUS_POLICY_ACCESS_WORLD,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt};
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt/**
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * enum kdbus_policy_access_flags - mode flags
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_POLICY_OWN: Allow to own a well-known name
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * Implies KDBUS_POLICY_TALK and KDBUS_POLICY_SEE
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * @KDBUS_POLICY_TALK: Allow communication to a well-known name
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * Implies KDBUS_POLICY_SEE
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * @KDBUS_POLICY_SEE: Allow to see a well-known name
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt */
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flyktenum kdbus_policy_type {
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt KDBUS_POLICY_SEE = 0,
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt KDBUS_POLICY_TALK,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt KDBUS_POLICY_OWN,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt};
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt/**
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * enum kdbus_hello_flags - flags for struct kdbus_cmd_hello
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * @KDBUS_HELLO_ACCEPT_FD: The connection allows the reception of
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * any passed file descriptors
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_HELLO_ACTIVATOR: Special-purpose connection which registers
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt * a well-know name for a process to be started
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt * when traffic arrives
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt * @KDBUS_HELLO_POLICY_HOLDER: Special-purpose connection which registers
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * policy entries for a name. The provided name
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * is not activated and not registered with the
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * name database, it only allows unprivileged
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * connections to aquire a name, talk or discover
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt * a service
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt * @KDBUS_HELLO_MONITOR: Special-purpose connection to monitor
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * bus traffic
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt */
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flyktenum kdbus_hello_flags {
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt KDBUS_HELLO_ACCEPT_FD = 1ULL << 0,
52efd56a6369e19c2400a42981a197cd2eef924aLennart Poettering KDBUS_HELLO_ACTIVATOR = 1ULL << 1,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt KDBUS_HELLO_POLICY_HOLDER = 1ULL << 2,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt KDBUS_HELLO_MONITOR = 1ULL << 3,
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt};
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt/**
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * enum kdbus_attach_flags - flags for metadata attachments
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_TIMESTAMP: Timestamp
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_CREDS: Credentials
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_AUXGROUPS: Auxiliary groups
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_NAMES: Well-known names
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_COMM: The "comm" process identifier
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_EXE: The path of the executable
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_CMDLINE: The process command line
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_CGROUP: The croup membership
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_CAPS: The process capabilities
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_SECLABEL: The security label
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_AUDIT: The audit IDs
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @KDBUS_ATTACH_CONN_NAME: The human-readable connection name
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @_KDBUS_ATTACH_ALL: All of the above
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt */
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flyktenum kdbus_attach_flags {
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_ATTACH_TIMESTAMP = 1ULL << 0,
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt KDBUS_ATTACH_CREDS = 1ULL << 1,
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt KDBUS_ATTACH_AUXGROUPS = 1ULL << 2,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_ATTACH_NAMES = 1ULL << 3,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_ATTACH_COMM = 1ULL << 4,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_ATTACH_EXE = 1ULL << 5,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_ATTACH_CMDLINE = 1ULL << 6,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_ATTACH_CGROUP = 1ULL << 7,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_ATTACH_CAPS = 1ULL << 8,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_ATTACH_SECLABEL = 1ULL << 9,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_ATTACH_AUDIT = 1ULL << 10,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt KDBUS_ATTACH_CONN_NAME = 1ULL << 11,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt _KDBUS_ATTACH_ALL = (1ULL << 12) - 1,
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt};
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt/**
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * struct kdbus_cmd_hello - struct to say hello to kdbus
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @size: The total size of the structure
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @conn_flags: Connection flags (KDBUS_HELLO_*).
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @attach_flags: Mask of metadata to attach to each message sent
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * (KDBUS_ATTACH_*)
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @bus_flags: The flags field copied verbatim from the original
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * KDBUS_CMD_BUS_MAKE ioctl. It's intended to be useful
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * to do negotiation of features of the payload that is
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * transferred (kernel → userspace)
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @id: The ID of this connection (kernel → userspace)
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt * @pool_size: Size of the connection's buffer where the received
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * messages are placed
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * @bloom: The bloom properties of the bus, specified
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * by the bus creator (kernel → userspace)
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * @id128: Unique 128-bit ID of the bus (kernel → userspace)
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * @items: A list of items
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt *
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt * This struct is used with the KDBUS_CMD_HELLO ioctl.
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt */
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flyktstruct kdbus_cmd_hello {
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 size;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 conn_flags;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 attach_flags;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 bus_flags;
d63be95a306bf1e262c7e1c7ad4b2c12b49d371ePatrik Flykt __u64 id;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 pool_size;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt struct kdbus_bloom_parameter bloom;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u8 id128[16];
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt struct kdbus_item items[0];
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt} __attribute__((aligned(8)));
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt/**
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * enum kdbus_make_flags - Flags for KDBUS_CMD_{BUS,EP,NS}_MAKE
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @KDBUS_MAKE_ACCESS_GROUP: Make the device node group-accessible
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @KDBUS_MAKE_ACCESS_WORLD: Make the device node world-accessible
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt */
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flyktenum kdbus_make_flags {
10c9ce615d98e125bc520efa94aebaef250a4061David Herrmann KDBUS_MAKE_ACCESS_GROUP = 1ULL << 0,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt KDBUS_MAKE_ACCESS_WORLD = 1ULL << 1,
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt};
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt/**
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * struct kdbus_cmd_make - struct to make a bus, an endpoint or a domain
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @size: The total size of the struct
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @flags: Properties for the bus/ep/domain to create
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * @items: Items describing details
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt *
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * This structure is used with the KDBUS_CMD_BUS_MAKE, KDBUS_CMD_EP_MAKE and
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt * KDBUS_CMD_DOMAIN_MAKE ioctls.
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flykt */
bc152ff879a79412e358daaaa3677a0fc226bcb0Patrik Flyktstruct kdbus_cmd_make {
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt __u64 size;
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt __u64 flags;
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt struct kdbus_item items[0];
44598572da523f66872f593be7139b9a0f97deeePatrik Flykt} __attribute__((aligned(8)));
44598572da523f66872f593be7139b9a0f97deeePatrik Flykt
44598572da523f66872f593be7139b9a0f97deeePatrik Flykt/**
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * enum kdbus_name_flags - properties of a well-known name
44598572da523f66872f593be7139b9a0f97deeePatrik Flykt * @KDBUS_NAME_REPLACE_EXISTING: Try to replace name of other connections
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @KDBUS_NAME_ALLOW_REPLACEMENT: Allow the replacement of the name
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @KDBUS_NAME_QUEUE: Name should be queued if busy
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @KDBUS_NAME_IN_QUEUE: Name is queued
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @KDBUS_NAME_ACTIVATOR: Name is owned by a activator connection
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt */
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flyktenum kdbus_name_flags {
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt KDBUS_NAME_REPLACE_EXISTING = 1ULL << 0,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt KDBUS_NAME_ALLOW_REPLACEMENT = 1ULL << 1,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt KDBUS_NAME_QUEUE = 1ULL << 2,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt KDBUS_NAME_IN_QUEUE = 1ULL << 3,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt KDBUS_NAME_ACTIVATOR = 1ULL << 4,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt};
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt/**
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * struct kdbus_cmd_name - struct to describe a well-known name
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @size: The total size of the struct
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @flags: Flags for a name entry (KDBUS_NAME_*)
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @owner_id: The current owner of the name
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @conn_flags: The flags of the owning connection (KDBUS_HELLO_*)
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @items: Item list, containing the well-known name as
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * KDBUS_ITEM_NAME
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt *
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * This structure is used with the KDBUS_CMD_NAME_ACQUIRE ioctl.
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt */
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flyktstruct kdbus_cmd_name {
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt __u64 size;
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt __u64 flags;
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt __u64 owner_id;
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt __u64 conn_flags;
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt struct kdbus_item items[0];
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt} __attribute__((aligned(8)));
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt/**
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * enum kdbus_name_list_flags - what to include into the returned list
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @KDBUS_NAME_LIST_UNIQUE: All active connections
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @KDBUS_NAME_LIST_NAMES: All known well-known names
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @KDBUS_NAME_LIST_ACTIVATORS: All activator connections
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @KDBUS_NAME_LIST_QUEUED: All queued-up names
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt */
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flyktenum kdbus_name_list_flags {
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt KDBUS_NAME_LIST_UNIQUE = 1ULL << 0,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt KDBUS_NAME_LIST_NAMES = 1ULL << 1,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt KDBUS_NAME_LIST_ACTIVATORS = 1ULL << 2,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt KDBUS_NAME_LIST_QUEUED = 1ULL << 3,
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt};
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt/**
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * struct kdbus_cmd_name_list - request a list of name entries
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @flags: Flags for the query (KDBUS_NAME_LIST_*)
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @offset: The returned offset in the caller's pool buffer.
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * The user must use KDBUS_CMD_FREE to free the
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * allocated memory.
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt *
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * This structure is used with the KDBUS_CMD_NAME_LIST ioctl.
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt */
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flyktstruct kdbus_cmd_name_list {
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt __u64 flags;
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt __u64 offset;
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt} __attribute__((aligned(8)));
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt
e7504d95479455be5cef120fc8e0a48fd74ad5caPatrik Flykt/**
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * struct kdbus_name_list - information returned by KDBUS_CMD_NAME_LIST
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @size: The total size of the structure
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @names: A list of names
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt *
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * Note that the user is responsible for freeing the allocated memory with
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * the KDBUS_CMD_FREE ioctl.
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt */
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flyktstruct kdbus_name_list {
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 size;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt struct kdbus_cmd_name names[0];
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt};
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt/**
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * struct kdbus_cmd_conn_info - struct used for KDBUS_CMD_CONN_INFO ioctl
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @size: The total size of the struct
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @flags: KDBUS_ATTACH_* flags
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @id: The 64-bit ID of the connection. If set to zero, passing
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @name is required. kdbus will look up the name to
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * determine the ID in this case.
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @offset: Returned offset in the caller's pool buffer where the
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * kdbus_conn_info struct result is stored. The user must
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * use KDBUS_CMD_FREE to free the allocated memory.
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @name: The optional well-known name to look up. Only needed in
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * case @id is zero.
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt *
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * On success, the KDBUS_CMD_CONN_INFO ioctl will return 0 and @offset will
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * tell the user the offset in the connection pool buffer at which to find the
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * result in a struct kdbus_conn_info.
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt */
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flyktstruct kdbus_cmd_conn_info {
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt __u64 size;
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt __u64 flags;
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt __u64 id;
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt __u64 offset;
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt char name[0];
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt} __attribute__((aligned(8)));
5e256ea7d3d556b3a1fb5c1faa94ec6a8833e53ePatrik Flykt
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt/**
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * struct kdbus_conn_info - information returned by KDBUS_CMD_CONN_INFO
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @size: The total size of the struct
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @id: The connection's 64-bit ID
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @flags: The connection's flags
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @items: A list of struct kdbus_item
da6fe470e17fa02f3adedc779585caf8669252bdPatrik Flykt *
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * Note that the user is responsible for freeing the allocated memory with
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * the KDBUS_CMD_FREE ioctl.
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt */
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flyktstruct kdbus_conn_info {
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 size;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 id;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 flags;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt struct kdbus_item items[0];
fa94c34b083b5b4019975624453e53d0cbad2a5dTom Gundersen};
04c0136989b7eb896bfb0fb176e11233d69e1453Lennart Poettering
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt/**
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * struct kdbus_cmd_update - update flags of a connection
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @size: The total size of the struct
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @items: A list of struct kdbus_item
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt *
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * This struct is used with the KDBUS_CMD_CONN_UPDATE ioctl.
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt */
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flyktstruct kdbus_cmd_update {
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 size;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt struct kdbus_item items[0];
76253e73f9c9c24fec755e485516f3b55d0707b4Dan Williams} __attribute__((aligned(8)));
76253e73f9c9c24fec755e485516f3b55d0707b4Dan Williams
76253e73f9c9c24fec755e485516f3b55d0707b4Dan Williams/**
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * struct kdbus_cmd_match - struct to add or remove matches
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @size: The total size of the struct
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @cookie: Userspace supplied cookie. When removing, the cookie
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * identifies the match to remove
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * @items: A list of items for additional information
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt *
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt * This structure is used with the KDBUS_CMD_ADD_MATCH and
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * KDBUS_CMD_REMOVE_MATCH ioctl.
c4e8ceddccfbb14e475e74eb5c57ba32c3c6cf86Patrik Flykt */
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flyktstruct kdbus_cmd_match {
fa94c34b083b5b4019975624453e53d0cbad2a5dTom Gundersen __u64 size;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt __u64 cookie;
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt struct kdbus_item items[0];
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt} __attribute__((aligned(8)));
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt/**
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * enum kdbus_ioctl_type - Ioctl API
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @KDBUS_CMD_BUS_MAKE: After opening the "control" device node, this
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * command creates a new bus with the specified
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * name. The bus is immediately shut down and
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * cleaned up when the opened "control" device node
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * is closed.
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @KDBUS_CMD_DOMAIN_MAKE: Similar to KDBUS_CMD_BUS_MAKE, but it creates a
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * new kdbus domain.
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * @KDBUS_CMD_EP_MAKE: Creates a new named special endpoint to talk to
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * the bus. Such endpoints usually carry a more
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * restrictive policy and grant restricted access
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * to specific applications.
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * @KDBUS_CMD_HELLO: By opening the bus device node a connection is
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * created. After a HELLO the opened connection
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * becomes an active peer on the bus.
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * @KDBUS_CMD_BYEBYE: Disconnect a connection. If there are no
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * messages queued up in the connection's pool,
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * the call succeeds, and the handle is rendered
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * unusable. Otherwise, -EBUSY is returned without
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * any further side-effects.
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * @KDBUS_CMD_MSG_SEND: Send a message and pass data from userspace to
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * the kernel.
859cca44f834ab1cc3e41fa6b94744f1856ab027Patrik Flykt * @KDBUS_CMD_MSG_RECV: Receive a message from the kernel which is
2ea8857effb833615b16d10fc7a19a7104c19e13Patrik Flykt * placed in the receiver's pool.
f12ed3bf0b315fc88d5fbdf5bdca14b218c86e0cPatrik Flykt * @KDBUS_CMD_MSG_CANCEL: Cancel a pending request of a message that
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * blocks while waiting for a reply. The parameter
813e3a6ffcd094696001716480bbd68008cc54c8Patrik Flykt * denotes the cookie of the message in flight.
* @KDBUS_CMD_FREE: Release the allocated memory in the receiver's
* pool.
* @KDBUS_CMD_NAME_ACQUIRE: Request a well-known bus name to associate with
* the connection. Well-known names are used to
* address a peer on the bus.
* @KDBUS_CMD_NAME_RELEASE: Release a well-known name the connection
* currently owns.
* @KDBUS_CMD_NAME_LIST: Retrieve the list of all currently registered
* well-known and unique names.
* @KDBUS_CMD_CONN_INFO: Retrieve credentials and properties of the
* initial creator of the connection. The data was
* stored at registration time and does not
* necessarily represent the connected process or
* the actual state of the process.
* @KDBUS_CMD_CONN_UPDATE: Update the properties of a connection. Used to
* update the metadata subscription mask and
* policy.
* @KDBUS_CMD_EP_UPDATE: Update the properties of a custom enpoint. Used
* to update the policy.
* @KDBUS_CMD_MATCH_ADD: Install a match which broadcast messages should
* be delivered to the connection.
* @KDBUS_CMD_MATCH_REMOVE: Remove a current match for broadcast messages.
*/
enum kdbus_ioctl_type {
KDBUS_CMD_BUS_MAKE = _IOW(KDBUS_IOCTL_MAGIC, 0x00,
struct kdbus_cmd_make),
KDBUS_CMD_DOMAIN_MAKE = _IOW(KDBUS_IOCTL_MAGIC, 0x10,
struct kdbus_cmd_make),
KDBUS_CMD_EP_MAKE = _IOW(KDBUS_IOCTL_MAGIC, 0x20,
struct kdbus_cmd_make),
KDBUS_CMD_HELLO = _IOWR(KDBUS_IOCTL_MAGIC, 0x30,
struct kdbus_cmd_hello),
KDBUS_CMD_BYEBYE = _IO(KDBUS_IOCTL_MAGIC, 0x31),
KDBUS_CMD_MSG_SEND = _IOWR(KDBUS_IOCTL_MAGIC, 0x40,
struct kdbus_msg),
KDBUS_CMD_MSG_RECV = _IOWR(KDBUS_IOCTL_MAGIC, 0x41,
struct kdbus_cmd_recv),
KDBUS_CMD_MSG_CANCEL = _IOW(KDBUS_IOCTL_MAGIC, 0x42, __u64 *),
KDBUS_CMD_FREE = _IOW(KDBUS_IOCTL_MAGIC, 0x43, __u64 *),
KDBUS_CMD_NAME_ACQUIRE = _IOWR(KDBUS_IOCTL_MAGIC, 0x50,
struct kdbus_cmd_name),
KDBUS_CMD_NAME_RELEASE = _IOW(KDBUS_IOCTL_MAGIC, 0x51,
struct kdbus_cmd_name),
KDBUS_CMD_NAME_LIST = _IOWR(KDBUS_IOCTL_MAGIC, 0x52,
struct kdbus_cmd_name_list),
KDBUS_CMD_CONN_INFO = _IOWR(KDBUS_IOCTL_MAGIC, 0x60,
struct kdbus_cmd_conn_info),
KDBUS_CMD_CONN_UPDATE = _IOW(KDBUS_IOCTL_MAGIC, 0x61,
struct kdbus_cmd_update),
KDBUS_CMD_EP_UPDATE = _IOW(KDBUS_IOCTL_MAGIC, 0x71,
struct kdbus_cmd_update),
KDBUS_CMD_MATCH_ADD = _IOW(KDBUS_IOCTL_MAGIC, 0x80,
struct kdbus_cmd_match),
KDBUS_CMD_MATCH_REMOVE = _IOW(KDBUS_IOCTL_MAGIC, 0x81,
struct kdbus_cmd_match),
};
#endif /* _KDBUS_UAPI_H_ */