Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 7 | #ifndef _UAPI_LINUX_BINDER_H |
| 8 | #define _UAPI_LINUX_BINDER_H |
| 9 | #include <linux/types.h> |
| 10 | #include <linux/ioctl.h> |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 11 | #define B_PACK_CHARS(c1,c2,c3,c4) ((((c1) << 24)) | (((c2) << 16)) | (((c3) << 8)) | (c4)) |
| 12 | #define B_TYPE_LARGE 0x85 |
| 13 | enum { |
| 14 | BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 15 | BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE), |
| 16 | BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE), |
| 17 | BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE), |
| 18 | BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE), |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 19 | BINDER_TYPE_FDA = B_PACK_CHARS('f', 'd', 'a', B_TYPE_LARGE), |
| 20 | BINDER_TYPE_PTR = B_PACK_CHARS('p', 't', '*', B_TYPE_LARGE), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 21 | }; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 22 | enum flat_binder_object_shifts { |
| 23 | FLAT_BINDER_FLAG_SCHED_POLICY_SHIFT = 9, |
| 24 | }; |
| 25 | enum flat_binder_object_flags { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 26 | FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, |
| 27 | FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 28 | FLAT_BINDER_FLAG_SCHED_POLICY_MASK = 3U << FLAT_BINDER_FLAG_SCHED_POLICY_SHIFT, |
| 29 | FLAT_BINDER_FLAG_INHERIT_RT = 0x800, |
Christopher Ferris | e6be532 | 2019-03-20 15:33:33 -0700 | [diff] [blame] | 30 | FLAT_BINDER_FLAG_TXN_SECURITY_CTX = 0x1000, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 31 | }; |
| 32 | #ifdef BINDER_IPC_32BIT |
| 33 | typedef __u32 binder_size_t; |
| 34 | typedef __u32 binder_uintptr_t; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 35 | #else |
| 36 | typedef __u64 binder_size_t; |
| 37 | typedef __u64 binder_uintptr_t; |
| 38 | #endif |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 39 | struct binder_object_header { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 40 | __u32 type; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 41 | }; |
| 42 | struct flat_binder_object { |
| 43 | struct binder_object_header hdr; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 44 | __u32 flags; |
| 45 | union { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 46 | binder_uintptr_t binder; |
| 47 | __u32 handle; |
| 48 | }; |
| 49 | binder_uintptr_t cookie; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 50 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 51 | struct binder_fd_object { |
| 52 | struct binder_object_header hdr; |
| 53 | __u32 pad_flags; |
| 54 | union { |
| 55 | binder_uintptr_t pad_binder; |
| 56 | __u32 fd; |
| 57 | }; |
| 58 | binder_uintptr_t cookie; |
| 59 | }; |
| 60 | struct binder_buffer_object { |
| 61 | struct binder_object_header hdr; |
| 62 | __u32 flags; |
| 63 | binder_uintptr_t buffer; |
| 64 | binder_size_t length; |
| 65 | binder_size_t parent; |
| 66 | binder_size_t parent_offset; |
| 67 | }; |
| 68 | enum { |
| 69 | BINDER_BUFFER_FLAG_HAS_PARENT = 0x01, |
| 70 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 71 | struct binder_fd_array_object { |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 72 | struct binder_object_header hdr; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 73 | __u32 pad; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 74 | binder_size_t num_fds; |
| 75 | binder_size_t parent; |
| 76 | binder_size_t parent_offset; |
| 77 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 78 | struct binder_write_read { |
| 79 | binder_size_t write_size; |
| 80 | binder_size_t write_consumed; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 81 | binder_uintptr_t write_buffer; |
| 82 | binder_size_t read_size; |
| 83 | binder_size_t read_consumed; |
| 84 | binder_uintptr_t read_buffer; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 85 | }; |
| 86 | struct binder_version { |
| 87 | __s32 protocol_version; |
| 88 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 89 | #ifdef BINDER_IPC_32BIT |
| 90 | #define BINDER_CURRENT_PROTOCOL_VERSION 7 |
| 91 | #else |
| 92 | #define BINDER_CURRENT_PROTOCOL_VERSION 8 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 93 | #endif |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 94 | struct binder_node_debug_info { |
| 95 | binder_uintptr_t ptr; |
| 96 | binder_uintptr_t cookie; |
| 97 | __u32 has_strong_ref; |
| 98 | __u32 has_weak_ref; |
| 99 | }; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 100 | struct binder_node_info_for_ref { |
| 101 | __u32 handle; |
| 102 | __u32 strong_count; |
| 103 | __u32 weak_count; |
| 104 | __u32 reserved1; |
| 105 | __u32 reserved2; |
| 106 | __u32 reserved3; |
| 107 | }; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 108 | struct binder_freeze_info { |
| 109 | __u32 pid; |
| 110 | __u32 enable; |
| 111 | __u32 timeout_ms; |
| 112 | }; |
| 113 | struct binder_frozen_status_info { |
| 114 | __u32 pid; |
| 115 | __u32 sync_recv; |
| 116 | __u32 async_recv; |
| 117 | }; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 118 | struct binder_extended_error { |
| 119 | __u32 id; |
| 120 | __u32 command; |
| 121 | __s32 param; |
| 122 | }; |
Christopher Ferris | b830ddf | 2024-03-28 11:48:08 -0700 | [diff] [blame^] | 123 | enum { |
| 124 | BINDER_WRITE_READ = _IOWR('b', 1, struct binder_write_read), |
| 125 | BINDER_SET_IDLE_TIMEOUT = _IOW('b', 3, __s64), |
| 126 | BINDER_SET_MAX_THREADS = _IOW('b', 5, __u32), |
| 127 | BINDER_SET_IDLE_PRIORITY = _IOW('b', 6, __s32), |
| 128 | BINDER_SET_CONTEXT_MGR = _IOW('b', 7, __s32), |
| 129 | BINDER_THREAD_EXIT = _IOW('b', 8, __s32), |
| 130 | BINDER_VERSION = _IOWR('b', 9, struct binder_version), |
| 131 | BINDER_GET_NODE_DEBUG_INFO = _IOWR('b', 11, struct binder_node_debug_info), |
| 132 | BINDER_GET_NODE_INFO_FOR_REF = _IOWR('b', 12, struct binder_node_info_for_ref), |
| 133 | BINDER_SET_CONTEXT_MGR_EXT = _IOW('b', 13, struct flat_binder_object), |
| 134 | BINDER_FREEZE = _IOW('b', 14, struct binder_freeze_info), |
| 135 | BINDER_GET_FROZEN_INFO = _IOWR('b', 15, struct binder_frozen_status_info), |
| 136 | BINDER_ENABLE_ONEWAY_SPAM_DETECTION = _IOW('b', 16, __u32), |
| 137 | BINDER_GET_EXTENDED_ERROR = _IOWR('b', 17, struct binder_extended_error), |
| 138 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 139 | enum transaction_flags { |
| 140 | TF_ONE_WAY = 0x01, |
| 141 | TF_ROOT_OBJECT = 0x04, |
| 142 | TF_STATUS_CODE = 0x08, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 143 | TF_ACCEPT_FDS = 0x10, |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 144 | TF_CLEAR_BUF = 0x20, |
Christopher Ferris | 7447a1c | 2022-10-04 18:24:44 -0700 | [diff] [blame] | 145 | TF_UPDATE_TXN = 0x40, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 146 | }; |
| 147 | struct binder_transaction_data { |
| 148 | union { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 149 | __u32 handle; |
| 150 | binder_uintptr_t ptr; |
| 151 | } target; |
| 152 | binder_uintptr_t cookie; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 153 | __u32 code; |
| 154 | __u32 flags; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 155 | __kernel_pid_t sender_pid; |
Christopher Ferris | 80ae69d | 2022-08-02 16:32:21 -0700 | [diff] [blame] | 156 | __kernel_uid32_t sender_euid; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 157 | binder_size_t data_size; |
| 158 | binder_size_t offsets_size; |
| 159 | union { |
| 160 | struct { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 161 | binder_uintptr_t buffer; |
| 162 | binder_uintptr_t offsets; |
| 163 | } ptr; |
| 164 | __u8 buf[8]; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 165 | } data; |
| 166 | }; |
Christopher Ferris | e6be532 | 2019-03-20 15:33:33 -0700 | [diff] [blame] | 167 | struct binder_transaction_data_secctx { |
| 168 | struct binder_transaction_data transaction_data; |
| 169 | binder_uintptr_t secctx; |
| 170 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 171 | struct binder_transaction_data_sg { |
| 172 | struct binder_transaction_data transaction_data; |
| 173 | binder_size_t buffers_size; |
| 174 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 175 | struct binder_ptr_cookie { |
| 176 | binder_uintptr_t ptr; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 177 | binder_uintptr_t cookie; |
| 178 | }; |
| 179 | struct binder_handle_cookie { |
| 180 | __u32 handle; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 181 | binder_uintptr_t cookie; |
Colin Cross | 4ac3322 | 2022-12-15 15:45:35 -0800 | [diff] [blame] | 182 | } __attribute__((__packed__)); |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 183 | struct binder_pri_desc { |
| 184 | __s32 priority; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 185 | __u32 desc; |
| 186 | }; |
| 187 | struct binder_pri_ptr_cookie { |
| 188 | __s32 priority; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 189 | binder_uintptr_t ptr; |
| 190 | binder_uintptr_t cookie; |
| 191 | }; |
| 192 | enum binder_driver_return_protocol { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 193 | BR_ERROR = _IOR('r', 0, __s32), |
| 194 | BR_OK = _IO('r', 1), |
Christopher Ferris | e6be532 | 2019-03-20 15:33:33 -0700 | [diff] [blame] | 195 | BR_TRANSACTION_SEC_CTX = _IOR('r', 2, struct binder_transaction_data_secctx), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 196 | BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data), |
| 197 | BR_REPLY = _IOR('r', 3, struct binder_transaction_data), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 198 | BR_ACQUIRE_RESULT = _IOR('r', 4, __s32), |
| 199 | BR_DEAD_REPLY = _IO('r', 5), |
| 200 | BR_TRANSACTION_COMPLETE = _IO('r', 6), |
| 201 | BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 202 | BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie), |
| 203 | BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie), |
| 204 | BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie), |
| 205 | BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 206 | BR_NOOP = _IO('r', 12), |
| 207 | BR_SPAWN_LOOPER = _IO('r', 13), |
| 208 | BR_FINISHED = _IO('r', 14), |
| 209 | BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 210 | BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t), |
| 211 | BR_FAILED_REPLY = _IO('r', 17), |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 212 | BR_FROZEN_REPLY = _IO('r', 18), |
| 213 | BR_ONEWAY_SPAM_SUSPECT = _IO('r', 19), |
Christopher Ferris | b7cef6d | 2023-05-09 19:04:15 +0000 | [diff] [blame] | 214 | BR_TRANSACTION_PENDING_FROZEN = _IO('r', 20), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 215 | }; |
| 216 | enum binder_driver_command_protocol { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 217 | BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data), |
| 218 | BC_REPLY = _IOW('c', 1, struct binder_transaction_data), |
| 219 | BC_ACQUIRE_RESULT = _IOW('c', 2, __s32), |
| 220 | BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 221 | BC_INCREFS = _IOW('c', 4, __u32), |
| 222 | BC_ACQUIRE = _IOW('c', 5, __u32), |
| 223 | BC_RELEASE = _IOW('c', 6, __u32), |
| 224 | BC_DECREFS = _IOW('c', 7, __u32), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 225 | BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie), |
| 226 | BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie), |
| 227 | BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc), |
| 228 | BC_REGISTER_LOOPER = _IO('c', 11), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 229 | BC_ENTER_LOOPER = _IO('c', 12), |
| 230 | BC_EXIT_LOOPER = _IO('c', 13), |
| 231 | BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_handle_cookie), |
| 232 | BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_handle_cookie), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 233 | BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t), |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 234 | BC_TRANSACTION_SG = _IOW('c', 17, struct binder_transaction_data_sg), |
| 235 | BC_REPLY_SG = _IOW('c', 18, struct binder_transaction_data_sg), |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 236 | }; |
| 237 | #endif |