Home | History | Annotate | Download | only in tsan
      1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
      2 //
      3 // setuid(0) hangs on powerpc64 big endian.  When this is fixed remove
      4 // the unsupported flag.
      5 // https://llvm.org/bugs/show_bug.cgi?id=25799
      6 //
      7 // UNSUPPORTED: powerpc64-unknown-linux-gnu
      8 #include "test.h"
      9 #include <sys/types.h>
     10 #include <unistd.h>
     11 
     12 // Setuid call used to hang because the background tsan thread did not handle
     13 // SIGSETXID signal. Note that we don't care whether setuid call succeeds
     14 // or not.
     15 
     16 static void *thread(void *arg) {
     17   (void)arg;
     18   sleep(1);
     19   return 0;
     20 }
     21 
     22 int main() {
     23   // Create another thread just for completeness of the picture.
     24   pthread_t th;
     25   pthread_create(&th, 0, thread, 0);
     26   setuid(0);
     27   pthread_join(th, 0);
     28   fprintf(stderr, "DONE\n");
     29   return 0;
     30 }
     31 
     32 // CHECK: DONE
     33