@@ -7,20 +7,27 @@ import "unsafe"
77// Binder command (BC) codes -- written to the driver.
88// Codes that carry a struct payload encode sizeof(payload) in the ioctl-style
99// number, so they must be computed from the actual Go struct sizes.
10- //
11- // Only currently-used codes are defined here. The full protocol is documented
12- // in the design doc and additional codes can be added as features are implemented.
1310var (
1411 bcTransaction = uint32 (iow ('c' , 0 , unsafe .Sizeof (binderTransactionData {})))
12+ bcReply = uint32 (iow ('c' , 1 , unsafe .Sizeof (binderTransactionData {})))
1513 bcFreeBuffer = uint32 (iow ('c' , 3 , unsafe .Sizeof (uintptr (0 )))) // binder_uintptr_t
1614 bcIncRefs = uint32 (iow ('c' , 4 , unsafe .Sizeof (uint32 (0 ))))
1715 bcAcquire = uint32 (iow ('c' , 5 , unsafe .Sizeof (uint32 (0 ))))
1816 bcRelease = uint32 (iow ('c' , 6 , unsafe .Sizeof (uint32 (0 ))))
1917 bcDecRefs = uint32 (iow ('c' , 7 , unsafe .Sizeof (uint32 (0 ))))
18+ bcIncRefsDone = uint32 (iow ('c' , 8 , binderPtrCookieSize ))
19+ bcAcquireDone = uint32 (iow ('c' , 9 , binderPtrCookieSize ))
20+ bcRegisterLooper = uint32 (ioc (0 , 'c' , 11 , 0 ))
21+ bcEnterLooper = uint32 (ioc (0 , 'c' , 12 , 0 ))
22+ bcExitLooper = uint32 (ioc (0 , 'c' , 13 , 0 ))
2023 bcRequestDeathNotif = uint32 (iow ('c' , 14 , binderHandleCookieSize ))
2124 bcClearDeathNotif = uint32 (iow ('c' , 15 , binderHandleCookieSize ))
2225)
2326
27+ // binderPtrCookieSize is the size of the kernel's binder_ptr_cookie struct:
28+ // binder_uintptr_t ptr + binder_uintptr_t cookie (2 x pointer-sized).
29+ const binderPtrCookieSize = 2 * unsafe .Sizeof (uintptr (0 )) // = 16 on 64-bit
30+
2431// binderHandleCookieSize is the packed size of the kernel's binder_handle_cookie
2532// struct: __u32 handle + binder_uintptr_t cookie. The kernel struct uses
2633// __attribute__((packed)), so there is NO alignment padding between fields.
@@ -29,9 +36,14 @@ const binderHandleCookieSize = unsafe.Sizeof(uint32(0)) + unsafe.Sizeof(uintptr(
2936// Binder return (BR) codes -- read from the driver.
3037var (
3138 brError = uint32 (ior ('r' , 0 , unsafe .Sizeof (int32 (0 ))))
39+ brTransaction = uint32 (ior ('r' , 2 , unsafe .Sizeof (binderTransactionData {})))
3240 brReply = uint32 (ior ('r' , 3 , unsafe .Sizeof (binderTransactionData {})))
3341 brDeadReply = uint32 (ioc (0 , 'r' , 5 , 0 ))
3442 brTransactionComplete = uint32 (ioc (0 , 'r' , 6 , 0 ))
43+ brIncRefs = uint32 (ior ('r' , 7 , binderPtrCookieSize ))
44+ brAcquire = uint32 (ior ('r' , 8 , binderPtrCookieSize ))
45+ brRelease = uint32 (ior ('r' , 9 , binderPtrCookieSize ))
46+ brDecrefs = uint32 (ior ('r' , 10 , binderPtrCookieSize ))
3547 brNoop = uint32 (ioc (0 , 'r' , 12 , 0 ))
3648 brSpawnLooper = uint32 (ioc (0 , 'r' , 13 , 0 ))
3749 brFailedReply = uint32 (ioc (0 , 'r' , 17 , 0 ))
0 commit comments