1*043036a2SApple OSS Distributions #include <darwintest.h> 2*043036a2SApple OSS Distributions #include <mach/mach.h> 3*043036a2SApple OSS Distributions #include <dlfcn.h> 4*043036a2SApple OSS Distributions #include <dlfcn_private.h> 5*043036a2SApple OSS Distributions #include <mach-o/dyld.h> 6*043036a2SApple OSS Distributions #include <dispatch/dispatch.h> 7*043036a2SApple OSS Distributions 8*043036a2SApple OSS Distributions T_GLOBAL_META( 9*043036a2SApple OSS Distributions T_META_NAMESPACE("xnu.ipc"), 10*043036a2SApple OSS Distributions T_META_RADAR_COMPONENT_NAME("xnu"), 11*043036a2SApple OSS Distributions T_META_RADAR_COMPONENT_VERSION("IPC"), 12*043036a2SApple OSS Distributions T_META_RUN_CONCURRENTLY(TRUE)); 13*043036a2SApple OSS Distributions 14*043036a2SApple OSS Distributions T_DECL(task_dyld_process_info_notify_register, 15*043036a2SApple OSS Distributions "check that task_dyld_process_info_notify_register works") 16*043036a2SApple OSS Distributions { 17*043036a2SApple OSS Distributions mach_port_name_t port = MACH_PORT_NULL; 18*043036a2SApple OSS Distributions dispatch_source_t ds; 19*043036a2SApple OSS Distributions 20*043036a2SApple OSS Distributions T_ASSERT_MACH_SUCCESS(mach_port_allocate(mach_task_self(), 21*043036a2SApple OSS Distributions MACH_PORT_RIGHT_RECEIVE, &port), "allocate notif port"); 22*043036a2SApple OSS Distributions 23*043036a2SApple OSS Distributions ds = dispatch_source_create(DISPATCH_SOURCE_TYPE_MACH_RECV, port, 0, 24*043036a2SApple OSS Distributions dispatch_get_global_queue(0, 0)); 25*043036a2SApple OSS Distributions dispatch_source_set_event_handler(ds, ^{ 26*043036a2SApple OSS Distributions T_PASS("received a message for dlopen!"); 27*043036a2SApple OSS Distributions T_END; 28*043036a2SApple OSS Distributions }); 29*043036a2SApple OSS Distributions dispatch_activate(ds); 30*043036a2SApple OSS Distributions 31*043036a2SApple OSS Distributions T_ASSERT_MACH_SUCCESS(task_dyld_process_info_notify_register(mach_task_self(), port), 32*043036a2SApple OSS Distributions "register dyld notification"); 33*043036a2SApple OSS Distributions 34*043036a2SApple OSS Distributions dlopen("/usr/lib/swift/libswiftRemoteMirror.dylib", RTLD_LAZY); 35*043036a2SApple OSS Distributions } 36