1#ifndef _resource_notify_user_
2#define _resource_notify_user_
3
4/* Module resource_notify */
5
6#include <string.h>
7#include <mach/ndr.h>
8#include <mach/boolean.h>
9#include <mach/kern_return.h>
10#include <mach/notify.h>
11#include <mach/mach_types.h>
12#include <mach/message.h>
13#include <mach/mig_errors.h>
14#include <mach/port.h>
15
16/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
17
18#if defined(__has_include)
19#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
20#ifndef USING_MIG_STRNCPY_ZEROFILL
21#define USING_MIG_STRNCPY_ZEROFILL
22#endif
23#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
24#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
25#ifdef __cplusplus
26extern "C" {
27#endif
28 extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
29#ifdef __cplusplus
30}
31#endif
32#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
33#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
34#endif /* __has_include */
35
36/* END MIG_STRNCPY_ZEROFILL CODE */
37
38#if (__MigKernelSpecificCode) || (_MIG_KERNEL_SPECIFIC_CODE_)
39#include <kern/ipc_mig.h>
40#endif /* __MigKernelSpecificCode */
41
42#ifdef AUTOTEST
43#ifndef FUNCTION_PTR_T
44#define FUNCTION_PTR_T
45typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
46typedef struct {
47 char *name;
48 function_ptr_t function;
49} function_table_entry;
50typedef function_table_entry *function_table_t;
51#endif /* FUNCTION_PTR_T */
52#endif /* AUTOTEST */
53
54#ifndef resource_notify_MSG_COUNT
55#define resource_notify_MSG_COUNT 3
56#endif /* resource_notify_MSG_COUNT */
57
58#include <mach/std_types.h>
59#include <mach/mig.h>
60#include <mach/mig.h>
61#include <mach/mach_types.h>
62#include <mach/mach_types.h>
63#include <mach/resource_monitors.h>
64#include <mach/clock_types.h>
65
66#ifdef __BeforeMigUserHeader
67__BeforeMigUserHeader
68#endif /* __BeforeMigUserHeader */
69
70#include <sys/cdefs.h>
71__BEGIN_DECLS
72
73
74/* SimpleRoutine cpu_usage_violation */
75#ifdef mig_external
76mig_external
77#else
78extern
79#endif /* mig_external */
80kern_return_t send_cpu_usage_violation
81(
82 mach_port_t receiver,
83 proc_name_t procname,
84 int pid,
85 posix_path_t killed_proc_path,
86 mach_timespec_t timestamp,
87 int64_t observed_cpu_nsecs,
88 int64_t observation_nsecs,
89 int64_t cpu_nsecs_allowed,
90 int64_t limit_window_nsecs,
91 resource_notify_flags_t flags
92);
93
94/* SimpleRoutine cpu_wakes_violation */
95#ifdef mig_external
96mig_external
97#else
98extern
99#endif /* mig_external */
100kern_return_t send_cpu_wakes_violation
101(
102 mach_port_t receiver,
103 proc_name_t procname,
104 int pid,
105 posix_path_t killed_proc_path,
106 mach_timespec_t timestamp,
107 int64_t observed_cpu_wakes,
108 int64_t observation_nsecs,
109 int64_t cpu_wakes_allowed,
110 int64_t limit_window_nsecs,
111 resource_notify_flags_t flags
112);
113
114/* SimpleRoutine disk_writes_violation */
115#ifdef mig_external
116mig_external
117#else
118extern
119#endif /* mig_external */
120kern_return_t send_disk_writes_violation
121(
122 mach_port_t receiver,
123 proc_name_t procname,
124 int pid,
125 posix_path_t killed_proc_path,
126 mach_timespec_t timestamp,
127 int64_t observed_bytes_dirtied,
128 int64_t observation_nsecs,
129 int64_t bytes_dirtied_allowed,
130 int64_t limit_window_nsecs,
131 resource_notify_flags_t flags
132);
133
134__END_DECLS
135
136/********************** Caution **************************/
137/* The following data types should be used to calculate */
138/* maximum message sizes only. The actual message may be */
139/* smaller, and the position of the arguments within the */
140/* message layout may vary from what is presented here. */
141/* For example, if any of the arguments are variable- */
142/* sized, and less than the maximum is sent, the data */
143/* will be packed tight in the actual message to reduce */
144/* the presence of holes. */
145/********************** Caution **************************/
146
147/* typedefs for all requests */
148
149#ifndef __Request__resource_notify_subsystem__defined
150#define __Request__resource_notify_subsystem__defined
151
152#ifdef __MigPackStructs
153#pragma pack(4)
154#endif
155 typedef struct {
156 mach_msg_header_t Head;
157 NDR_record_t NDR;
158 proc_name_t procname;
159 char procnamePad[3];
160 int pid;
161 posix_path_t killed_proc_path;
162 mach_timespec_t timestamp;
163 int64_t observed_cpu_nsecs;
164 int64_t observation_nsecs;
165 int64_t cpu_nsecs_allowed;
166 int64_t limit_window_nsecs;
167 resource_notify_flags_t flags;
168 } __Request__cpu_usage_violation_t __attribute__((unused));
169#ifdef __MigPackStructs
170#pragma pack()
171#endif
172
173#ifdef __MigPackStructs
174#pragma pack(4)
175#endif
176 typedef struct {
177 mach_msg_header_t Head;
178 NDR_record_t NDR;
179 proc_name_t procname;
180 char procnamePad[3];
181 int pid;
182 posix_path_t killed_proc_path;
183 mach_timespec_t timestamp;
184 int64_t observed_cpu_wakes;
185 int64_t observation_nsecs;
186 int64_t cpu_wakes_allowed;
187 int64_t limit_window_nsecs;
188 resource_notify_flags_t flags;
189 } __Request__cpu_wakes_violation_t __attribute__((unused));
190#ifdef __MigPackStructs
191#pragma pack()
192#endif
193
194#ifdef __MigPackStructs
195#pragma pack(4)
196#endif
197 typedef struct {
198 mach_msg_header_t Head;
199 NDR_record_t NDR;
200 proc_name_t procname;
201 char procnamePad[3];
202 int pid;
203 posix_path_t killed_proc_path;
204 mach_timespec_t timestamp;
205 int64_t observed_bytes_dirtied;
206 int64_t observation_nsecs;
207 int64_t bytes_dirtied_allowed;
208 int64_t limit_window_nsecs;
209 resource_notify_flags_t flags;
210 } __Request__disk_writes_violation_t __attribute__((unused));
211#ifdef __MigPackStructs
212#pragma pack()
213#endif
214#endif /* !__Request__resource_notify_subsystem__defined */
215
216/* union of all requests */
217
218#ifndef __RequestUnion__send_resource_notify_subsystem__defined
219#define __RequestUnion__send_resource_notify_subsystem__defined
220union __RequestUnion__send_resource_notify_subsystem {
221 __Request__cpu_usage_violation_t Request_send_cpu_usage_violation;
222 __Request__cpu_wakes_violation_t Request_send_cpu_wakes_violation;
223 __Request__disk_writes_violation_t Request_send_disk_writes_violation;
224};
225#endif /* !__RequestUnion__send_resource_notify_subsystem__defined */
226/* typedefs for all replies */
227
228#ifndef __Reply__resource_notify_subsystem__defined
229#define __Reply__resource_notify_subsystem__defined
230
231#ifdef __MigPackStructs
232#pragma pack(4)
233#endif
234 typedef struct {
235 mach_msg_header_t Head;
236 NDR_record_t NDR;
237 kern_return_t RetCode;
238 } __Reply__cpu_usage_violation_t __attribute__((unused));
239#ifdef __MigPackStructs
240#pragma pack()
241#endif
242
243#ifdef __MigPackStructs
244#pragma pack(4)
245#endif
246 typedef struct {
247 mach_msg_header_t Head;
248 NDR_record_t NDR;
249 kern_return_t RetCode;
250 } __Reply__cpu_wakes_violation_t __attribute__((unused));
251#ifdef __MigPackStructs
252#pragma pack()
253#endif
254
255#ifdef __MigPackStructs
256#pragma pack(4)
257#endif
258 typedef struct {
259 mach_msg_header_t Head;
260 NDR_record_t NDR;
261 kern_return_t RetCode;
262 } __Reply__disk_writes_violation_t __attribute__((unused));
263#ifdef __MigPackStructs
264#pragma pack()
265#endif
266#endif /* !__Reply__resource_notify_subsystem__defined */
267
268/* union of all replies */
269
270#ifndef __ReplyUnion__send_resource_notify_subsystem__defined
271#define __ReplyUnion__send_resource_notify_subsystem__defined
272union __ReplyUnion__send_resource_notify_subsystem {
273 __Reply__cpu_usage_violation_t Reply_send_cpu_usage_violation;
274 __Reply__cpu_wakes_violation_t Reply_send_cpu_wakes_violation;
275 __Reply__disk_writes_violation_t Reply_send_disk_writes_violation;
276};
277#endif /* !__RequestUnion__send_resource_notify_subsystem__defined */
278
279#ifndef subsystem_to_name_map_resource_notify
280#define subsystem_to_name_map_resource_notify \
281 { "cpu_usage_violation", 827800 },\
282 { "cpu_wakes_violation", 827801 },\
283 { "disk_writes_violation", 827802 }
284#endif
285
286#ifdef __AfterMigUserHeader
287__AfterMigUserHeader
288#endif /* __AfterMigUserHeader */
289
290#endif /* _resource_notify_user_ */
291