blob: 793795e1d4af8b02bee0023e368d1dc2c29023c6 [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
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
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080020/* obtain structures and constants from the kernel header */
21
Steven Moreland28723ae2019-04-01 18:52:30 -070022// TODO(b/31559095): bionic on host
Steven Morelanded3b5632019-09-20 11:24:28 -070023#ifndef __ANDROID__
Steven Moreland28723ae2019-04-01 18:52:30 -070024#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
Christopher Ferris0170cd02016-07-18 16:57:34 -070032#include <linux/android/binder.h>
Steven Moreland6ba5a252021-05-04 22:49:00 +000033#include <sys/ioctl.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080034
Marco Ballesio7ee17572020-09-08 10:30:03 -070035#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)
Steven Moreland6ba5a252021-05-04 22:49:00 +000039#endif // BR_FROZEN_REPLY
Marco Ballesio7ee17572020-09-08 10:30:03 -070040
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
48struct binder_freeze_info {
49 //
50 // Group-leader PID of process to be frozen
51 //
Steven Moreland6ba5a252021-05-04 22:49:00 +000052 uint32_t pid;
Marco Ballesio7ee17572020-09-08 10:30:03 -070053 //
54 // Enable(1) / Disable(0) freeze for given PID
55 //
Steven Moreland6ba5a252021-05-04 22:49:00 +000056 uint32_t enable;
Marco Ballesio7ee17572020-09-08 10:30:03 -070057 //
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
Steven Moreland6ba5a252021-05-04 22:49:00 +000061 uint32_t timeout_ms;
Marco Ballesio7ee17572020-09-08 10:30:03 -070062};
Steven Moreland6ba5a252021-05-04 22:49:00 +000063#endif // BINDER_FREEZE
Marco Ballesio7ee17572020-09-08 10:30:03 -070064
Marco Ballesiob09fc4a2020-09-11 16:17:21 -070065#ifndef BINDER_GET_FROZEN_INFO
66
Steven Moreland6ba5a252021-05-04 22:49:00 +000067#define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info)
Marco Ballesiob09fc4a2020-09-11 16:17:21 -070068
69struct binder_frozen_status_info {
70 //
71 // Group-leader PID of process to be queried
72 //
Steven Moreland6ba5a252021-05-04 22:49:00 +000073 __u32 pid;
Marco Ballesiob09fc4a2020-09-11 16:17:21 -070074 //
75 // Indicates whether the process has received any sync calls since last
76 // freeze (cleared at freeze/unfreeze)
Li Li6f059292021-09-10 09:59:30 -070077 // bit 0: received sync transaction after being frozen
78 // bit 1: new pending sync transaction during freezing
Marco Ballesiob09fc4a2020-09-11 16:17:21 -070079 //
Steven Moreland6ba5a252021-05-04 22:49:00 +000080 __u32 sync_recv;
Marco Ballesiob09fc4a2020-09-11 16:17:21 -070081 //
82 // Indicates whether the process has received any async calls since last
83 // freeze (cleared at freeze/unfreeze)
84 //
Steven Moreland6ba5a252021-05-04 22:49:00 +000085 __u32 async_recv;
Marco Ballesiob09fc4a2020-09-11 16:17:21 -070086};
Steven Moreland6ba5a252021-05-04 22:49:00 +000087#endif // BINDER_GET_FROZEN_INFO
Marco Ballesiob09fc4a2020-09-11 16:17:21 -070088
Hang Lub185ac02021-03-24 13:17:22 +080089#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)
Steven Moreland6ba5a252021-05-04 22:49:00 +000093#endif // BR_ONEWAY_SPAM_SUSPECT
Hang Lub185ac02021-03-24 13:17:22 +080094
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)
Steven Moreland6ba5a252021-05-04 22:49:00 +0000101#endif // BINDER_ENABLE_ONEWAY_SPAM_DETECTION
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800102
103#endif // _BINDER_MODULE_H_