1 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
6 extern "C" FILE *__interceptor_fopen(const char *file
, const char *mode
);
7 extern "C" int __interceptor_fileno(FILE *f
);
9 extern "C" FILE *fopen(const char *file
, const char *mode
) {
11 if (__sync_lock_test_and_set(&first
, 1) == 0)
12 printf("user fopen\n");
13 return __interceptor_fopen(file
, mode
);
16 extern "C" int fileno(FILE *f
) {
18 if (__sync_lock_test_and_set(&first
, 1) == 0)
19 printf("user fileno\n");
24 FILE *f
= fopen("/dev/zero", "r");
33 // CHECK-NOT: ThreadSanitizer