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 /* Returns true if the Secure Page Table Monitor (SPTM) is present on the system. */ 11 bool is_sptm_enabled(void); 12 13 /* Returns true if system-wide codesigning policy allows programs to use MAP_JIT with mmap(). */ 14 bool is_map_jit_allowed(void); 15 16 /* 17 * Returns true if the process is translated according to sysctl.proc_translated. 18 * For example, Rosetta processes are translated processes. 19 */ 20 bool process_is_translated(void); 21 22 /* Launches the given helper variant as a managed process. */ 23 pid_t launch_background_helper( 24 const char* variant, 25 bool start_suspended, 26 bool memorystatus_managed); 27 /* 28 * Set the process's managed bit, so that the memorystatus subsystem treats 29 * this process like an app instead of a sysproc. 30 */ 31 void set_process_memorystatus_managed(pid_t pid); 32 33 #define XNU_T_META_SOC_SPECIFIC T_META_TAG("SoCSpecific") 34 35 #define XNU_T_META_REQUIRES_DEVELOPMENT_KERNEL T_META_REQUIRES_SYSCTL_EQ("kern.development", 1) 36 #define XNU_T_META_REQUIRES_RELEASE_KERNEL T_META_REQUIRES_SYSCTL_EQ("kern.development", 0) 37 38 #endif /* XNU_DARWINTEST_UTILS_H */ 39