xref: /NextBSD/sbin/launchd/ktrace.h (revision 33da5adc555b3bc29986eeadca03829e4ad06b1e)
1 #ifndef __LAUNCHD_KTRACE_H__
2 #define __LAUNCHD_KTRACE_H__
3 
4 #include <unistd.h>
5 #include <stdbool.h>
6 
7 extern bool launchd_apple_internal;
8 
9 #ifndef DBG_LAUNCHD
10 #define DBG_LAUNCHD 34
11 #endif /* DBG_LAUNCHD */
12 
13 /* Class(8) | SubClass(8) | Code(14) | Qual(2) */
14 #define RTKT_CODE(c) ((DBG_LAUNCHD << 24) | (((c) & 0x3fffff) << 2))
15 
16 typedef enum {
17 	RTKT_LAUNCHD_STARTING				= RTKT_CODE(1),
18 	RTKT_LAUNCHD_EXITING				= RTKT_CODE(2),
19 	RTKT_LAUNCHD_FINDING_STRAY_PG		= RTKT_CODE(3),
20 	RTKT_LAUNCHD_FINDING_ALL_STRAYS		= RTKT_CODE(4),
21 	RTKT_LAUNCHD_FINDING_EXECLESS		= RTKT_CODE(5),
22 	RTKT_LAUNCHD_FINDING_WEIRD_UIDS		= RTKT_CODE(6),
23 	RTKT_LAUNCHD_DATA_PACK				= RTKT_CODE(7),
24 	RTKT_LAUNCHD_DATA_UNPACK			= RTKT_CODE(8),
25 	RTKT_LAUNCHD_BUG					= RTKT_CODE(9),
26 	RTKT_LAUNCHD_MACH_IPC				= RTKT_CODE(10),
27 	RTKT_LAUNCHD_BSD_KEVENT				= RTKT_CODE(11),
28 	RTKT_VPROC_TRANSACTION_INCREMENT	= RTKT_CODE(12),
29 	RTKT_VPROC_TRANSACTION_DECREMENT	= RTKT_CODE(13),
30 } runtime_ktrace_code_t;
31 
32 /* All of these log the return address as "arg4" */
33 void runtime_ktrace1(runtime_ktrace_code_t code);
34 void runtime_ktrace0(runtime_ktrace_code_t code);
35 void runtime_ktrace(runtime_ktrace_code_t code, long a, long b, long c);
36 
37 #endif /* __LAUNCHD_KTRACE_H__ */
38