2 * Copyright (c) 2012-2013, 2015 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 #ifndef _TASK_CORPSE_H_
30 #define _TASK_CORPSE_H_
33 #include <mach/mach_types.h>
34 #include <kern/kern_cdata.h>
36 typedef struct kcdata_item
*task_crashinfo_item_t
;
39 * NOTE: Please update libkdd/kcdata/kcdtypes.c if you make any changes
40 * in TASK_CRASHINFO_* types.
43 #define TASK_CRASHINFO_BEGIN KCDATA_BUFFER_BEGIN_CRASHINFO
44 #define TASK_CRASHINFO_STRING_DESC KCDATA_TYPE_STRING_DESC
45 #define TASK_CRASHINFO_UINT32_DESC KCDATA_TYPE_UINT32_DESC
46 #define TASK_CRASHINFO_UINT64_DESC KCDATA_TYPE_UINT64_DESC
48 #define TASK_CRASHINFO_EXTMODINFO 0x801
49 #define TASK_CRASHINFO_BSDINFOWITHUNIQID 0x802 /* struct proc_uniqidentifierinfo */
50 #define TASK_CRASHINFO_TASKDYLD_INFO 0x803
51 #define TASK_CRASHINFO_UUID 0x804
52 #define TASK_CRASHINFO_PID 0x805
53 #define TASK_CRASHINFO_PPID 0x806
54 #define TASK_CRASHINFO_RUSAGE 0x807 /* struct rusage */
55 #define TASK_CRASHINFO_RUSAGE_INFO 0x808 /* struct rusage_info_current */
56 #define TASK_CRASHINFO_PROC_NAME 0x809 /* char * */
57 #define TASK_CRASHINFO_PROC_STARTTIME 0x80B /* struct timeval64 */
58 #define TASK_CRASHINFO_USERSTACK 0x80C /* uint64_t */
59 #define TASK_CRASHINFO_ARGSLEN 0x80D
60 #define TASK_CRASHINFO_EXCEPTION_CODES 0x80E /* mach_exception_data_t */
61 #define TASK_CRASHINFO_PROC_PATH 0x80F /* string of len MAXPATHLEN */
62 #define TASK_CRASHINFO_PROC_CSFLAGS 0x810 /* uint32_t */
63 #define TASK_CRASHINFO_PROC_STATUS 0x811 /* char */
64 #define TASK_CRASHINFO_UID 0x812 /* uid_t */
65 #define TASK_CRASHINFO_GID 0x813 /* gid_t */
66 #define TASK_CRASHINFO_PROC_ARGC 0x814 /* int */
67 #define TASK_CRASHINFO_PROC_FLAGS 0x815 /* unsigned int */
68 #define TASK_CRASHINFO_CPUTYPE 0x816 /* cpu_type_t */
69 #define TASK_CRASHINFO_WORKQUEUEINFO 0x817 /* struct proc_workqueueinfo */
70 #define TASK_CRASHINFO_RESPONSIBLE_PID 0x818 /* pid_t */
71 #define TASK_CRASHINFO_DIRTY_FLAGS 0x819 /* int */
72 #define TASK_CRASHINFO_CRASHED_THREADID 0x81A /* uint64_t */
74 #define TASK_CRASHINFO_END KCDATA_TYPE_BUFFER_END
76 /* Deprecated: use the KCDATA_* macros for all future use */
77 #define CRASHINFO_ITEM_TYPE(item) KCDATA_ITEM_TYPE(item)
78 #define CRASHINFO_ITEM_SIZE(item) KCDATA_ITEM_SIZE(item)
79 #define CRASHINFO_ITEM_DATA_PTR(item) KCDATA_ITEM_DATA_PTR(item)
81 #define CRASHINFO_ITEM_NEXT_HEADER(item) KCDATA_ITEM_NEXT_HEADER(item)
83 #define CRASHINFO_ITEM_FOREACH(head) KCDATA_ITEM_FOREACH(head)
87 #define task_crashinfo_get_data_with_desc kcdata_get_data_with_desc
91 #ifdef XNU_KERNEL_PRIVATE
93 #define CORPSEINFO_ALLOCATION_SIZE (1024 * 1024 * 2)
94 #define TOTAL_CORPSES_ALLOWED 5
98 extern kern_return_t
task_mark_corpse(task_t task
);
100 extern kern_return_t
task_deliver_crash_notification(task_t task
);
102 extern kcdata_descriptor_t
task_get_corpseinfo(task_t task
);
104 extern kcdata_descriptor_t
task_crashinfo_alloc_init(
105 mach_vm_address_t crash_data_p
,
107 extern kern_return_t
task_crashinfo_destroy(kcdata_descriptor_t data
);
109 extern void corpses_init(void);
111 extern boolean_t
corpses_enabled(void);
113 #endif /* XNU_KERNEL_PRIVATE */
115 #endif /* _TASK_CORPSE_H_ */