Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 Google, Inc. |
| 3 | * |
| 4 | * Based on, but no longer compatible with, the original |
| 5 | * OpenBinder.org binder driver interface, which is: |
| 6 | * |
| 7 | * Copyright (c) 2005 Palmsource, Inc. |
| 8 | * |
| 9 | * This software is licensed under the terms of the GNU General Public |
| 10 | * License version 2, as published by the Free Software Foundation, and |
| 11 | * may be copied, distributed, and modified under those terms. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | #ifndef _UAPI_LINUX_BINDER_H |
| 21 | #define _UAPI_LINUX_BINDER_H |
| 22 | |
Greg Kroah-Hartman | bc2d62a | 2014-10-16 15:22:30 +0200 | [diff] [blame] | 23 | #include <linux/types.h> |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 24 | #include <linux/ioctl.h> |
| 25 | |
| 26 | #define B_PACK_CHARS(c1, c2, c3, c4) \ |
| 27 | ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4)) |
| 28 | #define B_TYPE_LARGE 0x85 |
| 29 | |
| 30 | enum { |
| 31 | BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE), |
| 32 | BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE), |
| 33 | BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE), |
| 34 | BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE), |
| 35 | BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE), |
Martijn Coenen | e3e0f480 | 2016-10-18 13:58:55 +0200 | [diff] [blame] | 36 | BINDER_TYPE_FDA = B_PACK_CHARS('f', 'd', 'a', B_TYPE_LARGE), |
Martijn Coenen | 5a6da53 | 2016-09-30 14:10:07 +0200 | [diff] [blame] | 37 | BINDER_TYPE_PTR = B_PACK_CHARS('p', 't', '*', B_TYPE_LARGE), |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 38 | }; |
| 39 | |
Martijn Coenen | 6aac979 | 2017-06-07 09:29:14 -0700 | [diff] [blame] | 40 | /** |
| 41 | * enum flat_binder_object_shifts: shift values for flat_binder_object_flags |
| 42 | * @FLAT_BINDER_FLAG_SCHED_POLICY_SHIFT: shift for getting scheduler policy. |
| 43 | * |
| 44 | */ |
| 45 | enum flat_binder_object_shifts { |
| 46 | FLAT_BINDER_FLAG_SCHED_POLICY_SHIFT = 9, |
| 47 | }; |
| 48 | |
| 49 | /** |
| 50 | * enum flat_binder_object_flags - flags for use in flat_binder_object.flags |
| 51 | */ |
| 52 | enum flat_binder_object_flags { |
| 53 | /** |
| 54 | * @FLAT_BINDER_FLAG_PRIORITY_MASK: bit-mask for min scheduler priority |
| 55 | * |
| 56 | * These bits can be used to set the minimum scheduler priority |
| 57 | * at which transactions into this node should run. Valid values |
| 58 | * in these bits depend on the scheduler policy encoded in |
| 59 | * @FLAT_BINDER_FLAG_SCHED_POLICY_MASK. |
| 60 | * |
| 61 | * For SCHED_NORMAL/SCHED_BATCH, the valid range is between [-20..19] |
| 62 | * For SCHED_FIFO/SCHED_RR, the value can run between [1..99] |
| 63 | */ |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 64 | FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, |
Martijn Coenen | 6aac979 | 2017-06-07 09:29:14 -0700 | [diff] [blame] | 65 | /** |
| 66 | * @FLAT_BINDER_FLAG_ACCEPTS_FDS: whether the node accepts fds. |
| 67 | */ |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 68 | FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, |
Martijn Coenen | 6aac979 | 2017-06-07 09:29:14 -0700 | [diff] [blame] | 69 | /** |
| 70 | * @FLAT_BINDER_FLAG_SCHED_POLICY_MASK: bit-mask for scheduling policy |
| 71 | * |
| 72 | * These two bits can be used to set the min scheduling policy at which |
| 73 | * transactions on this node should run. These match the UAPI |
| 74 | * scheduler policy values, eg: |
| 75 | * 00b: SCHED_NORMAL |
| 76 | * 01b: SCHED_FIFO |
| 77 | * 10b: SCHED_RR |
| 78 | * 11b: SCHED_BATCH |
| 79 | */ |
| 80 | FLAT_BINDER_FLAG_SCHED_POLICY_MASK = |
| 81 | 3U << FLAT_BINDER_FLAG_SCHED_POLICY_SHIFT, |
Martijn Coenen | c46810c | 2017-06-23 10:13:43 -0700 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * @FLAT_BINDER_FLAG_INHERIT_RT: whether the node inherits RT policy |
| 85 | * |
| 86 | * Only when set, calls into this node will inherit a real-time |
| 87 | * scheduling policy from the caller (for synchronous transactions). |
| 88 | */ |
| 89 | FLAT_BINDER_FLAG_INHERIT_RT = 0x800, |
Todd Kjos | 63e0afa | 2019-01-14 09:10:21 -0800 | [diff] [blame] | 90 | |
| 91 | /** |
| 92 | * @FLAT_BINDER_FLAG_TXN_SECURITY_CTX: request security contexts |
| 93 | * |
| 94 | * Only when set, causes senders to include their security |
| 95 | * context |
| 96 | */ |
| 97 | FLAT_BINDER_FLAG_TXN_SECURITY_CTX = 0x1000, |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 98 | }; |
| 99 | |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 100 | #ifdef BINDER_IPC_32BIT |
| 101 | typedef __u32 binder_size_t; |
| 102 | typedef __u32 binder_uintptr_t; |
| 103 | #else |
| 104 | typedef __u64 binder_size_t; |
| 105 | typedef __u64 binder_uintptr_t; |
| 106 | #endif |
| 107 | |
Martijn Coenen | 00c8037 | 2016-07-13 12:06:49 +0200 | [diff] [blame] | 108 | /** |
| 109 | * struct binder_object_header - header shared by all binder metadata objects. |
| 110 | * @type: type of the object |
| 111 | */ |
| 112 | struct binder_object_header { |
| 113 | __u32 type; |
| 114 | }; |
| 115 | |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 116 | /* |
| 117 | * This is the flattened representation of a Binder object for transfer |
| 118 | * between processes. The 'offsets' supplied as part of a binder transaction |
| 119 | * contains offsets into the data where these structures occur. The Binder |
| 120 | * driver takes care of re-writing the structure type and data as it moves |
| 121 | * between processes. |
| 122 | */ |
| 123 | struct flat_binder_object { |
Martijn Coenen | 00c8037 | 2016-07-13 12:06:49 +0200 | [diff] [blame] | 124 | struct binder_object_header hdr; |
| 125 | __u32 flags; |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 126 | |
| 127 | /* 8 bytes of data. */ |
| 128 | union { |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 129 | binder_uintptr_t binder; /* local object */ |
| 130 | __u32 handle; /* remote object */ |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 131 | }; |
| 132 | |
| 133 | /* extra data associated with local object */ |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 134 | binder_uintptr_t cookie; |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 135 | }; |
| 136 | |
Martijn Coenen | 00c8037 | 2016-07-13 12:06:49 +0200 | [diff] [blame] | 137 | /** |
| 138 | * struct binder_fd_object - describes a filedescriptor to be fixed up. |
| 139 | * @hdr: common header structure |
| 140 | * @pad_flags: padding to remain compatible with old userspace code |
| 141 | * @pad_binder: padding to remain compatible with old userspace code |
| 142 | * @fd: file descriptor |
| 143 | * @cookie: opaque data, used by user-space |
| 144 | */ |
| 145 | struct binder_fd_object { |
| 146 | struct binder_object_header hdr; |
| 147 | __u32 pad_flags; |
| 148 | union { |
| 149 | binder_uintptr_t pad_binder; |
| 150 | __u32 fd; |
| 151 | }; |
| 152 | |
| 153 | binder_uintptr_t cookie; |
| 154 | }; |
Martijn Coenen | 5a6da53 | 2016-09-30 14:10:07 +0200 | [diff] [blame] | 155 | |
| 156 | /* struct binder_buffer_object - object describing a userspace buffer |
| 157 | * @hdr: common header structure |
| 158 | * @flags: one or more BINDER_BUFFER_* flags |
| 159 | * @buffer: address of the buffer |
| 160 | * @length: length of the buffer |
| 161 | * @parent: index in offset array pointing to parent buffer |
| 162 | * @parent_offset: offset in @parent pointing to this buffer |
| 163 | * |
| 164 | * A binder_buffer object represents an object that the |
| 165 | * binder kernel driver can copy verbatim to the target |
| 166 | * address space. A buffer itself may be pointed to from |
| 167 | * within another buffer, meaning that the pointer inside |
| 168 | * that other buffer needs to be fixed up as well. This |
| 169 | * can be done by setting the BINDER_BUFFER_FLAG_HAS_PARENT |
| 170 | * flag in @flags, by setting @parent buffer to the index |
| 171 | * in the offset array pointing to the parent binder_buffer_object, |
| 172 | * and by setting @parent_offset to the offset in the parent buffer |
| 173 | * at which the pointer to this buffer is located. |
| 174 | */ |
| 175 | struct binder_buffer_object { |
| 176 | struct binder_object_header hdr; |
| 177 | __u32 flags; |
| 178 | binder_uintptr_t buffer; |
| 179 | binder_size_t length; |
| 180 | binder_size_t parent; |
| 181 | binder_size_t parent_offset; |
| 182 | }; |
| 183 | |
| 184 | enum { |
| 185 | BINDER_BUFFER_FLAG_HAS_PARENT = 0x01, |
| 186 | }; |
| 187 | |
Martijn Coenen | e3e0f480 | 2016-10-18 13:58:55 +0200 | [diff] [blame] | 188 | /* struct binder_fd_array_object - object describing an array of fds in a buffer |
| 189 | * @hdr: common header structure |
Martijn Coenen | 8b451dc | 2017-03-07 15:54:56 +0100 | [diff] [blame] | 190 | * @pad: padding to ensure correct alignment |
Martijn Coenen | e3e0f480 | 2016-10-18 13:58:55 +0200 | [diff] [blame] | 191 | * @num_fds: number of file descriptors in the buffer |
| 192 | * @parent: index in offset array to buffer holding the fd array |
| 193 | * @parent_offset: start offset of fd array in the buffer |
| 194 | * |
| 195 | * A binder_fd_array object represents an array of file |
| 196 | * descriptors embedded in a binder_buffer_object. It is |
| 197 | * different from a regular binder_buffer_object because it |
| 198 | * describes a list of file descriptors to fix up, not an opaque |
| 199 | * blob of memory, and hence the kernel needs to treat it differently. |
| 200 | * |
| 201 | * An example of how this would be used is with Android's |
| 202 | * native_handle_t object, which is a struct with a list of integers |
| 203 | * and a list of file descriptors. The native_handle_t struct itself |
| 204 | * will be represented by a struct binder_buffer_objct, whereas the |
| 205 | * embedded list of file descriptors is represented by a |
| 206 | * struct binder_fd_array_object with that binder_buffer_object as |
| 207 | * a parent. |
| 208 | */ |
| 209 | struct binder_fd_array_object { |
| 210 | struct binder_object_header hdr; |
Martijn Coenen | 8b451dc | 2017-03-07 15:54:56 +0100 | [diff] [blame] | 211 | __u32 pad; |
Martijn Coenen | e3e0f480 | 2016-10-18 13:58:55 +0200 | [diff] [blame] | 212 | binder_size_t num_fds; |
| 213 | binder_size_t parent; |
| 214 | binder_size_t parent_offset; |
| 215 | }; |
| 216 | |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 217 | /* |
| 218 | * On 64-bit platforms where user code may run in 32-bits the driver must |
| 219 | * translate the buffer (and local binder) addresses appropriately. |
| 220 | */ |
| 221 | |
| 222 | struct binder_write_read { |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 223 | binder_size_t write_size; /* bytes to write */ |
| 224 | binder_size_t write_consumed; /* bytes consumed by driver */ |
| 225 | binder_uintptr_t write_buffer; |
| 226 | binder_size_t read_size; /* bytes to read */ |
| 227 | binder_size_t read_consumed; /* bytes consumed by driver */ |
| 228 | binder_uintptr_t read_buffer; |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 229 | }; |
| 230 | |
| 231 | /* Use with BINDER_VERSION, driver fills in fields. */ |
| 232 | struct binder_version { |
| 233 | /* driver protocol version -- increment with incompatible change */ |
| 234 | __s32 protocol_version; |
| 235 | }; |
| 236 | |
| 237 | /* This is the current protocol version. */ |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 238 | #ifdef BINDER_IPC_32BIT |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 239 | #define BINDER_CURRENT_PROTOCOL_VERSION 7 |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 240 | #else |
| 241 | #define BINDER_CURRENT_PROTOCOL_VERSION 8 |
| 242 | #endif |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 243 | |
Colin Cross | 833babb3 | 2017-06-20 13:54:44 -0700 | [diff] [blame] | 244 | /* |
| 245 | * Use with BINDER_GET_NODE_DEBUG_INFO, driver reads ptr, writes to all fields. |
| 246 | * Set ptr to NULL for the first call to get the info for the first node, and |
| 247 | * then repeat the call passing the previously returned value to get the next |
| 248 | * nodes. ptr will be 0 when there are no more nodes. |
| 249 | */ |
| 250 | struct binder_node_debug_info { |
| 251 | binder_uintptr_t ptr; |
| 252 | binder_uintptr_t cookie; |
| 253 | __u32 has_strong_ref; |
| 254 | __u32 has_weak_ref; |
| 255 | }; |
| 256 | |
Martijn Coenen | 1c57ba4 | 2018-08-25 13:50:56 -0700 | [diff] [blame] | 257 | struct binder_node_info_for_ref { |
| 258 | __u32 handle; |
| 259 | __u32 strong_count; |
| 260 | __u32 weak_count; |
| 261 | __u32 reserved1; |
| 262 | __u32 reserved2; |
| 263 | __u32 reserved3; |
| 264 | }; |
| 265 | |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 266 | #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) |
| 267 | #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) |
| 268 | #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) |
| 269 | #define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32) |
| 270 | #define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32) |
| 271 | #define BINDER_THREAD_EXIT _IOW('b', 8, __s32) |
| 272 | #define BINDER_VERSION _IOWR('b', 9, struct binder_version) |
Colin Cross | 833babb3 | 2017-06-20 13:54:44 -0700 | [diff] [blame] | 273 | #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) |
Martijn Coenen | 1c57ba4 | 2018-08-25 13:50:56 -0700 | [diff] [blame] | 274 | #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) |
Todd Kjos | 63e0afa | 2019-01-14 09:10:21 -0800 | [diff] [blame] | 275 | #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 276 | |
| 277 | /* |
| 278 | * NOTE: Two special error codes you should check for when calling |
| 279 | * in to the driver are: |
| 280 | * |
| 281 | * EINTR -- The operation has been interupted. This should be |
| 282 | * handled by retrying the ioctl() until a different error code |
| 283 | * is returned. |
| 284 | * |
| 285 | * ECONNREFUSED -- The driver is no longer accepting operations |
| 286 | * from your process. That is, the process is being destroyed. |
| 287 | * You should handle this by exiting from your process. Note |
| 288 | * that once this error code is returned, all further calls to |
| 289 | * the driver from any thread will return this same code. |
| 290 | */ |
| 291 | |
| 292 | enum transaction_flags { |
| 293 | TF_ONE_WAY = 0x01, /* this is a one-way call: async, no return */ |
| 294 | TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */ |
| 295 | TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */ |
| 296 | TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */ |
| 297 | }; |
| 298 | |
| 299 | struct binder_transaction_data { |
| 300 | /* The first two are only used for bcTRANSACTION and brTRANSACTION, |
| 301 | * identifying the target and contents of the transaction. |
| 302 | */ |
| 303 | union { |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 304 | /* target descriptor of command transaction */ |
| 305 | __u32 handle; |
| 306 | /* target descriptor of return transaction */ |
| 307 | binder_uintptr_t ptr; |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 308 | } target; |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 309 | binder_uintptr_t cookie; /* target object cookie */ |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 310 | __u32 code; /* transaction command */ |
| 311 | |
| 312 | /* General information about the transaction. */ |
| 313 | __u32 flags; |
| 314 | pid_t sender_pid; |
| 315 | uid_t sender_euid; |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 316 | binder_size_t data_size; /* number of bytes of data */ |
| 317 | binder_size_t offsets_size; /* number of bytes of offsets */ |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 318 | |
| 319 | /* If this transaction is inline, the data immediately |
| 320 | * follows here; otherwise, it ends with a pointer to |
| 321 | * the data buffer. |
| 322 | */ |
| 323 | union { |
| 324 | struct { |
| 325 | /* transaction data */ |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 326 | binder_uintptr_t buffer; |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 327 | /* offsets from buffer to flat_binder_object structs */ |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 328 | binder_uintptr_t offsets; |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 329 | } ptr; |
| 330 | __u8 buf[8]; |
| 331 | } data; |
| 332 | }; |
| 333 | |
Todd Kjos | 63e0afa | 2019-01-14 09:10:21 -0800 | [diff] [blame] | 334 | struct binder_transaction_data_secctx { |
| 335 | struct binder_transaction_data transaction_data; |
| 336 | binder_uintptr_t secctx; |
| 337 | }; |
| 338 | |
Martijn Coenen | 5a6da53 | 2016-09-30 14:10:07 +0200 | [diff] [blame] | 339 | struct binder_transaction_data_sg { |
| 340 | struct binder_transaction_data transaction_data; |
| 341 | binder_size_t buffers_size; |
| 342 | }; |
| 343 | |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 344 | struct binder_ptr_cookie { |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 345 | binder_uintptr_t ptr; |
| 346 | binder_uintptr_t cookie; |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 347 | }; |
| 348 | |
Serban Constantinescu | df24a2e | 2014-02-21 14:40:25 -0800 | [diff] [blame] | 349 | struct binder_handle_cookie { |
| 350 | __u32 handle; |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 351 | binder_uintptr_t cookie; |
Purnendu Kapadia | 2fd2914 | 2014-08-15 18:20:30 +0100 | [diff] [blame] | 352 | } __packed; |
Serban Constantinescu | df24a2e | 2014-02-21 14:40:25 -0800 | [diff] [blame] | 353 | |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 354 | struct binder_pri_desc { |
| 355 | __s32 priority; |
| 356 | __u32 desc; |
| 357 | }; |
| 358 | |
| 359 | struct binder_pri_ptr_cookie { |
| 360 | __s32 priority; |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 361 | binder_uintptr_t ptr; |
| 362 | binder_uintptr_t cookie; |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 363 | }; |
| 364 | |
| 365 | enum binder_driver_return_protocol { |
| 366 | BR_ERROR = _IOR('r', 0, __s32), |
| 367 | /* |
| 368 | * int: error code |
| 369 | */ |
| 370 | |
| 371 | BR_OK = _IO('r', 1), |
| 372 | /* No parameters! */ |
| 373 | |
Todd Kjos | 63e0afa | 2019-01-14 09:10:21 -0800 | [diff] [blame] | 374 | BR_TRANSACTION_SEC_CTX = _IOR('r', 2, |
| 375 | struct binder_transaction_data_secctx), |
| 376 | /* |
| 377 | * binder_transaction_data_secctx: the received command. |
| 378 | */ |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 379 | BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data), |
| 380 | BR_REPLY = _IOR('r', 3, struct binder_transaction_data), |
| 381 | /* |
| 382 | * binder_transaction_data: the received command. |
| 383 | */ |
| 384 | |
| 385 | BR_ACQUIRE_RESULT = _IOR('r', 4, __s32), |
| 386 | /* |
| 387 | * not currently supported |
| 388 | * int: 0 if the last bcATTEMPT_ACQUIRE was not successful. |
| 389 | * Else the remote object has acquired a primary reference. |
| 390 | */ |
| 391 | |
| 392 | BR_DEAD_REPLY = _IO('r', 5), |
| 393 | /* |
| 394 | * The target of the last transaction (either a bcTRANSACTION or |
| 395 | * a bcATTEMPT_ACQUIRE) is no longer with us. No parameters. |
| 396 | */ |
| 397 | |
| 398 | BR_TRANSACTION_COMPLETE = _IO('r', 6), |
| 399 | /* |
| 400 | * No parameters... always refers to the last transaction requested |
| 401 | * (including replies). Note that this will be sent even for |
| 402 | * asynchronous transactions. |
| 403 | */ |
| 404 | |
| 405 | BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie), |
| 406 | BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie), |
| 407 | BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie), |
| 408 | BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie), |
| 409 | /* |
| 410 | * void *: ptr to binder |
| 411 | * void *: cookie for binder |
| 412 | */ |
| 413 | |
| 414 | BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie), |
| 415 | /* |
| 416 | * not currently supported |
| 417 | * int: priority |
| 418 | * void *: ptr to binder |
| 419 | * void *: cookie for binder |
| 420 | */ |
| 421 | |
| 422 | BR_NOOP = _IO('r', 12), |
| 423 | /* |
| 424 | * No parameters. Do nothing and examine the next command. It exists |
| 425 | * primarily so that we can replace it with a BR_SPAWN_LOOPER command. |
| 426 | */ |
| 427 | |
| 428 | BR_SPAWN_LOOPER = _IO('r', 13), |
| 429 | /* |
| 430 | * No parameters. The driver has determined that a process has no |
| 431 | * threads waiting to service incoming transactions. When a process |
| 432 | * receives this command, it must spawn a new service thread and |
| 433 | * register it via bcENTER_LOOPER. |
| 434 | */ |
| 435 | |
| 436 | BR_FINISHED = _IO('r', 14), |
| 437 | /* |
| 438 | * not currently supported |
| 439 | * stop threadpool thread |
| 440 | */ |
| 441 | |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 442 | BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t), |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 443 | /* |
| 444 | * void *: cookie |
| 445 | */ |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 446 | BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t), |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 447 | /* |
| 448 | * void *: cookie |
| 449 | */ |
| 450 | |
| 451 | BR_FAILED_REPLY = _IO('r', 17), |
| 452 | /* |
| 453 | * The the last transaction (either a bcTRANSACTION or |
| 454 | * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. |
| 455 | */ |
| 456 | }; |
| 457 | |
| 458 | enum binder_driver_command_protocol { |
| 459 | BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data), |
| 460 | BC_REPLY = _IOW('c', 1, struct binder_transaction_data), |
| 461 | /* |
| 462 | * binder_transaction_data: the sent command. |
| 463 | */ |
| 464 | |
| 465 | BC_ACQUIRE_RESULT = _IOW('c', 2, __s32), |
| 466 | /* |
| 467 | * not currently supported |
| 468 | * int: 0 if the last BR_ATTEMPT_ACQUIRE was not successful. |
| 469 | * Else you have acquired a primary reference on the object. |
| 470 | */ |
| 471 | |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 472 | BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t), |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 473 | /* |
| 474 | * void *: ptr to transaction data received on a read |
| 475 | */ |
| 476 | |
| 477 | BC_INCREFS = _IOW('c', 4, __u32), |
| 478 | BC_ACQUIRE = _IOW('c', 5, __u32), |
| 479 | BC_RELEASE = _IOW('c', 6, __u32), |
| 480 | BC_DECREFS = _IOW('c', 7, __u32), |
| 481 | /* |
| 482 | * int: descriptor |
| 483 | */ |
| 484 | |
| 485 | BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie), |
| 486 | BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie), |
| 487 | /* |
| 488 | * void *: ptr to binder |
| 489 | * void *: cookie for binder |
| 490 | */ |
| 491 | |
| 492 | BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc), |
| 493 | /* |
| 494 | * not currently supported |
| 495 | * int: priority |
| 496 | * int: descriptor |
| 497 | */ |
| 498 | |
| 499 | BC_REGISTER_LOOPER = _IO('c', 11), |
| 500 | /* |
| 501 | * No parameters. |
| 502 | * Register a spawned looper thread with the device. |
| 503 | */ |
| 504 | |
| 505 | BC_ENTER_LOOPER = _IO('c', 12), |
| 506 | BC_EXIT_LOOPER = _IO('c', 13), |
| 507 | /* |
| 508 | * No parameters. |
| 509 | * These two commands are sent as an application-level thread |
| 510 | * enters and exits the binder loop, respectively. They are |
| 511 | * used so the binder can have an accurate count of the number |
| 512 | * of looping threads it has available. |
| 513 | */ |
| 514 | |
Serban Constantinescu | df24a2e | 2014-02-21 14:40:25 -0800 | [diff] [blame] | 515 | BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, |
| 516 | struct binder_handle_cookie), |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 517 | /* |
Serban Constantinescu | df24a2e | 2014-02-21 14:40:25 -0800 | [diff] [blame] | 518 | * int: handle |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 519 | * void *: cookie |
| 520 | */ |
| 521 | |
Serban Constantinescu | df24a2e | 2014-02-21 14:40:25 -0800 | [diff] [blame] | 522 | BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, |
| 523 | struct binder_handle_cookie), |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 524 | /* |
Serban Constantinescu | df24a2e | 2014-02-21 14:40:25 -0800 | [diff] [blame] | 525 | * int: handle |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 526 | * void *: cookie |
| 527 | */ |
| 528 | |
Arve Hjønnevåg | da49889 | 2014-02-21 14:40:26 -0800 | [diff] [blame] | 529 | BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t), |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 530 | /* |
| 531 | * void *: cookie |
| 532 | */ |
Martijn Coenen | 5a6da53 | 2016-09-30 14:10:07 +0200 | [diff] [blame] | 533 | |
| 534 | BC_TRANSACTION_SG = _IOW('c', 17, struct binder_transaction_data_sg), |
| 535 | BC_REPLY_SG = _IOW('c', 18, struct binder_transaction_data_sg), |
| 536 | /* |
| 537 | * binder_transaction_data_sg: the sent command. |
| 538 | */ |
Colin Cross | a3e9ddb | 2014-02-17 13:58:33 -0800 | [diff] [blame] | 539 | }; |
| 540 | |
| 541 | #endif /* _UAPI_LINUX_BINDER_H */ |
| 542 | |