]>
Commit | Line | Data |
---|---|---|
3e170ce0 A |
1 | /* |
2 | * Copyright (c) 2012-2013, 2015 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
25 | * | |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
27 | */ | |
28 | ||
29 | #ifndef _TASK_CORPSE_H_ | |
30 | #define _TASK_CORPSE_H_ | |
31 | ||
32 | #include <stdint.h> | |
33 | #include <mach/mach_types.h> | |
34 | #include <kern/kern_cdata.h> | |
39037602 | 35 | #include <kern/kcdata.h> |
3e170ce0 A |
36 | |
37 | typedef struct kcdata_item *task_crashinfo_item_t; | |
38 | ||
3e170ce0 A |
39 | /* Deprecated: use the KCDATA_* macros for all future use */ |
40 | #define CRASHINFO_ITEM_TYPE(item) KCDATA_ITEM_TYPE(item) | |
41 | #define CRASHINFO_ITEM_SIZE(item) KCDATA_ITEM_SIZE(item) | |
42 | #define CRASHINFO_ITEM_DATA_PTR(item) KCDATA_ITEM_DATA_PTR(item) | |
43 | ||
44 | #define CRASHINFO_ITEM_NEXT_HEADER(item) KCDATA_ITEM_NEXT_HEADER(item) | |
45 | ||
46 | #define CRASHINFO_ITEM_FOREACH(head) KCDATA_ITEM_FOREACH(head) | |
47 | ||
48 | ||
49 | #ifndef KERNEL | |
50 | #define task_crashinfo_get_data_with_desc kcdata_get_data_with_desc | |
51 | ||
52 | #endif /* KERNEL */ | |
53 | ||
54 | #ifdef XNU_KERNEL_PRIVATE | |
55 | ||
39037602 | 56 | #define CORPSEINFO_ALLOCATION_SIZE (1024 * 16) |
3e170ce0 A |
57 | #define TOTAL_CORPSES_ALLOWED 5 |
58 | ||
59 | ||
60 | ||
61 | extern kern_return_t task_mark_corpse(task_t task); | |
62 | ||
39037602 | 63 | extern kern_return_t task_deliver_crash_notification(task_t task, thread_t thread, mach_exception_data_type_t subcode); |
3e170ce0 A |
64 | |
65 | extern kcdata_descriptor_t task_get_corpseinfo(task_t task); | |
66 | ||
39037602 A |
67 | #define GET_CORPSE_REF TRUE |
68 | #define RELEASE_CORPSE_REF TRUE | |
69 | ||
3e170ce0 A |
70 | extern kcdata_descriptor_t task_crashinfo_alloc_init( |
71 | mach_vm_address_t crash_data_p, | |
39037602 A |
72 | unsigned size, |
73 | int get_corpseref, unsigned flags); | |
74 | extern kern_return_t task_crashinfo_destroy(kcdata_descriptor_t data, int release_corpseref); | |
3e170ce0 A |
75 | |
76 | extern void corpses_init(void); | |
77 | ||
78 | extern boolean_t corpses_enabled(void); | |
79 | ||
39037602 A |
80 | extern kern_return_t task_generate_corpse_internal( |
81 | task_t task, | |
82 | task_t *corpse_task, | |
83 | thread_t *thread, | |
84 | mach_exception_data_type_t code, | |
85 | mach_exception_data_type_t subcode); | |
86 | ||
87 | extern void task_clear_corpse(task_t task); | |
88 | ||
89 | extern kern_return_t task_duplicate_map_and_threads( | |
90 | task_t task, | |
91 | void *p, | |
92 | task_t new_task, | |
93 | thread_t *thread, | |
39037602 A |
94 | uint64_t **udata_buffer, |
95 | int *size, | |
96 | int*num_udata); | |
97 | ||
98 | extern void task_enqueue_exception_with_corpse( | |
99 | task_t task, | |
100 | mach_exception_data_t code, | |
101 | mach_msg_type_number_t codeCnt); | |
102 | ||
103 | extern void task_add_to_corpse_task_list(task_t corpse_task); | |
104 | void task_remove_from_corpse_task_list(task_t corpse_task); | |
105 | void task_purge_all_corpses(void); | |
106 | ||
3e170ce0 A |
107 | #endif /* XNU_KERNEL_PRIVATE */ |
108 | ||
109 | #endif /* _TASK_CORPSE_H_ */ |