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