1 // RUN: %clang_tsan -O1 %s -o %t && %env_tsan_opts=flush_memory_ms=1:memory_limit_mb=1 %run %t 2>&1 | FileCheck %s 2 #include "test.h" 3 #include <sys/types.h> 4 #include <unistd.h> 5 #include <time.h> 6 7 // Test that setuid call works in presence of stoptheworld. 8 main()9int main() { 10 unsigned long long tp0, tp1; 11 tp0 = monotonic_clock_ns(); 12 tp1 = monotonic_clock_ns(); 13 while (tp1 - tp0 < 3 * 1000000000ull) { 14 tp1 = monotonic_clock_ns(); 15 setuid(0); 16 } 17 fprintf(stderr, "DONE\n"); 18 return 0; 19 } 20 21 // CHECK: DONE 22