Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 1 | // RUN: %clang_tsan -O1 %s -o %t && TSAN_OPTIONS="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 | |
| 9 | int main() { |
| 10 | struct timespec tp0, tp1; |
| 11 | clock_gettime(CLOCK_MONOTONIC, &tp0); |
| 12 | clock_gettime(CLOCK_MONOTONIC, &tp1); |
| 13 | while (tp1.tv_sec - tp0.tv_sec < 3) { |
| 14 | clock_gettime(CLOCK_MONOTONIC, &tp1); |
| 15 | setuid(0); |
| 16 | } |
| 17 | fprintf(stderr, "DONE\n"); |
| 18 | return 0; |
| 19 | } |
| 20 | |
| 21 | // CHECK: DONE |