Home | History | Annotate | Download | only in linux
      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  ****************************************************************************
     11  ****************************************************************************/
     12 #ifndef _LINUX_BINDER_H
     13 #define _LINUX_BINDER_H
     14 
     15 #include <linux/ioctl.h>
     16 
     17 #define B_PACK_CHARS(c1, c2, c3, c4)   ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4))
     18 #define B_TYPE_LARGE 0x85
     19 
     20 enum {
     21  BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE),
     22  BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE),
     23  BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE),
     24  BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE),
     25  BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE),
     26 };
     27 
     28 enum {
     29  FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff,
     30  FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100,
     31 };
     32 
     33 struct flat_binder_object {
     34 
     35  unsigned long type;
     36  unsigned long flags;
     37 
     38  union {
     39  void *binder;
     40  signed long handle;
     41  };
     42 
     43  void *cookie;
     44 };
     45 
     46 struct binder_write_read {
     47  signed long write_size;
     48  signed long write_consumed;
     49  unsigned long write_buffer;
     50  signed long read_size;
     51  signed long read_consumed;
     52  unsigned long read_buffer;
     53 };
     54 
     55 struct binder_version {
     56 
     57  signed long protocol_version;
     58 };
     59 
     60 #define BINDER_CURRENT_PROTOCOL_VERSION 7
     61 
     62 #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
     63 #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, int64_t)
     64 #define BINDER_SET_MAX_THREADS _IOW('b', 5, size_t)
     65 #define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, int)
     66 #define BINDER_SET_CONTEXT_MGR _IOW('b', 7, int)
     67 #define BINDER_THREAD_EXIT _IOW('b', 8, int)
     68 #define BINDER_VERSION _IOWR('b', 9, struct binder_version)
     69 
     70 enum transaction_flags {
     71  TF_ONE_WAY = 0x01,
     72  TF_ROOT_OBJECT = 0x04,
     73  TF_STATUS_CODE = 0x08,
     74  TF_ACCEPT_FDS = 0x10,
     75 };
     76 
     77 struct binder_transaction_data {
     78 
     79  union {
     80  size_t handle;
     81  void *ptr;
     82  } target;
     83  void *cookie;
     84  unsigned int code;
     85 
     86  unsigned int flags;
     87  pid_t sender_pid;
     88  uid_t sender_euid;
     89  size_t data_size;
     90  size_t offsets_size;
     91 
     92  union {
     93  struct {
     94 
     95  const void *buffer;
     96 
     97  const void *offsets;
     98  } ptr;
     99  uint8_t buf[8];
    100  } data;
    101 };
    102 
    103 struct binder_ptr_cookie {
    104  void *ptr;
    105  void *cookie;
    106 };
    107 
    108 struct binder_pri_desc {
    109  int priority;
    110  int desc;
    111 };
    112 
    113 struct binder_pri_ptr_cookie {
    114  int priority;
    115  void *ptr;
    116  void *cookie;
    117 };
    118 
    119 enum BinderDriverReturnProtocol {
    120  BR_ERROR = _IOR_BAD('r', 0, int),
    121 
    122  BR_OK = _IO('r', 1),
    123 
    124  BR_TRANSACTION = _IOR_BAD('r', 2, struct binder_transaction_data),
    125  BR_REPLY = _IOR_BAD('r', 3, struct binder_transaction_data),
    126 
    127  BR_ACQUIRE_RESULT = _IOR_BAD('r', 4, int),
    128 
    129  BR_DEAD_REPLY = _IO('r', 5),
    130 
    131  BR_TRANSACTION_COMPLETE = _IO('r', 6),
    132 
    133  BR_INCREFS = _IOR_BAD('r', 7, struct binder_ptr_cookie),
    134  BR_ACQUIRE = _IOR_BAD('r', 8, struct binder_ptr_cookie),
    135  BR_RELEASE = _IOR_BAD('r', 9, struct binder_ptr_cookie),
    136  BR_DECREFS = _IOR_BAD('r', 10, struct binder_ptr_cookie),
    137 
    138  BR_ATTEMPT_ACQUIRE = _IOR_BAD('r', 11, struct binder_pri_ptr_cookie),
    139 
    140  BR_NOOP = _IO('r', 12),
    141 
    142  BR_SPAWN_LOOPER = _IO('r', 13),
    143 
    144  BR_FINISHED = _IO('r', 14),
    145 
    146  BR_DEAD_BINDER = _IOR_BAD('r', 15, void *),
    147 
    148  BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR_BAD('r', 16, void *),
    149 
    150  BR_FAILED_REPLY = _IO('r', 17),
    151 
    152 };
    153 
    154 enum BinderDriverCommandProtocol {
    155  BC_TRANSACTION = _IOW_BAD('c', 0, struct binder_transaction_data),
    156  BC_REPLY = _IOW_BAD('c', 1, struct binder_transaction_data),
    157 
    158  BC_ACQUIRE_RESULT = _IOW_BAD('c', 2, int),
    159 
    160  BC_FREE_BUFFER = _IOW_BAD('c', 3, int),
    161 
    162  BC_INCREFS = _IOW_BAD('c', 4, int),
    163  BC_ACQUIRE = _IOW_BAD('c', 5, int),
    164  BC_RELEASE = _IOW_BAD('c', 6, int),
    165  BC_DECREFS = _IOW_BAD('c', 7, int),
    166 
    167  BC_INCREFS_DONE = _IOW_BAD('c', 8, struct binder_ptr_cookie),
    168  BC_ACQUIRE_DONE = _IOW_BAD('c', 9, struct binder_ptr_cookie),
    169 
    170  BC_ATTEMPT_ACQUIRE = _IOW_BAD('c', 10, struct binder_pri_desc),
    171 
    172  BC_REGISTER_LOOPER = _IO('c', 11),
    173 
    174  BC_ENTER_LOOPER = _IO('c', 12),
    175  BC_EXIT_LOOPER = _IO('c', 13),
    176 
    177  BC_REQUEST_DEATH_NOTIFICATION = _IOW_BAD('c', 14, struct binder_ptr_cookie),
    178 
    179  BC_CLEAR_DEATH_NOTIFICATION = _IOW_BAD('c', 15, struct binder_ptr_cookie),
    180 
    181  BC_DEAD_BINDER_DONE = _IOW_BAD('c', 16, void *),
    182 
    183 };
    184 
    185 #endif
    186 
    187