| 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 | }; | 
|  | 34 | enum { | 
|  | 35 | FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, | 
|  | 36 | FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 37 | }; | 
|  | 38 | #ifdef BINDER_IPC_32BIT | 
|  | 39 | typedef __u32 binder_size_t; | 
|  | 40 | typedef __u32 binder_uintptr_t; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 41 | #else | 
|  | 42 | typedef __u64 binder_size_t; | 
|  | 43 | typedef __u64 binder_uintptr_t; | 
|  | 44 | #endif | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 45 | struct binder_object_header { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 46 | __u32 type; | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 47 | }; | 
|  | 48 | struct flat_binder_object { | 
|  | 49 | struct binder_object_header hdr; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 50 | __u32 flags; | 
|  | 51 | union { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 52 | binder_uintptr_t binder; | 
|  | 53 | __u32 handle; | 
|  | 54 | }; | 
|  | 55 | binder_uintptr_t cookie; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 56 | }; | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 57 | struct binder_fd_object { | 
|  | 58 | struct binder_object_header hdr; | 
|  | 59 | __u32 pad_flags; | 
|  | 60 | union { | 
|  | 61 | binder_uintptr_t pad_binder; | 
|  | 62 | __u32 fd; | 
|  | 63 | }; | 
|  | 64 | binder_uintptr_t cookie; | 
|  | 65 | }; | 
|  | 66 | struct binder_buffer_object { | 
|  | 67 | struct binder_object_header hdr; | 
|  | 68 | __u32 flags; | 
|  | 69 | binder_uintptr_t buffer; | 
|  | 70 | binder_size_t length; | 
|  | 71 | binder_size_t parent; | 
|  | 72 | binder_size_t parent_offset; | 
|  | 73 | }; | 
|  | 74 | enum { | 
|  | 75 | BINDER_BUFFER_FLAG_HAS_PARENT = 0x01, | 
|  | 76 | }; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 77 | struct binder_fd_array_object { | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 78 | struct binder_object_header hdr; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 79 | __u32 pad; | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 80 | binder_size_t num_fds; | 
|  | 81 | binder_size_t parent; | 
|  | 82 | binder_size_t parent_offset; | 
|  | 83 | }; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 84 | struct binder_write_read { | 
|  | 85 | binder_size_t write_size; | 
|  | 86 | binder_size_t write_consumed; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 87 | binder_uintptr_t write_buffer; | 
|  | 88 | binder_size_t read_size; | 
|  | 89 | binder_size_t read_consumed; | 
|  | 90 | binder_uintptr_t read_buffer; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 91 | }; | 
|  | 92 | struct binder_version { | 
|  | 93 | __s32 protocol_version; | 
|  | 94 | }; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 95 | #ifdef BINDER_IPC_32BIT | 
|  | 96 | #define BINDER_CURRENT_PROTOCOL_VERSION 7 | 
|  | 97 | #else | 
|  | 98 | #define BINDER_CURRENT_PROTOCOL_VERSION 8 | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 99 | #endif | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 100 | struct binder_node_debug_info { | 
|  | 101 | binder_uintptr_t ptr; | 
|  | 102 | binder_uintptr_t cookie; | 
|  | 103 | __u32 has_strong_ref; | 
|  | 104 | __u32 has_weak_ref; | 
|  | 105 | }; | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 106 | struct binder_node_info_for_ref { | 
|  | 107 | __u32 handle; | 
|  | 108 | __u32 strong_count; | 
|  | 109 | __u32 weak_count; | 
|  | 110 | __u32 reserved1; | 
|  | 111 | __u32 reserved2; | 
|  | 112 | __u32 reserved3; | 
|  | 113 | }; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 114 | #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) | 
|  | 115 | #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) | 
|  | 116 | #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 117 | #define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32) | 
|  | 118 | #define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32) | 
|  | 119 | #define BINDER_THREAD_EXIT _IOW('b', 8, __s32) | 
|  | 120 | #define BINDER_VERSION _IOWR('b', 9, struct binder_version) | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 121 | #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] | 122 | #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 123 | enum transaction_flags { | 
|  | 124 | TF_ONE_WAY = 0x01, | 
|  | 125 | TF_ROOT_OBJECT = 0x04, | 
|  | 126 | TF_STATUS_CODE = 0x08, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 127 | TF_ACCEPT_FDS = 0x10, | 
|  | 128 | }; | 
|  | 129 | struct binder_transaction_data { | 
|  | 130 | union { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 131 | __u32 handle; | 
|  | 132 | binder_uintptr_t ptr; | 
|  | 133 | } target; | 
|  | 134 | binder_uintptr_t cookie; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 135 | __u32 code; | 
|  | 136 | __u32 flags; | 
|  | 137 | pid_t sender_pid; | 
|  | 138 | uid_t sender_euid; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 139 | binder_size_t data_size; | 
|  | 140 | binder_size_t offsets_size; | 
|  | 141 | union { | 
|  | 142 | struct { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 143 | binder_uintptr_t buffer; | 
|  | 144 | binder_uintptr_t offsets; | 
|  | 145 | } ptr; | 
|  | 146 | __u8 buf[8]; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 147 | } data; | 
|  | 148 | }; | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 149 | struct binder_transaction_data_sg { | 
|  | 150 | struct binder_transaction_data transaction_data; | 
|  | 151 | binder_size_t buffers_size; | 
|  | 152 | }; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 153 | struct binder_ptr_cookie { | 
|  | 154 | binder_uintptr_t ptr; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 155 | binder_uintptr_t cookie; | 
|  | 156 | }; | 
|  | 157 | struct binder_handle_cookie { | 
|  | 158 | __u32 handle; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 159 | binder_uintptr_t cookie; | 
|  | 160 | } __packed; | 
|  | 161 | struct binder_pri_desc { | 
|  | 162 | __s32 priority; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 163 | __u32 desc; | 
|  | 164 | }; | 
|  | 165 | struct binder_pri_ptr_cookie { | 
|  | 166 | __s32 priority; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 167 | binder_uintptr_t ptr; | 
|  | 168 | binder_uintptr_t cookie; | 
|  | 169 | }; | 
|  | 170 | enum binder_driver_return_protocol { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 171 | BR_ERROR = _IOR('r', 0, __s32), | 
|  | 172 | BR_OK = _IO('r', 1), | 
|  | 173 | BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data), | 
|  | 174 | BR_REPLY = _IOR('r', 3, struct binder_transaction_data), | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 175 | BR_ACQUIRE_RESULT = _IOR('r', 4, __s32), | 
|  | 176 | BR_DEAD_REPLY = _IO('r', 5), | 
|  | 177 | BR_TRANSACTION_COMPLETE = _IO('r', 6), | 
|  | 178 | BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie), | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 179 | BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie), | 
|  | 180 | BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie), | 
|  | 181 | BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie), | 
|  | 182 | BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie), | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 183 | BR_NOOP = _IO('r', 12), | 
|  | 184 | BR_SPAWN_LOOPER = _IO('r', 13), | 
|  | 185 | BR_FINISHED = _IO('r', 14), | 
|  | 186 | BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t), | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 187 | BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t), | 
|  | 188 | BR_FAILED_REPLY = _IO('r', 17), | 
|  | 189 | }; | 
|  | 190 | enum binder_driver_command_protocol { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 191 | BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data), | 
|  | 192 | BC_REPLY = _IOW('c', 1, struct binder_transaction_data), | 
|  | 193 | BC_ACQUIRE_RESULT = _IOW('c', 2, __s32), | 
|  | 194 | BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t), | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 195 | BC_INCREFS = _IOW('c', 4, __u32), | 
|  | 196 | BC_ACQUIRE = _IOW('c', 5, __u32), | 
|  | 197 | BC_RELEASE = _IOW('c', 6, __u32), | 
|  | 198 | BC_DECREFS = _IOW('c', 7, __u32), | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 199 | BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie), | 
|  | 200 | BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie), | 
|  | 201 | BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc), | 
|  | 202 | BC_REGISTER_LOOPER = _IO('c', 11), | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 203 | BC_ENTER_LOOPER = _IO('c', 12), | 
|  | 204 | BC_EXIT_LOOPER = _IO('c', 13), | 
|  | 205 | BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_handle_cookie), | 
|  | 206 | BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_handle_cookie), | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 207 | BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t), | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 208 | BC_TRANSACTION_SG = _IOW('c', 17, struct binder_transaction_data_sg), | 
|  | 209 | BC_REPLY_SG = _IOW('c', 18, struct binder_transaction_data_sg), | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 210 | }; | 
|  | 211 | #endif |