• 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     //
78     __u32 sync_recv;
79     //
80     // Indicates whether the process has received any async calls since last
81     // freeze (cleared at freeze/unfreeze)
82     //
83     __u32 async_recv;
84 };
85 #endif // BINDER_GET_FROZEN_INFO
86 
87 #ifndef BR_ONEWAY_SPAM_SUSPECT
88 // Temporary definition of BR_ONEWAY_SPAM_SUSPECT. For production
89 // this will come from UAPI binder.h
90 #define BR_ONEWAY_SPAM_SUSPECT _IO('r', 19)
91 #endif // BR_ONEWAY_SPAM_SUSPECT
92 
93 #ifndef BINDER_ENABLE_ONEWAY_SPAM_DETECTION
94 /*
95  * Temporary definitions for oneway spam detection support. For the final version
96  * these will be defined in the UAPI binder.h file from upstream kernel.
97  */
98 #define BINDER_ENABLE_ONEWAY_SPAM_DETECTION _IOW('b', 16, __u32)
99 #endif // BINDER_ENABLE_ONEWAY_SPAM_DETECTION
100 
101 #endif // _BINDER_MODULE_H_
102