]>
git.saurik.com Git - apple/xnu.git/blob - tests/get_shared_cache_address.c
1 #include <sys/resource.h>
7 #include <mach-o/dyld.h>
8 #include <mach-o/dyld_priv.h>
11 * Test helper to retrieve the address of the shared cache. The helper
12 * also verifies that the process is correctly marked to have the shared
13 * cache reslid when interrogated through proc_pid_rusage()
16 main(int argc
, char **argv
)
18 size_t shared_cache_len
= 0;
19 struct rusage_info_v5 ru
= {};
22 fprintf(stderr
, "Invalid helper invocation");
26 if (proc_pid_rusage(getpid(), RUSAGE_INFO_V5
, (rusage_info_t
*)&ru
) != 0) {
27 perror("proc_pid_rusage() helper");
31 if (strcmp(argv
[1], "check_rusage_flag") == 0) {
32 if (!(ru
.ri_flags
& RU_PROC_RUNS_RESLIDE
)) {
33 fprintf(stderr
, "Helper rusage flag check failed\n");
38 printf("%p\n", _dyld_get_shared_cache_range(&shared_cache_len
));