• 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 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 #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
121 #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
122 #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
123 #define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32)
124 #define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)
125 #define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
126 #define BINDER_VERSION _IOWR('b', 9, struct binder_version)
127 #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info)
128 #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref)
129 #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object)
130 enum transaction_flags {
131   TF_ONE_WAY = 0x01,
132   TF_ROOT_OBJECT = 0x04,
133   TF_STATUS_CODE = 0x08,
134   TF_ACCEPT_FDS = 0x10,
135 };
136 struct binder_transaction_data {
137   union {
138     __u32 handle;
139     binder_uintptr_t ptr;
140   } target;
141   binder_uintptr_t cookie;
142   __u32 code;
143   __u32 flags;
144   pid_t sender_pid;
145   uid_t sender_euid;
146   binder_size_t data_size;
147   binder_size_t offsets_size;
148   union {
149     struct {
150       binder_uintptr_t buffer;
151       binder_uintptr_t offsets;
152     } ptr;
153     __u8 buf[8];
154   } data;
155 };
156 struct binder_transaction_data_secctx {
157   struct binder_transaction_data transaction_data;
158   binder_uintptr_t secctx;
159 };
160 struct binder_transaction_data_sg {
161   struct binder_transaction_data transaction_data;
162   binder_size_t buffers_size;
163 };
164 struct binder_ptr_cookie {
165   binder_uintptr_t ptr;
166   binder_uintptr_t cookie;
167 };
168 struct binder_handle_cookie {
169   __u32 handle;
170   binder_uintptr_t cookie;
171 } __packed;
172 struct binder_pri_desc {
173   __s32 priority;
174   __u32 desc;
175 };
176 struct binder_pri_ptr_cookie {
177   __s32 priority;
178   binder_uintptr_t ptr;
179   binder_uintptr_t cookie;
180 };
181 enum binder_driver_return_protocol {
182   BR_ERROR = _IOR('r', 0, __s32),
183   BR_OK = _IO('r', 1),
184   BR_TRANSACTION_SEC_CTX = _IOR('r', 2, struct binder_transaction_data_secctx),
185   BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data),
186   BR_REPLY = _IOR('r', 3, struct binder_transaction_data),
187   BR_ACQUIRE_RESULT = _IOR('r', 4, __s32),
188   BR_DEAD_REPLY = _IO('r', 5),
189   BR_TRANSACTION_COMPLETE = _IO('r', 6),
190   BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie),
191   BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie),
192   BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie),
193   BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie),
194   BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie),
195   BR_NOOP = _IO('r', 12),
196   BR_SPAWN_LOOPER = _IO('r', 13),
197   BR_FINISHED = _IO('r', 14),
198   BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t),
199   BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t),
200   BR_FAILED_REPLY = _IO('r', 17),
201 };
202 enum binder_driver_command_protocol {
203   BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data),
204   BC_REPLY = _IOW('c', 1, struct binder_transaction_data),
205   BC_ACQUIRE_RESULT = _IOW('c', 2, __s32),
206   BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t),
207   BC_INCREFS = _IOW('c', 4, __u32),
208   BC_ACQUIRE = _IOW('c', 5, __u32),
209   BC_RELEASE = _IOW('c', 6, __u32),
210   BC_DECREFS = _IOW('c', 7, __u32),
211   BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie),
212   BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie),
213   BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc),
214   BC_REGISTER_LOOPER = _IO('c', 11),
215   BC_ENTER_LOOPER = _IO('c', 12),
216   BC_EXIT_LOOPER = _IO('c', 13),
217   BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_handle_cookie),
218   BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_handle_cookie),
219   BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t),
220   BC_TRANSACTION_SG = _IOW('c', 17, struct binder_transaction_data_sg),
221   BC_REPLY_SG = _IOW('c', 18, struct binder_transaction_data_sg),
222 };
223 #endif
224