Colin Cross | 07a5832 | 2022-02-08 19:45:27 -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> |
| 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), |
| 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), |
| 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), |
| 33 | }; |
| 34 | enum flat_binder_object_shifts { |
| 35 | FLAT_BINDER_FLAG_SCHED_POLICY_SHIFT = 9, |
| 36 | }; |
| 37 | enum flat_binder_object_flags { |
| 38 | FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, |
| 39 | FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, |
| 40 | FLAT_BINDER_FLAG_SCHED_POLICY_MASK = 3U << FLAT_BINDER_FLAG_SCHED_POLICY_SHIFT, |
| 41 | FLAT_BINDER_FLAG_INHERIT_RT = 0x800, |
| 42 | FLAT_BINDER_FLAG_TXN_SECURITY_CTX = 0x1000, |
| 43 | }; |
| 44 | #ifdef BINDER_IPC_32BIT |
| 45 | typedef __u32 binder_size_t; |
| 46 | typedef __u32 binder_uintptr_t; |
| 47 | #else |
| 48 | typedef __u64 binder_size_t; |
| 49 | typedef __u64 binder_uintptr_t; |
| 50 | #endif |
| 51 | struct binder_object_header { |
| 52 | __u32 type; |
| 53 | }; |
| 54 | struct flat_binder_object { |
| 55 | struct binder_object_header hdr; |
| 56 | __u32 flags; |
| 57 | union { |
| 58 | binder_uintptr_t binder; |
| 59 | __u32 handle; |
| 60 | }; |
| 61 | binder_uintptr_t cookie; |
| 62 | }; |
| 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 | }; |
| 83 | struct binder_fd_array_object { |
| 84 | struct binder_object_header hdr; |
| 85 | __u32 pad; |
| 86 | binder_size_t num_fds; |
| 87 | binder_size_t parent; |
| 88 | binder_size_t parent_offset; |
| 89 | }; |
| 90 | struct binder_write_read { |
| 91 | binder_size_t write_size; |
| 92 | binder_size_t write_consumed; |
| 93 | binder_uintptr_t write_buffer; |
| 94 | binder_size_t read_size; |
| 95 | binder_size_t read_consumed; |
| 96 | binder_uintptr_t read_buffer; |
| 97 | }; |
| 98 | struct binder_version { |
| 99 | __s32 protocol_version; |
| 100 | }; |
| 101 | #ifdef BINDER_IPC_32BIT |
| 102 | #define BINDER_CURRENT_PROTOCOL_VERSION 7 |
| 103 | #else |
| 104 | #define BINDER_CURRENT_PROTOCOL_VERSION 8 |
| 105 | #endif |
| 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 | }; |
| 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 | }; |
| 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 | }; |
| 130 | #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) |
| 131 | #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) |
| 132 | #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) |
| 133 | #define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32) |
| 134 | #define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32) |
| 135 | #define BINDER_THREAD_EXIT _IOW('b', 8, __s32) |
| 136 | #define BINDER_VERSION _IOWR('b', 9, struct binder_version) |
| 137 | #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) |
| 138 | #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) |
| 139 | #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) |
| 140 | #define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) |
| 141 | #define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info) |
| 142 | #define BINDER_ENABLE_ONEWAY_SPAM_DETECTION _IOW('b', 16, __u32) |
| 143 | enum transaction_flags { |
| 144 | TF_ONE_WAY = 0x01, |
| 145 | TF_ROOT_OBJECT = 0x04, |
| 146 | TF_STATUS_CODE = 0x08, |
| 147 | TF_ACCEPT_FDS = 0x10, |
| 148 | TF_CLEAR_BUF = 0x20, |
| 149 | }; |
| 150 | struct binder_transaction_data { |
| 151 | union { |
| 152 | __u32 handle; |
| 153 | binder_uintptr_t ptr; |
| 154 | } target; |
| 155 | binder_uintptr_t cookie; |
| 156 | __u32 code; |
| 157 | __u32 flags; |
| 158 | pid_t sender_pid; |
| 159 | uid_t sender_euid; |
| 160 | binder_size_t data_size; |
| 161 | binder_size_t offsets_size; |
| 162 | union { |
| 163 | struct { |
| 164 | binder_uintptr_t buffer; |
| 165 | binder_uintptr_t offsets; |
| 166 | } ptr; |
| 167 | __u8 buf[8]; |
| 168 | } data; |
| 169 | }; |
| 170 | struct binder_transaction_data_secctx { |
| 171 | struct binder_transaction_data transaction_data; |
| 172 | binder_uintptr_t secctx; |
| 173 | }; |
| 174 | struct binder_transaction_data_sg { |
| 175 | struct binder_transaction_data transaction_data; |
| 176 | binder_size_t buffers_size; |
| 177 | }; |
| 178 | struct binder_ptr_cookie { |
| 179 | binder_uintptr_t ptr; |
| 180 | binder_uintptr_t cookie; |
| 181 | }; |
| 182 | struct binder_handle_cookie { |
| 183 | __u32 handle; |
| 184 | binder_uintptr_t cookie; |
| 185 | } __packed; |
| 186 | struct binder_pri_desc { |
| 187 | __s32 priority; |
| 188 | __u32 desc; |
| 189 | }; |
| 190 | struct binder_pri_ptr_cookie { |
| 191 | __s32 priority; |
| 192 | binder_uintptr_t ptr; |
| 193 | binder_uintptr_t cookie; |
| 194 | }; |
| 195 | enum binder_driver_return_protocol { |
| 196 | BR_ERROR = _IOR('r', 0, __s32), |
| 197 | BR_OK = _IO('r', 1), |
| 198 | BR_TRANSACTION_SEC_CTX = _IOR('r', 2, struct binder_transaction_data_secctx), |
| 199 | BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data), |
| 200 | BR_REPLY = _IOR('r', 3, struct binder_transaction_data), |
| 201 | BR_ACQUIRE_RESULT = _IOR('r', 4, __s32), |
| 202 | BR_DEAD_REPLY = _IO('r', 5), |
| 203 | BR_TRANSACTION_COMPLETE = _IO('r', 6), |
| 204 | BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie), |
| 205 | BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie), |
| 206 | BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie), |
| 207 | BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie), |
| 208 | BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie), |
| 209 | BR_NOOP = _IO('r', 12), |
| 210 | BR_SPAWN_LOOPER = _IO('r', 13), |
| 211 | BR_FINISHED = _IO('r', 14), |
| 212 | BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t), |
| 213 | BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t), |
| 214 | BR_FAILED_REPLY = _IO('r', 17), |
| 215 | BR_FROZEN_REPLY = _IO('r', 18), |
| 216 | BR_ONEWAY_SPAM_SUSPECT = _IO('r', 19), |
| 217 | }; |
| 218 | enum binder_driver_command_protocol { |
| 219 | BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data), |
| 220 | BC_REPLY = _IOW('c', 1, struct binder_transaction_data), |
| 221 | BC_ACQUIRE_RESULT = _IOW('c', 2, __s32), |
| 222 | BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t), |
| 223 | BC_INCREFS = _IOW('c', 4, __u32), |
| 224 | BC_ACQUIRE = _IOW('c', 5, __u32), |
| 225 | BC_RELEASE = _IOW('c', 6, __u32), |
| 226 | BC_DECREFS = _IOW('c', 7, __u32), |
| 227 | BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie), |
| 228 | BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie), |
| 229 | BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc), |
| 230 | BC_REGISTER_LOOPER = _IO('c', 11), |
| 231 | BC_ENTER_LOOPER = _IO('c', 12), |
| 232 | BC_EXIT_LOOPER = _IO('c', 13), |
| 233 | BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_handle_cookie), |
| 234 | BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_handle_cookie), |
| 235 | BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t), |
| 236 | BC_TRANSACTION_SG = _IOW('c', 17, struct binder_transaction_data_sg), |
| 237 | BC_REPLY_SG = _IOW('c', 18, struct binder_transaction_data_sg), |
| 238 | }; |
| 239 | #endif |