chiark / gitweb /
bus: fix SD_BUS_CREDS_AUGMENT on kdbus queries
[elogind.git] / src / libsystemd / sd-bus / kdbus.h
index 201f21dd136b485105015ae8e4bb0078273422a4..c238d79d589d5874cd98432674fa1aa3d8147932 100644 (file)
@@ -229,6 +229,9 @@ struct kdbus_policy_access {
  * @KDBUS_ITEM_PAYLOAD_OFF:            Data at returned offset to message head
  * @KDBUS_ITEM_PAYLOAD_MEMFD:          Data as sealed memfd
  * @KDBUS_ITEM_FDS:                    Attached file descriptors
+ * @KDBUS_ITEM_CANCEL_FD:              FD used to cancel a synchronous
+ *                                     operation by writing to it from
+ *                                     userspace
  * @KDBUS_ITEM_BLOOM_PARAMETER:                Bus-wide bloom parameters, used with
  *                                     KDBUS_CMD_BUS_MAKE, carries a
  *                                     struct kdbus_bloom_parameter
@@ -292,6 +295,7 @@ enum kdbus_item_type {
        KDBUS_ITEM_PAYLOAD_OFF,
        KDBUS_ITEM_PAYLOAD_MEMFD,
        KDBUS_ITEM_FDS,
+       KDBUS_ITEM_CANCEL_FD,
        KDBUS_ITEM_BLOOM_PARAMETER,
        KDBUS_ITEM_BLOOM_FILTER,
        KDBUS_ITEM_BLOOM_MASK,
@@ -402,10 +406,12 @@ struct kdbus_item_list {
  *                             in cookie_reply
  * @KDBUS_MSG_NO_AUTO_START:   Do not start a service, if the addressed
  *                             name is not currently active
+ * @KDBUS_MSG_SIGNAL:          Treat this message as signal
  */
 enum kdbus_msg_flags {
        KDBUS_MSG_EXPECT_REPLY  = 1ULL << 0,
        KDBUS_MSG_NO_AUTO_START = 1ULL << 1,
+       KDBUS_MSG_SIGNAL        = 1ULL << 2,
 };
 
 /**
@@ -457,12 +463,12 @@ struct kdbus_msg {
 } __attribute__((aligned(8)));
 
 /**
- * struct kdbus_reply - reply container
+ * struct kdbus_msg_info - returned message container
  * @offset:            Offset of kdbus_msg slice in pool
  * @msg_size:          Copy of the kdbus_msg.size field
  * @return_flags:      Command return flags, kernel → userspace
  */
-struct kdbus_reply {
+struct kdbus_msg_info {
        __u64 offset;
        __u64 msg_size;
        __u64 return_flags;
@@ -503,7 +509,7 @@ struct kdbus_cmd_send {
        __u64 kernel_msg_flags;
        __u64 return_flags;
        __u64 msg_address;
-       struct kdbus_reply reply;
+       struct kdbus_msg_info reply;
        struct kdbus_item items[0];
 } __attribute__((aligned(8)));
 
@@ -560,27 +566,7 @@ struct kdbus_cmd_recv {
        __u64 return_flags;
        __s64 priority;
        __u64 dropped_msgs;
-       struct kdbus_reply reply;
-       struct kdbus_item items[0];
-} __attribute__((aligned(8)));
-
-/**
- * struct kdbus_cmd_cancel - struct to cancel a synchronously pending message
- * @size:              Overall size of this object
- * @flags:             Flags for the free command. Currently unused.
- * @kernel_flags:      Supported flags of CANCEL, kernel → userspace
- * @return_flags:      Command return flags, kernel → userspace
- * @cookie:            The cookie of the pending message
- * @items:             Items to modify the command behavior
- *
- * This struct is used with the KDBUS_CMD_CANCEL ioctl.
- */
-struct kdbus_cmd_cancel {
-       __u64 size;
-       __u64 flags;
-       __u64 kernel_flags;
-       __u64 return_flags;
-       __u64 cookie;
+       struct kdbus_msg_info msg;
        struct kdbus_item items[0];
 } __attribute__((aligned(8)));
 
@@ -648,15 +634,12 @@ enum kdbus_policy_type {
  *                             a service
  * @KDBUS_HELLO_MONITOR:       Special-purpose connection to monitor
  *                             bus traffic
- * @KDBUS_HELLO_UNPRIVILEGED:  Don't treat this connection as privileged once
- *                             the bus connection was established.
  */
 enum kdbus_hello_flags {
        KDBUS_HELLO_ACCEPT_FD           =  1ULL <<  0,
        KDBUS_HELLO_ACTIVATOR           =  1ULL <<  1,
        KDBUS_HELLO_POLICY_HOLDER       =  1ULL <<  2,
        KDBUS_HELLO_MONITOR             =  1ULL <<  3,
-       KDBUS_HELLO_UNPRIVILEGED        =  1ULL <<  4,
 };
 
 /**
@@ -719,8 +702,6 @@ enum kdbus_attach_flags {
  *                     kdbus_item_list are stored. They contain information
  *                     about the bus and the newly created connection.
  * @items_size:                Copy of item_list.size stored in @offset.
- * @bloom:             The bloom properties of the bus, specified
- *                     by the bus creator (kernel → userspace)
  * @id128:             Unique 128-bit ID of the bus (kernel → userspace)
  * @items:             A list of items
  *
@@ -861,7 +842,9 @@ enum kdbus_name_list_flags {
  * @offset:            The returned offset in the caller's pool buffer.
  *                     The user must use KDBUS_CMD_FREE to free the
  *                     allocated memory.
+ * @list_size:         Returned size of list in bytes
  * @size:              Output buffer to report size of data at @offset.
+ * @items:             Items for the command. Reserved for future use.
  *
  * This structure is used with the KDBUS_CMD_NAME_LIST ioctl.
  */
@@ -998,9 +981,6 @@ struct kdbus_cmd_match {
  *                             the kernel.
  * KDBUS_CMD_RECV:             Receive a message from the kernel which is
  *                             placed in the receiver's pool.
- * KDBUS_CMD_CANCEL:           Cancel a pending request of a message that
- *                             blocks while waiting for a reply. The parameter
- *                             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
@@ -1022,48 +1002,48 @@ struct kdbus_cmd_match {
  *                             a connection is attached to.
  * KDBUS_CMD_ENDPOINT_UPDATE:  Update the properties of a custom enpoint. Used
  *                             to update the policy.
- * KDBUS_CMD_MATCH_ADD:        Install a match which broadcast messages should
+ * 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.
  */
-#define KDBUS_CMD_BUS_MAKE             _IOW(KDBUS_IOCTL_MAGIC, 0x00,   \
-                                            struct kdbus_cmd_make)
-#define KDBUS_CMD_ENDPOINT_MAKE                _IOW(KDBUS_IOCTL_MAGIC, 0x10,   \
-                                            struct kdbus_cmd_make)
+enum kdbus_ioctl_type {
+       KDBUS_CMD_BUS_MAKE =            _IOW(KDBUS_IOCTL_MAGIC, 0x00,
+                                            struct kdbus_cmd_make),
+       KDBUS_CMD_ENDPOINT_MAKE =       _IOW(KDBUS_IOCTL_MAGIC, 0x10,
+                                            struct kdbus_cmd_make),
 
-#define KDBUS_CMD_HELLO                        _IOWR(KDBUS_IOCTL_MAGIC, 0x20,  \
-                                             struct kdbus_cmd_hello)
-#define KDBUS_CMD_BYEBYE               _IO(KDBUS_IOCTL_MAGIC, 0x21)    \
+       KDBUS_CMD_HELLO =               _IOWR(KDBUS_IOCTL_MAGIC, 0x20,
+                                             struct kdbus_cmd_hello),
+       KDBUS_CMD_BYEBYE =              _IO(KDBUS_IOCTL_MAGIC, 0x21),
 
-#define KDBUS_CMD_SEND                 _IOWR(KDBUS_IOCTL_MAGIC, 0x30,  \
-                                             struct kdbus_msg)
-#define KDBUS_CMD_RECV                 _IOWR(KDBUS_IOCTL_MAGIC, 0x31,  \
-                                             struct kdbus_cmd_recv)
-#define KDBUS_CMD_CANCEL               _IOW(KDBUS_IOCTL_MAGIC, 0x32,   \
-                                            struct kdbus_cmd_cancel)
-#define KDBUS_CMD_FREE                 _IOW(KDBUS_IOCTL_MAGIC, 0x33,   \
-                                            struct kdbus_cmd_free)
+       KDBUS_CMD_SEND =                _IOWR(KDBUS_IOCTL_MAGIC, 0x30,
+                                             struct kdbus_cmd_send),
+       KDBUS_CMD_RECV =                _IOWR(KDBUS_IOCTL_MAGIC, 0x31,
+                                             struct kdbus_cmd_recv),
+       KDBUS_CMD_FREE =                _IOW(KDBUS_IOCTL_MAGIC, 0x32,
+                                            struct kdbus_cmd_free),
 
-#define KDBUS_CMD_NAME_ACQUIRE         _IOWR(KDBUS_IOCTL_MAGIC, 0x40,  \
-                                             struct kdbus_cmd_name)
-#define KDBUS_CMD_NAME_RELEASE         _IOW(KDBUS_IOCTL_MAGIC, 0x41,   \
-                                            struct kdbus_cmd_name)
-#define KDBUS_CMD_NAME_LIST            _IOWR(KDBUS_IOCTL_MAGIC, 0x42,  \
-                                             struct kdbus_cmd_name_list)
+       KDBUS_CMD_NAME_ACQUIRE =        _IOWR(KDBUS_IOCTL_MAGIC, 0x40,
+                                             struct kdbus_cmd_name),
+       KDBUS_CMD_NAME_RELEASE =        _IOW(KDBUS_IOCTL_MAGIC, 0x41,
+                                            struct kdbus_cmd_name),
+       KDBUS_CMD_NAME_LIST =           _IOWR(KDBUS_IOCTL_MAGIC, 0x42,
+                                             struct kdbus_cmd_name_list),
 
-#define KDBUS_CMD_CONN_INFO            _IOWR(KDBUS_IOCTL_MAGIC, 0x50,  \
-                                             struct kdbus_cmd_info)
-#define KDBUS_CMD_CONN_UPDATE          _IOW(KDBUS_IOCTL_MAGIC, 0x51,   \
-                                            struct kdbus_cmd_update)
-#define KDBUS_CMD_BUS_CREATOR_INFO     _IOWR(KDBUS_IOCTL_MAGIC, 0x52,  \
-                                             struct kdbus_cmd_info)
+       KDBUS_CMD_CONN_INFO =           _IOWR(KDBUS_IOCTL_MAGIC, 0x50,
+                                             struct kdbus_cmd_info),
+       KDBUS_CMD_CONN_UPDATE =         _IOW(KDBUS_IOCTL_MAGIC, 0x51,
+                                            struct kdbus_cmd_update),
+       KDBUS_CMD_BUS_CREATOR_INFO =    _IOWR(KDBUS_IOCTL_MAGIC, 0x52,
+                                             struct kdbus_cmd_info),
 
-#define KDBUS_CMD_ENDPOINT_UPDATE      _IOW(KDBUS_IOCTL_MAGIC, 0x61,   \
-                                            struct kdbus_cmd_update)
+       KDBUS_CMD_ENDPOINT_UPDATE =     _IOW(KDBUS_IOCTL_MAGIC, 0x61,
+                                            struct kdbus_cmd_update),
 
-#define KDBUS_CMD_MATCH_ADD            _IOW(KDBUS_IOCTL_MAGIC, 0x70,   \
-                                            struct kdbus_cmd_match)
-#define KDBUS_CMD_MATCH_REMOVE         _IOW(KDBUS_IOCTL_MAGIC, 0x71,   \
-                                            struct kdbus_cmd_match)
+       KDBUS_CMD_MATCH_ADD =           _IOW(KDBUS_IOCTL_MAGIC, 0x70,
+                                            struct kdbus_cmd_match),
+       KDBUS_CMD_MATCH_REMOVE =        _IOW(KDBUS_IOCTL_MAGIC, 0x71,
+                                            struct kdbus_cmd_match),
+};
 
 #endif /* _KDBUS_UAPI_H_ */