Home | History | Annotate | Download | only in android
      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 };
     32 enum {
     33   FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff,
     34   FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100,
     35 };
     36 #ifdef BINDER_IPC_32BIT
     37 typedef __u32 binder_size_t;
     38 typedef __u32 binder_uintptr_t;
     39 #else
     40 typedef __u64 binder_size_t;
     41 typedef __u64 binder_uintptr_t;
     42 #endif
     43 struct flat_binder_object {
     44   __u32 type;
     45   __u32 flags;
     46   union {
     47     binder_uintptr_t binder;
     48     __u32 handle;
     49   };
     50   binder_uintptr_t cookie;
     51 };
     52 struct binder_write_read {
     53   binder_size_t write_size;
     54   binder_size_t write_consumed;
     55   binder_uintptr_t write_buffer;
     56   binder_size_t read_size;
     57   binder_size_t read_consumed;
     58   binder_uintptr_t read_buffer;
     59 };
     60 struct binder_version {
     61   __s32 protocol_version;
     62 };
     63 #ifdef BINDER_IPC_32BIT
     64 #define BINDER_CURRENT_PROTOCOL_VERSION 7
     65 #else
     66 #define BINDER_CURRENT_PROTOCOL_VERSION 8
     67 #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)
     71 #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)
     75 enum transaction_flags {
     76   TF_ONE_WAY = 0x01,
     77   TF_ROOT_OBJECT = 0x04,
     78   TF_STATUS_CODE = 0x08,
     79   TF_ACCEPT_FDS = 0x10,
     80 };
     81 struct binder_transaction_data {
     82   union {
     83     __u32 handle;
     84     binder_uintptr_t ptr;
     85   } target;
     86   binder_uintptr_t cookie;
     87   __u32 code;
     88   __u32 flags;
     89   pid_t sender_pid;
     90   uid_t sender_euid;
     91   binder_size_t data_size;
     92   binder_size_t offsets_size;
     93   union {
     94     struct {
     95       binder_uintptr_t buffer;
     96       binder_uintptr_t offsets;
     97     } ptr;
     98     __u8 buf[8];
     99   } data;
    100 };
    101 struct binder_ptr_cookie {
    102   binder_uintptr_t ptr;
    103   binder_uintptr_t cookie;
    104 };
    105 struct binder_handle_cookie {
    106   __u32 handle;
    107   binder_uintptr_t cookie;
    108 } __packed;
    109 struct binder_pri_desc {
    110   __s32 priority;
    111   __u32 desc;
    112 };
    113 struct binder_pri_ptr_cookie {
    114   __s32 priority;
    115   binder_uintptr_t ptr;
    116   binder_uintptr_t cookie;
    117 };
    118 enum binder_driver_return_protocol {
    119   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),
    123   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),
    127   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),
    131   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),
    135   BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t),
    136   BR_FAILED_REPLY = _IO('r', 17),
    137 };
    138 enum binder_driver_command_protocol {
    139   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),
    143   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),
    147   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),
    151   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),
    155   BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t),
    156 };
    157 #endif
    158