blob: 5a7929fa4f9308b9590ec268617e11138f053528 [file] [log] [blame]
Christopher Ferris05d08e92016-02-04 13:16:38 -08001/****************************************************************************
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 Ferris05d08e92016-02-04 13:16:38 -080023#define B_PACK_CHARS(c1,c2,c3,c4) ((((c1) << 24)) | (((c2) << 16)) | (((c3) << 8)) | (c4))
24#define B_TYPE_LARGE 0x85
25enum {
26 BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE),
Christopher Ferris05d08e92016-02-04 13:16:38 -080027 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 Ferris05d08e92016-02-04 13:16:38 -080031};
32enum {
33 FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff,
34 FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100,
Christopher Ferris05d08e92016-02-04 13:16:38 -080035};
36#ifdef BINDER_IPC_32BIT
37typedef __u32 binder_size_t;
38typedef __u32 binder_uintptr_t;
Christopher Ferris05d08e92016-02-04 13:16:38 -080039#else
40typedef __u64 binder_size_t;
41typedef __u64 binder_uintptr_t;
42#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -080043struct flat_binder_object {
44 __u32 type;
45 __u32 flags;
46 union {
Christopher Ferris05d08e92016-02-04 13:16:38 -080047 binder_uintptr_t binder;
48 __u32 handle;
49 };
50 binder_uintptr_t cookie;
Christopher Ferris05d08e92016-02-04 13:16:38 -080051};
52struct binder_write_read {
53 binder_size_t write_size;
54 binder_size_t write_consumed;
Christopher Ferris05d08e92016-02-04 13:16:38 -080055 binder_uintptr_t write_buffer;
56 binder_size_t read_size;
57 binder_size_t read_consumed;
58 binder_uintptr_t read_buffer;
Christopher Ferris05d08e92016-02-04 13:16:38 -080059};
60struct binder_version {
61 __s32 protocol_version;
62};
Christopher Ferris05d08e92016-02-04 13:16:38 -080063#ifdef BINDER_IPC_32BIT
64#define BINDER_CURRENT_PROTOCOL_VERSION 7
65#else
66#define BINDER_CURRENT_PROTOCOL_VERSION 8
Christopher Ferris05d08e92016-02-04 13:16:38 -080067#endif
68#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
69#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
70#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
Christopher Ferris05d08e92016-02-04 13:16:38 -080071#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32)
72#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)
73#define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
74#define BINDER_VERSION _IOWR('b', 9, struct binder_version)
Christopher Ferris05d08e92016-02-04 13:16:38 -080075enum transaction_flags {
76 TF_ONE_WAY = 0x01,
77 TF_ROOT_OBJECT = 0x04,
78 TF_STATUS_CODE = 0x08,
Christopher Ferris05d08e92016-02-04 13:16:38 -080079 TF_ACCEPT_FDS = 0x10,
80};
81struct binder_transaction_data {
82 union {
Christopher Ferris05d08e92016-02-04 13:16:38 -080083 __u32 handle;
84 binder_uintptr_t ptr;
85 } target;
86 binder_uintptr_t cookie;
Christopher Ferris05d08e92016-02-04 13:16:38 -080087 __u32 code;
88 __u32 flags;
89 pid_t sender_pid;
90 uid_t sender_euid;
Christopher Ferris05d08e92016-02-04 13:16:38 -080091 binder_size_t data_size;
92 binder_size_t offsets_size;
93 union {
94 struct {
Christopher Ferris05d08e92016-02-04 13:16:38 -080095 binder_uintptr_t buffer;
96 binder_uintptr_t offsets;
97 } ptr;
98 __u8 buf[8];
Christopher Ferris05d08e92016-02-04 13:16:38 -080099 } data;
100};
101struct binder_ptr_cookie {
102 binder_uintptr_t ptr;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800103 binder_uintptr_t cookie;
104};
105struct binder_handle_cookie {
106 __u32 handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800107 binder_uintptr_t cookie;
108} __packed;
109struct binder_pri_desc {
110 __s32 priority;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800111 __u32 desc;
112};
113struct binder_pri_ptr_cookie {
114 __s32 priority;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800115 binder_uintptr_t ptr;
116 binder_uintptr_t cookie;
117};
118enum binder_driver_return_protocol {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800119 BR_ERROR = _IOR('r', 0, __s32),
120 BR_OK = _IO('r', 1),
121 BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data),
122 BR_REPLY = _IOR('r', 3, struct binder_transaction_data),
Christopher Ferris05d08e92016-02-04 13:16:38 -0800123 BR_ACQUIRE_RESULT = _IOR('r', 4, __s32),
124 BR_DEAD_REPLY = _IO('r', 5),
125 BR_TRANSACTION_COMPLETE = _IO('r', 6),
126 BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie),
Christopher Ferris05d08e92016-02-04 13:16:38 -0800127 BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie),
128 BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie),
129 BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie),
130 BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie),
Christopher Ferris05d08e92016-02-04 13:16:38 -0800131 BR_NOOP = _IO('r', 12),
132 BR_SPAWN_LOOPER = _IO('r', 13),
133 BR_FINISHED = _IO('r', 14),
134 BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t),
Christopher Ferris05d08e92016-02-04 13:16:38 -0800135 BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t),
136 BR_FAILED_REPLY = _IO('r', 17),
137};
138enum binder_driver_command_protocol {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800139 BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data),
140 BC_REPLY = _IOW('c', 1, struct binder_transaction_data),
141 BC_ACQUIRE_RESULT = _IOW('c', 2, __s32),
142 BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t),
Christopher Ferris05d08e92016-02-04 13:16:38 -0800143 BC_INCREFS = _IOW('c', 4, __u32),
144 BC_ACQUIRE = _IOW('c', 5, __u32),
145 BC_RELEASE = _IOW('c', 6, __u32),
146 BC_DECREFS = _IOW('c', 7, __u32),
Christopher Ferris05d08e92016-02-04 13:16:38 -0800147 BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie),
148 BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie),
149 BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc),
150 BC_REGISTER_LOOPER = _IO('c', 11),
Christopher Ferris05d08e92016-02-04 13:16:38 -0800151 BC_ENTER_LOOPER = _IO('c', 12),
152 BC_EXIT_LOOPER = _IO('c', 13),
153 BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_handle_cookie),
154 BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_handle_cookie),
Christopher Ferris05d08e92016-02-04 13:16:38 -0800155 BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t),
156};
157#endif