xref: /xnu-12377.41.6/tests/test_utils.h (revision bbb1b6f9e71b8cdde6e5cd6f4841f207dee3d828)
1 #ifndef XNU_DARWINTEST_UTILS_H
2 #define XNU_DARWINTEST_UTILS_H
3 
4 #include <stdbool.h>
5 #include <sys/types.h>
6 
7 /* Misc. utility functions for writing darwintests. */
8 bool is_development_kernel(void);
9 
10 /*
11  * Returns true if the process is translated according to sysctl.proc_translated.
12  * For example, Rosetta processes are translated processes.
13  */
14 bool process_is_translated(void);
15 
16 /* Launches the given helper variant as a managed process. */
17 pid_t launch_background_helper(
18 	const char* variant,
19 	bool start_suspended,
20 	bool memorystatus_managed);
21 /*
22  * Set the process's managed bit, so that the memorystatus subsystem treats
23  * this process like an app instead of a sysproc.
24  */
25 void set_process_memorystatus_managed(pid_t pid);
26 
27 #define XNU_T_META_SOC_SPECIFIC T_META_TAG("SoCSpecific")
28 
29 #define XNU_T_META_REQUIRES_DEVELOPMENT_KERNEL T_META_REQUIRES_SYSCTL_EQ("kern.development", 1)
30 #define XNU_T_META_REQUIRES_RELEASE_KERNEL T_META_REQUIRES_SYSCTL_EQ("kern.development", 0)
31 
32 #endif /* XNU_DARWINTEST_UTILS_H */
33