• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _BINDER_MODULE_H_
18 #define _BINDER_MODULE_H_
19 
20 /* obtain structures and constants from the kernel header */
21 
22 // TODO(b/31559095): bionic on host
23 #ifndef __ANDROID__
24 #define __packed __attribute__((__packed__))
25 #endif
26 
27 // TODO(b/31559095): bionic on host
28 #if defined(B_PACK_CHARS) && !defined(_UAPI_LINUX_BINDER_H)
29 #undef B_PACK_CHARS
30 #endif
31 
32 #include <linux/android/binder.h>
33 #include <sys/ioctl.h>
34 
35 #ifndef BR_FROZEN_REPLY
36 // Temporary definition of BR_FROZEN_REPLY. For production
37 // this will come from UAPI binder.h
38 #define BR_FROZEN_REPLY _IO('r', 18)
39 #endif // BR_FROZEN_REPLY
40 
41 #ifndef BINDER_FREEZE
42 /*
43  * Temporary definitions for freeze support. For the final version
44  * these will be defined in the UAPI binder.h file from upstream kernel.
45  */
46 #define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info)
47 
48 struct binder_freeze_info {
49     //
50     // Group-leader PID of process to be frozen
51     //
52     uint32_t pid;
53     //
54     // Enable(1) / Disable(0) freeze for given PID
55     //
56     uint32_t enable;
57     //
58     // Timeout to wait for transactions to drain.
59     // 0: don't wait (ioctl will return EAGAIN if not drained)
60     // N: number of ms to wait
61     uint32_t timeout_ms;
62 };
63 #endif // BINDER_FREEZE
64 
65 #ifndef BINDER_GET_FROZEN_INFO
66 
67 #define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info)
68 
69 struct binder_frozen_status_info {
70     //
71     // Group-leader PID of process to be queried
72     //
73     __u32 pid;
74     //
75     // Indicates whether the process has received any sync calls since last
76     // freeze (cleared at freeze/unfreeze)
77     // bit 0: received sync transaction after being frozen
78     // bit 1: new pending sync transaction during freezing
79     //
80     __u32 sync_recv;
81     //
82     // Indicates whether the process has received any async calls since last
83     // freeze (cleared at freeze/unfreeze)
84     //
85     __u32 async_recv;
86 };
87 #endif // BINDER_GET_FROZEN_INFO
88 
89 #ifndef BR_ONEWAY_SPAM_SUSPECT
90 // Temporary definition of BR_ONEWAY_SPAM_SUSPECT. For production
91 // this will come from UAPI binder.h
92 #define BR_ONEWAY_SPAM_SUSPECT _IO('r', 19)
93 #endif // BR_ONEWAY_SPAM_SUSPECT
94 
95 #ifndef BINDER_ENABLE_ONEWAY_SPAM_DETECTION
96 /*
97  * Temporary definitions for oneway spam detection support. For the final version
98  * these will be defined in the UAPI binder.h file from upstream kernel.
99  */
100 #define BINDER_ENABLE_ONEWAY_SPAM_DETECTION _IOW('b', 16, __u32)
101 #endif // BINDER_ENABLE_ONEWAY_SPAM_DETECTION
102 
103 #endif // _BINDER_MODULE_H_
104