16ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris/* 26ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * Copyright (C) 2008 Google, Inc. 36ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * 46ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * Based on, but no longer compatible with, the original 56ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * OpenBinder.org binder driver interface, which is: 66ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * 76ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * Copyright (c) 2005 Palmsource, Inc. 86ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * 96ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * This software is licensed under the terms of the GNU General Public 106ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * License version 2, as published by the Free Software Foundation, and 116ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * may be copied, distributed, and modified under those terms. 126ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * 136ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * This program is distributed in the hope that it will be useful, 146ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * but WITHOUT ANY WARRANTY; without even the implied warranty of 156ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 166ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * GNU General Public License for more details. 176ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * 186ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 196ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 206ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#ifndef _UAPI_LINUX_BINDER_H 216ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#define _UAPI_LINUX_BINDER_H 226ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 236ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#include <linux/ioctl.h> 246ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 256ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#define B_PACK_CHARS(c1, c2, c3, c4) \ 266ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4)) 276ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#define B_TYPE_LARGE 0x85 286ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 296ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisenum { 306ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE), 316ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE), 326ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE), 336ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE), 346ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE), 356ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 366ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 376ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisenum { 386ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, 396ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, 406ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 416ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 425d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg#ifdef BINDER_IPC_32BIT 435d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevågtypedef __u32 binder_size_t; 445d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevågtypedef __u32 binder_uintptr_t; 455d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg#else 465d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevågtypedef __u64 binder_size_t; 475d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevågtypedef __u64 binder_uintptr_t; 485d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg#endif 495d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg 506ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris/* 516ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * This is the flattened representation of a Binder object for transfer 526ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * between processes. The 'offsets' supplied as part of a binder transaction 536ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * contains offsets into the data where these structures occur. The Binder 546ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * driver takes care of re-writing the structure type and data as it moves 556ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * between processes. 566ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 576ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisstruct flat_binder_object { 586ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 8 bytes for large_flat_header. */ 595d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __u32 type; 605d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __u32 flags; 616ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 626ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 8 bytes of data. */ 636ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris union { 645d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t binder; /* local object */ 655d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __u32 handle; /* remote object */ 666ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris }; 676ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 686ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* extra data associated with local object */ 695d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t cookie; 706ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 716ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 726ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris/* 736ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * On 64-bit platforms where user code may run in 32-bits the driver must 746ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * translate the buffer (and local binder) addresses appropriately. 756ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 766ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 776ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisstruct binder_write_read { 785d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_size_t write_size; /* bytes to write */ 795d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_size_t write_consumed; /* bytes consumed by driver */ 805d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t write_buffer; 815d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_size_t read_size; /* bytes to read */ 825d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_size_t read_consumed; /* bytes consumed by driver */ 835d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t read_buffer; 846ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 856ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 866ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris/* Use with BINDER_VERSION, driver fills in fields. */ 876ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisstruct binder_version { 886ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* driver protocol version -- increment with incompatible change */ 895d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __s32 protocol_version; 906ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 916ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 926ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris/* This is the current protocol version. */ 935d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg#ifdef BINDER_IPC_32BIT 946ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#define BINDER_CURRENT_PROTOCOL_VERSION 7 955d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg#else 965d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg#define BINDER_CURRENT_PROTOCOL_VERSION 8 975d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg#endif 986ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 996ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) 1006ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) 1015d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) 1026ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32) 1036ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32) 1046ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#define BINDER_THREAD_EXIT _IOW('b', 8, __s32) 1056ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#define BINDER_VERSION _IOWR('b', 9, struct binder_version) 1066ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1076ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris/* 1086ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * NOTE: Two special error codes you should check for when calling 1096ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * in to the driver are: 1106ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * 1116ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * EINTR -- The operation has been interupted. This should be 1126ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * handled by retrying the ioctl() until a different error code 1136ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * is returned. 1146ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * 1156ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * ECONNREFUSED -- The driver is no longer accepting operations 1166ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * from your process. That is, the process is being destroyed. 1176ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * You should handle this by exiting from your process. Note 1186ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * that once this error code is returned, all further calls to 1196ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * the driver from any thread will return this same code. 1206ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 1216ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1226ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisenum transaction_flags { 1236ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris TF_ONE_WAY = 0x01, /* this is a one-way call: async, no return */ 1246ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */ 1256ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */ 1266ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */ 1276ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 1286ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1296ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisstruct binder_transaction_data { 1306ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* The first two are only used for bcTRANSACTION and brTRANSACTION, 1316ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * identifying the target and contents of the transaction. 1326ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 1336ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris union { 1345d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __u32 handle; /* target descriptor of command transaction */ 1355d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t ptr; /* target descriptor of return transaction */ 1366ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris } target; 1375d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t cookie; /* target object cookie */ 1385d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __u32 code; /* transaction command */ 1396ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1406ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* General information about the transaction. */ 1415d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __u32 flags; 1426ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris pid_t sender_pid; 1436ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris uid_t sender_euid; 1445d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_size_t data_size; /* number of bytes of data */ 1455d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_size_t offsets_size; /* number of bytes of offsets */ 1466ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1476ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* If this transaction is inline, the data immediately 1486ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * follows here; otherwise, it ends with a pointer to 1496ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * the data buffer. 1506ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 1516ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris union { 1526ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris struct { 1536ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* transaction data */ 1545d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t buffer; 1556ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* offsets from buffer to flat_binder_object structs */ 1565d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t offsets; 1576ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris } ptr; 1585d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __u8 buf[8]; 1596ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris } data; 1606ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 1616ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1626ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisstruct binder_ptr_cookie { 1635d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t ptr; 1645d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t cookie; 1656ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 1666ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1675d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevågstruct binder_handle_cookie { 1685d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __u32 handle; 1695d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t cookie; 1705d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg} __attribute__((packed)); 1715d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg 1726ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisstruct binder_pri_desc { 1735d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __s32 priority; 1745d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __u32 desc; 1756ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 1766ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1776ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisstruct binder_pri_ptr_cookie { 1785d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg __s32 priority; 1795d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t ptr; 1805d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg binder_uintptr_t cookie; 1816ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 1826ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1836ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisenum binder_driver_return_protocol { 1845d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BR_ERROR = _IOR('r', 0, __s32), 1856ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 1866ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * int: error code 1876ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 1886ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1896ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_OK = _IO('r', 1), 1906ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* No parameters! */ 1916ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1926ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data), 1936ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_REPLY = _IOR('r', 3, struct binder_transaction_data), 1946ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 1956ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * binder_transaction_data: the received command. 1966ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 1976ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 1985d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BR_ACQUIRE_RESULT = _IOR('r', 4, __s32), 1996ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2006ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * not currently supported 2016ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * int: 0 if the last bcATTEMPT_ACQUIRE was not successful. 2026ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * Else the remote object has acquired a primary reference. 2036ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2046ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2056ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_DEAD_REPLY = _IO('r', 5), 2066ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2076ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * The target of the last transaction (either a bcTRANSACTION or 2086ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * a bcATTEMPT_ACQUIRE) is no longer with us. No parameters. 2096ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2106ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2116ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_TRANSACTION_COMPLETE = _IO('r', 6), 2126ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2136ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * No parameters... always refers to the last transaction requested 2146ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * (including replies). Note that this will be sent even for 2156ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * asynchronous transactions. 2166ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2176ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2186ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie), 2196ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie), 2206ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie), 2216ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie), 2226ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2236ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: ptr to binder 2246ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: cookie for binder 2256ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2266ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2276ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie), 2286ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2296ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * not currently supported 2306ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * int: priority 2316ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: ptr to binder 2326ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: cookie for binder 2336ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2346ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2356ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_NOOP = _IO('r', 12), 2366ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2376ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * No parameters. Do nothing and examine the next command. It exists 2386ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * primarily so that we can replace it with a BR_SPAWN_LOOPER command. 2396ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2406ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2416ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_SPAWN_LOOPER = _IO('r', 13), 2426ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2436ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * No parameters. The driver has determined that a process has no 2446ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * threads waiting to service incoming transactions. When a process 2456ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * receives this command, it must spawn a new service thread and 2466ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * register it via bcENTER_LOOPER. 2476ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2486ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2496ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_FINISHED = _IO('r', 14), 2506ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2516ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * not currently supported 2526ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * stop threadpool thread 2536ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2546ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2555d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t), 2566ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2576ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: cookie 2586ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2595d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t), 2606ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2616ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: cookie 2626ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2636ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2646ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BR_FAILED_REPLY = _IO('r', 17), 2656ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2666ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * The the last transaction (either a bcTRANSACTION or 2676ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters. 2686ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2696ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 2706ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2716ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferrisenum binder_driver_command_protocol { 2726ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data), 2736ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BC_REPLY = _IOW('c', 1, struct binder_transaction_data), 2746ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2756ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * binder_transaction_data: the sent command. 2766ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2776ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2785d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BC_ACQUIRE_RESULT = _IOW('c', 2, __s32), 2796ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2806ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * not currently supported 2816ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * int: 0 if the last BR_ATTEMPT_ACQUIRE was not successful. 2826ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * Else you have acquired a primary reference on the object. 2836ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2846ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2855d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t), 2866ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2876ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: ptr to transaction data received on a read 2886ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2896ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2905d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BC_INCREFS = _IOW('c', 4, __u32), 2915d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BC_ACQUIRE = _IOW('c', 5, __u32), 2925d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BC_RELEASE = _IOW('c', 6, __u32), 2935d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BC_DECREFS = _IOW('c', 7, __u32), 2946ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 2956ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * int: descriptor 2966ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 2976ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 2986ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie), 2996ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie), 3006ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 3016ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: ptr to binder 3026ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: cookie for binder 3036ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 3046ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 3056ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc), 3066ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 3076ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * not currently supported 3086ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * int: priority 3096ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * int: descriptor 3106ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 3116ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 3126ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BC_REGISTER_LOOPER = _IO('c', 11), 3136ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 3146ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * No parameters. 3156ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * Register a spawned looper thread with the device. 3166ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 3176ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 3186ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BC_ENTER_LOOPER = _IO('c', 12), 3196ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris BC_EXIT_LOOPER = _IO('c', 13), 3206ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 3216ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * No parameters. 3226ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * These two commands are sent as an application-level thread 3236ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * enters and exits the binder loop, respectively. They are 3246ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * used so the binder can have an accurate count of the number 3256ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * of looping threads it has available. 3266ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 3276ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 3285d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14, struct binder_handle_cookie), 3296ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 3305d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg * int: handle 3316ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: cookie 3326ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 3336ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 3345d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15, struct binder_handle_cookie), 3356ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 3365d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg * int: handle 3376ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: cookie 3386ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 3396ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 3405d900907b93fe854b2cb456b935fb81c28bd398bArve Hjønnevåg BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t), 3416ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris /* 3426ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris * void *: cookie 3436ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris */ 3446ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris}; 3456ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 3466ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris#endif /* _UAPI_LINUX_BINDER_H */ 3476ea19f626488db5efcc757f2d8a2fd362d0567ceChristopher Ferris 348