1*2c2f96dcSApple OSS Distributions #include <darwintest.h> 2*2c2f96dcSApple OSS Distributions #include <System/kern/remote_time.h> 3*2c2f96dcSApple OSS Distributions #include <mach/mach_time.h> 4*2c2f96dcSApple OSS Distributions #include <stdint.h> 5*2c2f96dcSApple OSS Distributions #include <sys/sysctl.h> 6*2c2f96dcSApple OSS Distributions #include <TargetConditionals.h> 7*2c2f96dcSApple OSS Distributions 8*2c2f96dcSApple OSS Distributions T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true)); 9*2c2f96dcSApple OSS Distributions 10*2c2f96dcSApple OSS Distributions extern uint64_t __mach_bridge_remote_time(uint64_t); 11*2c2f96dcSApple OSS Distributions 12*2c2f96dcSApple OSS Distributions T_DECL(remote_time_syscall, "test mach_bridge_remote_time syscall", 13*2c2f96dcSApple OSS Distributions T_META_CHECK_LEAKS(false)) 14*2c2f96dcSApple OSS Distributions { 15*2c2f96dcSApple OSS Distributions #if TARGET_OS_BRIDGE 16*2c2f96dcSApple OSS Distributions uint64_t local_time = mach_absolute_time(); 17*2c2f96dcSApple OSS Distributions uint64_t remote_time1 = mach_bridge_remote_time(local_time); 18*2c2f96dcSApple OSS Distributions uint64_t remote_time2 = __mach_bridge_remote_time(local_time); 19*2c2f96dcSApple OSS Distributions T_LOG("local_time = %llu, remote_time1 = %llu, remote_time2 = %llu", 20*2c2f96dcSApple OSS Distributions local_time, remote_time1, remote_time2); 21*2c2f96dcSApple OSS Distributions T_ASSERT_EQ(remote_time1, remote_time2, "syscall works"); 22*2c2f96dcSApple OSS Distributions #else 23*2c2f96dcSApple OSS Distributions T_SKIP("Skipping test"); 24*2c2f96dcSApple OSS Distributions #endif /* TARGET_OS_BRIDGE */ 25*2c2f96dcSApple OSS Distributions } 26