| 1 | /* |
| 2 | * IDENTIFICATION: |
| 3 | * stub generated by bootstrap_cmds-133 |
| 4 | * OPTIONS: |
| 5 | * KernelUser |
| 6 | */ |
| 7 | #define __MIG_check__Reply__resource_notify_subsystem__ 1 |
| 8 | |
| 9 | #include "resource_notify.h" |
| 10 | |
| 11 | /* TODO: #include <mach/mach.h> */ |
| 12 | #ifdef __cplusplus |
| 13 | extern "C" { |
| 14 | #endif /* __cplusplus */ |
| 15 | extern void mach_msg_destroy(mach_msg_header_t *); |
| 16 | #ifdef __cplusplus |
| 17 | } |
| 18 | #endif /* __cplusplus */ |
| 19 | |
| 20 | #ifndef mig_internal |
| 21 | #define mig_internal static __inline__ |
| 22 | #endif /* mig_internal */ |
| 23 | |
| 24 | #ifndef mig_external |
| 25 | #define mig_external |
| 26 | #endif /* mig_external */ |
| 27 | |
| 28 | #if !defined(__MigTypeCheck) && defined(TypeCheck) |
| 29 | #define __MigTypeCheck TypeCheck /* Legacy setting */ |
| 30 | #endif /* !defined(__MigTypeCheck) */ |
| 31 | |
| 32 | #if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) |
| 33 | #define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ |
| 34 | #endif /* !defined(__MigKernelSpecificCode) */ |
| 35 | |
| 36 | #ifndef LimitCheck |
| 37 | #define LimitCheck 0 |
| 38 | #endif /* LimitCheck */ |
| 39 | |
| 40 | #ifndef min |
| 41 | #define min(a,b) ( ((a) < (b))? (a): (b) ) |
| 42 | #endif /* min */ |
| 43 | |
| 44 | #if !defined(_WALIGN_) |
| 45 | #define _WALIGN_(x) (((x) + 3) & ~3) |
| 46 | #endif /* !defined(_WALIGN_) */ |
| 47 | |
| 48 | #if !defined(_WALIGNSZ_) |
| 49 | #define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) |
| 50 | #endif /* !defined(_WALIGNSZ_) */ |
| 51 | |
| 52 | #ifndef UseStaticTemplates |
| 53 | #define UseStaticTemplates 0 |
| 54 | #endif /* UseStaticTemplates */ |
| 55 | |
| 56 | #ifndef MIG_SERVER_ROUTINE |
| 57 | #define MIG_SERVER_ROUTINE |
| 58 | #endif |
| 59 | |
| 60 | #ifndef __MachMsgErrorWithTimeout |
| 61 | #define __MachMsgErrorWithTimeout(_R_) { \ |
| 62 | switch (_R_) { \ |
| 63 | case MACH_SEND_INVALID_DATA: \ |
| 64 | case MACH_SEND_INVALID_DEST: \ |
| 65 | case MACH_SEND_INVALID_HEADER: \ |
| 66 | mig_put_reply_port(InP->Head.msgh_reply_port); \ |
| 67 | break; \ |
| 68 | case MACH_SEND_TIMED_OUT: \ |
| 69 | case MACH_RCV_TIMED_OUT: \ |
| 70 | default: \ |
| 71 | mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ |
| 72 | } \ |
| 73 | } |
| 74 | #endif /* __MachMsgErrorWithTimeout */ |
| 75 | |
| 76 | #ifndef __MachMsgErrorWithoutTimeout |
| 77 | #define __MachMsgErrorWithoutTimeout(_R_) { \ |
| 78 | switch (_R_) { \ |
| 79 | case MACH_SEND_INVALID_DATA: \ |
| 80 | case MACH_SEND_INVALID_DEST: \ |
| 81 | case MACH_SEND_INVALID_HEADER: \ |
| 82 | mig_put_reply_port(InP->Head.msgh_reply_port); \ |
| 83 | break; \ |
| 84 | default: \ |
| 85 | mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ |
| 86 | } \ |
| 87 | } |
| 88 | #endif /* __MachMsgErrorWithoutTimeout */ |
| 89 | |
| 90 | #ifndef __DeclareSendRpc |
| 91 | #define __DeclareSendRpc(_NUM_, _NAME_) |
| 92 | #endif /* __DeclareSendRpc */ |
| 93 | |
| 94 | #ifndef __BeforeSendRpc |
| 95 | #define __BeforeSendRpc(_NUM_, _NAME_) |
| 96 | #endif /* __BeforeSendRpc */ |
| 97 | |
| 98 | #ifndef __AfterSendRpc |
| 99 | #define __AfterSendRpc(_NUM_, _NAME_) |
| 100 | #endif /* __AfterSendRpc */ |
| 101 | |
| 102 | #ifndef __DeclareSendSimple |
| 103 | #define __DeclareSendSimple(_NUM_, _NAME_) |
| 104 | #endif /* __DeclareSendSimple */ |
| 105 | |
| 106 | #ifndef __BeforeSendSimple |
| 107 | #define __BeforeSendSimple(_NUM_, _NAME_) |
| 108 | #endif /* __BeforeSendSimple */ |
| 109 | |
| 110 | #ifndef __AfterSendSimple |
| 111 | #define __AfterSendSimple(_NUM_, _NAME_) |
| 112 | #endif /* __AfterSendSimple */ |
| 113 | |
| 114 | #define msgh_request_port msgh_remote_port |
| 115 | #define msgh_reply_port msgh_local_port |
| 116 | |
| 117 | |
| 118 | |
| 119 | /* SimpleRoutine cpu_usage_violation */ |
| 120 | mig_external kern_return_t send_cpu_usage_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_cpu_nsecs, |
| 128 | int64_t observation_nsecs, |
| 129 | int64_t cpu_nsecs_allowed, |
| 130 | int64_t limit_window_nsecs, |
| 131 | resource_notify_flags_t flags |
| 132 | ) |
| 133 | { |
| 134 | |
| 135 | #ifdef __MigPackStructs |
| 136 | #pragma pack(push, 4) |
| 137 | #endif |
| 138 | typedef struct { |
| 139 | mach_msg_header_t Head; |
| 140 | NDR_record_t NDR; |
| 141 | proc_name_t procname; |
| 142 | char procnamePad[3]; |
| 143 | int pid; |
| 144 | posix_path_t killed_proc_path; |
| 145 | mach_timespec_t timestamp; |
| 146 | int64_t observed_cpu_nsecs; |
| 147 | int64_t observation_nsecs; |
| 148 | int64_t cpu_nsecs_allowed; |
| 149 | int64_t limit_window_nsecs; |
| 150 | resource_notify_flags_t flags; |
| 151 | } Request __attribute__((unused)); |
| 152 | #ifdef __MigPackStructs |
| 153 | #pragma pack(pop) |
| 154 | #endif |
| 155 | /* |
| 156 | * typedef struct { |
| 157 | * mach_msg_header_t Head; |
| 158 | * NDR_record_t NDR; |
| 159 | * kern_return_t RetCode; |
| 160 | * } mig_reply_error_t; |
| 161 | */ |
| 162 | |
| 163 | union cpu_usage_violationMessU { |
| 164 | Request In; |
| 165 | } *Mess = (union cpu_usage_violationMessU *) mig_user_allocate(size: sizeof(*Mess)); |
| 166 | |
| 167 | Request *InP = &Mess->In; |
| 168 | |
| 169 | mach_msg_return_t msg_result; |
| 170 | |
| 171 | #ifdef __MIG_check__Reply__cpu_usage_violation_t__defined |
| 172 | kern_return_t check_result; |
| 173 | #endif /* __MIG_check__Reply__cpu_usage_violation_t__defined */ |
| 174 | |
| 175 | __DeclareSendSimple(827800, "cpu_usage_violation" ) |
| 176 | |
| 177 | InP->NDR = NDR_record; |
| 178 | |
| 179 | { typedef struct { char data[33]; } *sp; |
| 180 | * (sp) InP->procname = * (sp) procname; |
| 181 | } |
| 182 | for (int i = 0; i < 3; i++) |
| 183 | InP->procnamePad[i] = 0; |
| 184 | |
| 185 | InP->pid = pid; |
| 186 | |
| 187 | { typedef struct { char data[1024]; } *sp; |
| 188 | * (sp) InP->killed_proc_path = * (sp) killed_proc_path; |
| 189 | } |
| 190 | |
| 191 | InP->timestamp = timestamp; |
| 192 | |
| 193 | InP->observed_cpu_nsecs = observed_cpu_nsecs; |
| 194 | |
| 195 | InP->observation_nsecs = observation_nsecs; |
| 196 | |
| 197 | InP->cpu_nsecs_allowed = cpu_nsecs_allowed; |
| 198 | |
| 199 | InP->limit_window_nsecs = limit_window_nsecs; |
| 200 | |
| 201 | InP->flags = flags; |
| 202 | |
| 203 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
| 204 | InP->Head.msgh_bits = |
| 205 | MACH_MSGH_BITS(19, 0); |
| 206 | /* msgh_size passed as argument */ |
| 207 | InP->Head.msgh_request_port = receiver; |
| 208 | InP->Head.msgh_id = 827800; |
| 209 | InP->Head.msgh_reserved = 0; |
| 210 | |
| 211 | __BeforeSendSimple(827800, "cpu_usage_violation" ) |
| 212 | #if __MigKernelSpecificCode |
| 213 | msg_result = mach_msg_send_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request)); |
| 214 | #else |
| 215 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
| 216 | #endif /* __MigKernelSpecificCode */ |
| 217 | __AfterSendSimple(827800, "cpu_usage_violation" ) |
| 218 | { mig_user_deallocate(data: (char *) Mess, size: sizeof(*Mess)); return msg_result; } |
| 219 | } |
| 220 | |
| 221 | /* SimpleRoutine cpu_wakes_violation */ |
| 222 | mig_external kern_return_t send_cpu_wakes_violation |
| 223 | ( |
| 224 | mach_port_t receiver, |
| 225 | proc_name_t procname, |
| 226 | int pid, |
| 227 | posix_path_t killed_proc_path, |
| 228 | mach_timespec_t timestamp, |
| 229 | int64_t observed_cpu_wakes, |
| 230 | int64_t observation_nsecs, |
| 231 | int64_t cpu_wakes_allowed, |
| 232 | int64_t limit_window_nsecs, |
| 233 | resource_notify_flags_t flags |
| 234 | ) |
| 235 | { |
| 236 | |
| 237 | #ifdef __MigPackStructs |
| 238 | #pragma pack(push, 4) |
| 239 | #endif |
| 240 | typedef struct { |
| 241 | mach_msg_header_t Head; |
| 242 | NDR_record_t NDR; |
| 243 | proc_name_t procname; |
| 244 | char procnamePad[3]; |
| 245 | int pid; |
| 246 | posix_path_t killed_proc_path; |
| 247 | mach_timespec_t timestamp; |
| 248 | int64_t observed_cpu_wakes; |
| 249 | int64_t observation_nsecs; |
| 250 | int64_t cpu_wakes_allowed; |
| 251 | int64_t limit_window_nsecs; |
| 252 | resource_notify_flags_t flags; |
| 253 | } Request __attribute__((unused)); |
| 254 | #ifdef __MigPackStructs |
| 255 | #pragma pack(pop) |
| 256 | #endif |
| 257 | /* |
| 258 | * typedef struct { |
| 259 | * mach_msg_header_t Head; |
| 260 | * NDR_record_t NDR; |
| 261 | * kern_return_t RetCode; |
| 262 | * } mig_reply_error_t; |
| 263 | */ |
| 264 | |
| 265 | union cpu_wakes_violationMessU { |
| 266 | Request In; |
| 267 | } *Mess = (union cpu_wakes_violationMessU *) mig_user_allocate(size: sizeof(*Mess)); |
| 268 | |
| 269 | Request *InP = &Mess->In; |
| 270 | |
| 271 | mach_msg_return_t msg_result; |
| 272 | |
| 273 | #ifdef __MIG_check__Reply__cpu_wakes_violation_t__defined |
| 274 | kern_return_t check_result; |
| 275 | #endif /* __MIG_check__Reply__cpu_wakes_violation_t__defined */ |
| 276 | |
| 277 | __DeclareSendSimple(827801, "cpu_wakes_violation" ) |
| 278 | |
| 279 | InP->NDR = NDR_record; |
| 280 | |
| 281 | { typedef struct { char data[33]; } *sp; |
| 282 | * (sp) InP->procname = * (sp) procname; |
| 283 | } |
| 284 | for (int i = 0; i < 3; i++) |
| 285 | InP->procnamePad[i] = 0; |
| 286 | |
| 287 | InP->pid = pid; |
| 288 | |
| 289 | { typedef struct { char data[1024]; } *sp; |
| 290 | * (sp) InP->killed_proc_path = * (sp) killed_proc_path; |
| 291 | } |
| 292 | |
| 293 | InP->timestamp = timestamp; |
| 294 | |
| 295 | InP->observed_cpu_wakes = observed_cpu_wakes; |
| 296 | |
| 297 | InP->observation_nsecs = observation_nsecs; |
| 298 | |
| 299 | InP->cpu_wakes_allowed = cpu_wakes_allowed; |
| 300 | |
| 301 | InP->limit_window_nsecs = limit_window_nsecs; |
| 302 | |
| 303 | InP->flags = flags; |
| 304 | |
| 305 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
| 306 | InP->Head.msgh_bits = |
| 307 | MACH_MSGH_BITS(19, 0); |
| 308 | /* msgh_size passed as argument */ |
| 309 | InP->Head.msgh_request_port = receiver; |
| 310 | InP->Head.msgh_id = 827801; |
| 311 | InP->Head.msgh_reserved = 0; |
| 312 | |
| 313 | __BeforeSendSimple(827801, "cpu_wakes_violation" ) |
| 314 | #if __MigKernelSpecificCode |
| 315 | msg_result = mach_msg_send_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request)); |
| 316 | #else |
| 317 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
| 318 | #endif /* __MigKernelSpecificCode */ |
| 319 | __AfterSendSimple(827801, "cpu_wakes_violation" ) |
| 320 | { mig_user_deallocate(data: (char *) Mess, size: sizeof(*Mess)); return msg_result; } |
| 321 | } |
| 322 | |
| 323 | /* SimpleRoutine disk_writes_violation */ |
| 324 | mig_external kern_return_t send_disk_writes_violation |
| 325 | ( |
| 326 | mach_port_t receiver, |
| 327 | proc_name_t procname, |
| 328 | int pid, |
| 329 | posix_path_t killed_proc_path, |
| 330 | mach_timespec_t timestamp, |
| 331 | int64_t observed_bytes_dirtied, |
| 332 | int64_t observation_nsecs, |
| 333 | int64_t bytes_dirtied_allowed, |
| 334 | int64_t limit_window_nsecs, |
| 335 | resource_notify_flags_t flags |
| 336 | ) |
| 337 | { |
| 338 | |
| 339 | #ifdef __MigPackStructs |
| 340 | #pragma pack(push, 4) |
| 341 | #endif |
| 342 | typedef struct { |
| 343 | mach_msg_header_t Head; |
| 344 | NDR_record_t NDR; |
| 345 | proc_name_t procname; |
| 346 | char procnamePad[3]; |
| 347 | int pid; |
| 348 | posix_path_t killed_proc_path; |
| 349 | mach_timespec_t timestamp; |
| 350 | int64_t observed_bytes_dirtied; |
| 351 | int64_t observation_nsecs; |
| 352 | int64_t bytes_dirtied_allowed; |
| 353 | int64_t limit_window_nsecs; |
| 354 | resource_notify_flags_t flags; |
| 355 | } Request __attribute__((unused)); |
| 356 | #ifdef __MigPackStructs |
| 357 | #pragma pack(pop) |
| 358 | #endif |
| 359 | /* |
| 360 | * typedef struct { |
| 361 | * mach_msg_header_t Head; |
| 362 | * NDR_record_t NDR; |
| 363 | * kern_return_t RetCode; |
| 364 | * } mig_reply_error_t; |
| 365 | */ |
| 366 | |
| 367 | union disk_writes_violationMessU { |
| 368 | Request In; |
| 369 | } *Mess = (union disk_writes_violationMessU *) mig_user_allocate(size: sizeof(*Mess)); |
| 370 | |
| 371 | Request *InP = &Mess->In; |
| 372 | |
| 373 | mach_msg_return_t msg_result; |
| 374 | |
| 375 | #ifdef __MIG_check__Reply__disk_writes_violation_t__defined |
| 376 | kern_return_t check_result; |
| 377 | #endif /* __MIG_check__Reply__disk_writes_violation_t__defined */ |
| 378 | |
| 379 | __DeclareSendSimple(827802, "disk_writes_violation" ) |
| 380 | |
| 381 | InP->NDR = NDR_record; |
| 382 | |
| 383 | { typedef struct { char data[33]; } *sp; |
| 384 | * (sp) InP->procname = * (sp) procname; |
| 385 | } |
| 386 | for (int i = 0; i < 3; i++) |
| 387 | InP->procnamePad[i] = 0; |
| 388 | |
| 389 | InP->pid = pid; |
| 390 | |
| 391 | { typedef struct { char data[1024]; } *sp; |
| 392 | * (sp) InP->killed_proc_path = * (sp) killed_proc_path; |
| 393 | } |
| 394 | |
| 395 | InP->timestamp = timestamp; |
| 396 | |
| 397 | InP->observed_bytes_dirtied = observed_bytes_dirtied; |
| 398 | |
| 399 | InP->observation_nsecs = observation_nsecs; |
| 400 | |
| 401 | InP->bytes_dirtied_allowed = bytes_dirtied_allowed; |
| 402 | |
| 403 | InP->limit_window_nsecs = limit_window_nsecs; |
| 404 | |
| 405 | InP->flags = flags; |
| 406 | |
| 407 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
| 408 | InP->Head.msgh_bits = |
| 409 | MACH_MSGH_BITS(19, 0); |
| 410 | /* msgh_size passed as argument */ |
| 411 | InP->Head.msgh_request_port = receiver; |
| 412 | InP->Head.msgh_id = 827802; |
| 413 | InP->Head.msgh_reserved = 0; |
| 414 | |
| 415 | __BeforeSendSimple(827802, "disk_writes_violation" ) |
| 416 | #if __MigKernelSpecificCode |
| 417 | msg_result = mach_msg_send_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request)); |
| 418 | #else |
| 419 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
| 420 | #endif /* __MigKernelSpecificCode */ |
| 421 | __AfterSendSimple(827802, "disk_writes_violation" ) |
| 422 | { mig_user_deallocate(data: (char *) Mess, size: sizeof(*Mess)); return msg_result; } |
| 423 | } |
| 424 | |
| 425 | /* SimpleRoutine port_space_violation */ |
| 426 | mig_external kern_return_t send_port_space_violation |
| 427 | ( |
| 428 | mach_port_t receiver, |
| 429 | proc_name_t procname, |
| 430 | int pid, |
| 431 | mach_timespec_t timestamp, |
| 432 | int64_t observed_ports, |
| 433 | int64_t ports_allowed, |
| 434 | mach_port_t fatal_port, |
| 435 | resource_notify_flags_t flags |
| 436 | ) |
| 437 | { |
| 438 | |
| 439 | #ifdef __MigPackStructs |
| 440 | #pragma pack(push, 4) |
| 441 | #endif |
| 442 | typedef struct { |
| 443 | mach_msg_header_t Head; |
| 444 | /* start of the kernel processed data */ |
| 445 | mach_msg_body_t msgh_body; |
| 446 | mach_msg_port_descriptor_t fatal_port; |
| 447 | /* end of the kernel processed data */ |
| 448 | NDR_record_t NDR; |
| 449 | proc_name_t procname; |
| 450 | char procnamePad[3]; |
| 451 | int pid; |
| 452 | mach_timespec_t timestamp; |
| 453 | int64_t observed_ports; |
| 454 | int64_t ports_allowed; |
| 455 | resource_notify_flags_t flags; |
| 456 | } Request __attribute__((unused)); |
| 457 | #ifdef __MigPackStructs |
| 458 | #pragma pack(pop) |
| 459 | #endif |
| 460 | /* |
| 461 | * typedef struct { |
| 462 | * mach_msg_header_t Head; |
| 463 | * NDR_record_t NDR; |
| 464 | * kern_return_t RetCode; |
| 465 | * } mig_reply_error_t; |
| 466 | */ |
| 467 | |
| 468 | union { |
| 469 | Request In; |
| 470 | } Mess; |
| 471 | |
| 472 | Request *InP = &Mess.In; |
| 473 | |
| 474 | mach_msg_return_t msg_result; |
| 475 | |
| 476 | #ifdef __MIG_check__Reply__port_space_violation_t__defined |
| 477 | kern_return_t check_result; |
| 478 | #endif /* __MIG_check__Reply__port_space_violation_t__defined */ |
| 479 | |
| 480 | __DeclareSendSimple(827803, "port_space_violation" ) |
| 481 | |
| 482 | #if UseStaticTemplates |
| 483 | const static mach_msg_port_descriptor_t fatal_portTemplate = { |
| 484 | /* name = */ MACH_PORT_NULL, |
| 485 | /* pad1 = */ 0, |
| 486 | /* pad2 = */ 0, |
| 487 | /* disp = */ 19, |
| 488 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
| 489 | }; |
| 490 | #endif /* UseStaticTemplates */ |
| 491 | |
| 492 | InP->msgh_body.msgh_descriptor_count = 1; |
| 493 | #if UseStaticTemplates |
| 494 | InP->fatal_port = fatal_portTemplate; |
| 495 | InP->fatal_port.name = fatal_port; |
| 496 | #else /* UseStaticTemplates */ |
| 497 | InP->fatal_port.name = fatal_port; |
| 498 | InP->fatal_port.disposition = 19; |
| 499 | InP->fatal_port.type = MACH_MSG_PORT_DESCRIPTOR; |
| 500 | #endif /* UseStaticTemplates */ |
| 501 | |
| 502 | InP->NDR = NDR_record; |
| 503 | |
| 504 | { typedef struct { char data[33]; } *sp; |
| 505 | * (sp) InP->procname = * (sp) procname; |
| 506 | } |
| 507 | for (int i = 0; i < 3; i++) |
| 508 | InP->procnamePad[i] = 0; |
| 509 | |
| 510 | InP->pid = pid; |
| 511 | |
| 512 | InP->timestamp = timestamp; |
| 513 | |
| 514 | InP->observed_ports = observed_ports; |
| 515 | |
| 516 | InP->ports_allowed = ports_allowed; |
| 517 | |
| 518 | InP->flags = flags; |
| 519 | |
| 520 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
| 521 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
| 522 | MACH_MSGH_BITS(19, 0); |
| 523 | /* msgh_size passed as argument */ |
| 524 | InP->Head.msgh_request_port = receiver; |
| 525 | InP->Head.msgh_id = 827803; |
| 526 | InP->Head.msgh_reserved = 0; |
| 527 | |
| 528 | __BeforeSendSimple(827803, "port_space_violation" ) |
| 529 | #if __MigKernelSpecificCode |
| 530 | msg_result = mach_msg_send_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request)); |
| 531 | #else |
| 532 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
| 533 | #endif /* __MigKernelSpecificCode */ |
| 534 | __AfterSendSimple(827803, "port_space_violation" ) |
| 535 | return msg_result; |
| 536 | } |
| 537 | |
| 538 | /* SimpleRoutine file_descriptors_violation */ |
| 539 | mig_external kern_return_t send_file_descriptors_violation |
| 540 | ( |
| 541 | mach_port_t receiver, |
| 542 | proc_name_t procname, |
| 543 | int pid, |
| 544 | mach_timespec_t timestamp, |
| 545 | int64_t observed_filedesc, |
| 546 | int64_t filedesc_allowed, |
| 547 | mach_port_t fatal_port, |
| 548 | resource_notify_flags_t flags |
| 549 | ) |
| 550 | { |
| 551 | |
| 552 | #ifdef __MigPackStructs |
| 553 | #pragma pack(push, 4) |
| 554 | #endif |
| 555 | typedef struct { |
| 556 | mach_msg_header_t Head; |
| 557 | /* start of the kernel processed data */ |
| 558 | mach_msg_body_t msgh_body; |
| 559 | mach_msg_port_descriptor_t fatal_port; |
| 560 | /* end of the kernel processed data */ |
| 561 | NDR_record_t NDR; |
| 562 | proc_name_t procname; |
| 563 | char procnamePad[3]; |
| 564 | int pid; |
| 565 | mach_timespec_t timestamp; |
| 566 | int64_t observed_filedesc; |
| 567 | int64_t filedesc_allowed; |
| 568 | resource_notify_flags_t flags; |
| 569 | } Request __attribute__((unused)); |
| 570 | #ifdef __MigPackStructs |
| 571 | #pragma pack(pop) |
| 572 | #endif |
| 573 | /* |
| 574 | * typedef struct { |
| 575 | * mach_msg_header_t Head; |
| 576 | * NDR_record_t NDR; |
| 577 | * kern_return_t RetCode; |
| 578 | * } mig_reply_error_t; |
| 579 | */ |
| 580 | |
| 581 | union { |
| 582 | Request In; |
| 583 | } Mess; |
| 584 | |
| 585 | Request *InP = &Mess.In; |
| 586 | |
| 587 | mach_msg_return_t msg_result; |
| 588 | |
| 589 | #ifdef __MIG_check__Reply__file_descriptors_violation_t__defined |
| 590 | kern_return_t check_result; |
| 591 | #endif /* __MIG_check__Reply__file_descriptors_violation_t__defined */ |
| 592 | |
| 593 | __DeclareSendSimple(827804, "file_descriptors_violation" ) |
| 594 | |
| 595 | #if UseStaticTemplates |
| 596 | const static mach_msg_port_descriptor_t fatal_portTemplate = { |
| 597 | /* name = */ MACH_PORT_NULL, |
| 598 | /* pad1 = */ 0, |
| 599 | /* pad2 = */ 0, |
| 600 | /* disp = */ 19, |
| 601 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
| 602 | }; |
| 603 | #endif /* UseStaticTemplates */ |
| 604 | |
| 605 | InP->msgh_body.msgh_descriptor_count = 1; |
| 606 | #if UseStaticTemplates |
| 607 | InP->fatal_port = fatal_portTemplate; |
| 608 | InP->fatal_port.name = fatal_port; |
| 609 | #else /* UseStaticTemplates */ |
| 610 | InP->fatal_port.name = fatal_port; |
| 611 | InP->fatal_port.disposition = 19; |
| 612 | InP->fatal_port.type = MACH_MSG_PORT_DESCRIPTOR; |
| 613 | #endif /* UseStaticTemplates */ |
| 614 | |
| 615 | InP->NDR = NDR_record; |
| 616 | |
| 617 | { typedef struct { char data[33]; } *sp; |
| 618 | * (sp) InP->procname = * (sp) procname; |
| 619 | } |
| 620 | for (int i = 0; i < 3; i++) |
| 621 | InP->procnamePad[i] = 0; |
| 622 | |
| 623 | InP->pid = pid; |
| 624 | |
| 625 | InP->timestamp = timestamp; |
| 626 | |
| 627 | InP->observed_filedesc = observed_filedesc; |
| 628 | |
| 629 | InP->filedesc_allowed = filedesc_allowed; |
| 630 | |
| 631 | InP->flags = flags; |
| 632 | |
| 633 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
| 634 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
| 635 | MACH_MSGH_BITS(19, 0); |
| 636 | /* msgh_size passed as argument */ |
| 637 | InP->Head.msgh_request_port = receiver; |
| 638 | InP->Head.msgh_id = 827804; |
| 639 | InP->Head.msgh_reserved = 0; |
| 640 | |
| 641 | __BeforeSendSimple(827804, "file_descriptors_violation" ) |
| 642 | #if __MigKernelSpecificCode |
| 643 | msg_result = mach_msg_send_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request)); |
| 644 | #else |
| 645 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
| 646 | #endif /* __MigKernelSpecificCode */ |
| 647 | __AfterSendSimple(827804, "file_descriptors_violation" ) |
| 648 | return msg_result; |
| 649 | } |
| 650 | |
| 651 | /* SimpleRoutine kqworkloops_violation */ |
| 652 | mig_external kern_return_t send_kqworkloops_violation |
| 653 | ( |
| 654 | mach_port_t receiver, |
| 655 | proc_name_t procname, |
| 656 | int pid, |
| 657 | mach_timespec_t timestamp, |
| 658 | int64_t observed_kqworkloops, |
| 659 | int64_t kqworkloops_allowed, |
| 660 | mach_port_t fatal_port, |
| 661 | resource_notify_flags_t flags |
| 662 | ) |
| 663 | { |
| 664 | |
| 665 | #ifdef __MigPackStructs |
| 666 | #pragma pack(push, 4) |
| 667 | #endif |
| 668 | typedef struct { |
| 669 | mach_msg_header_t Head; |
| 670 | /* start of the kernel processed data */ |
| 671 | mach_msg_body_t msgh_body; |
| 672 | mach_msg_port_descriptor_t fatal_port; |
| 673 | /* end of the kernel processed data */ |
| 674 | NDR_record_t NDR; |
| 675 | proc_name_t procname; |
| 676 | char procnamePad[3]; |
| 677 | int pid; |
| 678 | mach_timespec_t timestamp; |
| 679 | int64_t observed_kqworkloops; |
| 680 | int64_t kqworkloops_allowed; |
| 681 | resource_notify_flags_t flags; |
| 682 | } Request __attribute__((unused)); |
| 683 | #ifdef __MigPackStructs |
| 684 | #pragma pack(pop) |
| 685 | #endif |
| 686 | /* |
| 687 | * typedef struct { |
| 688 | * mach_msg_header_t Head; |
| 689 | * NDR_record_t NDR; |
| 690 | * kern_return_t RetCode; |
| 691 | * } mig_reply_error_t; |
| 692 | */ |
| 693 | |
| 694 | union { |
| 695 | Request In; |
| 696 | } Mess; |
| 697 | |
| 698 | Request *InP = &Mess.In; |
| 699 | |
| 700 | mach_msg_return_t msg_result; |
| 701 | |
| 702 | #ifdef __MIG_check__Reply__kqworkloops_violation_t__defined |
| 703 | kern_return_t check_result; |
| 704 | #endif /* __MIG_check__Reply__kqworkloops_violation_t__defined */ |
| 705 | |
| 706 | __DeclareSendSimple(827805, "kqworkloops_violation" ) |
| 707 | |
| 708 | #if UseStaticTemplates |
| 709 | const static mach_msg_port_descriptor_t fatal_portTemplate = { |
| 710 | /* name = */ MACH_PORT_NULL, |
| 711 | /* pad1 = */ 0, |
| 712 | /* pad2 = */ 0, |
| 713 | /* disp = */ 19, |
| 714 | /* type = */ MACH_MSG_PORT_DESCRIPTOR, |
| 715 | }; |
| 716 | #endif /* UseStaticTemplates */ |
| 717 | |
| 718 | InP->msgh_body.msgh_descriptor_count = 1; |
| 719 | #if UseStaticTemplates |
| 720 | InP->fatal_port = fatal_portTemplate; |
| 721 | InP->fatal_port.name = fatal_port; |
| 722 | #else /* UseStaticTemplates */ |
| 723 | InP->fatal_port.name = fatal_port; |
| 724 | InP->fatal_port.disposition = 19; |
| 725 | InP->fatal_port.type = MACH_MSG_PORT_DESCRIPTOR; |
| 726 | #endif /* UseStaticTemplates */ |
| 727 | |
| 728 | InP->NDR = NDR_record; |
| 729 | |
| 730 | { typedef struct { char data[33]; } *sp; |
| 731 | * (sp) InP->procname = * (sp) procname; |
| 732 | } |
| 733 | for (int i = 0; i < 3; i++) |
| 734 | InP->procnamePad[i] = 0; |
| 735 | |
| 736 | InP->pid = pid; |
| 737 | |
| 738 | InP->timestamp = timestamp; |
| 739 | |
| 740 | InP->observed_kqworkloops = observed_kqworkloops; |
| 741 | |
| 742 | InP->kqworkloops_allowed = kqworkloops_allowed; |
| 743 | |
| 744 | InP->flags = flags; |
| 745 | |
| 746 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
| 747 | InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| |
| 748 | MACH_MSGH_BITS(19, 0); |
| 749 | /* msgh_size passed as argument */ |
| 750 | InP->Head.msgh_request_port = receiver; |
| 751 | InP->Head.msgh_id = 827805; |
| 752 | InP->Head.msgh_reserved = 0; |
| 753 | |
| 754 | __BeforeSendSimple(827805, "kqworkloops_violation" ) |
| 755 | #if __MigKernelSpecificCode |
| 756 | msg_result = mach_msg_send_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request)); |
| 757 | #else |
| 758 | msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); |
| 759 | #endif /* __MigKernelSpecificCode */ |
| 760 | __AfterSendSimple(827805, "kqworkloops_violation" ) |
| 761 | return msg_result; |
| 762 | } |
| 763 | |