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