xref: /freebsd/contrib/llvm-project/compiler-rt/include/sanitizer/tsan_interface.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric //===-- tsan_interface.h ----------------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file is a part of ThreadSanitizer (TSan), a race detector.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric // Public interface header for TSan.
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric #ifndef SANITIZER_TSAN_INTERFACE_H
140b57cec5SDimitry Andric #define SANITIZER_TSAN_INTERFACE_H
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric #include <sanitizer/common_interface_defs.h>
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric #ifdef __cplusplus
190b57cec5SDimitry Andric extern "C" {
200b57cec5SDimitry Andric #endif
210b57cec5SDimitry Andric 
220b57cec5SDimitry Andric // __tsan_release establishes a happens-before relation with a preceding
230b57cec5SDimitry Andric // __tsan_acquire on the same address.
24*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_acquire(void *addr);
25*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_release(void *addr);
260b57cec5SDimitry Andric 
270b57cec5SDimitry Andric // Annotations for custom mutexes.
280b57cec5SDimitry Andric // The annotations allow to get better reports (with sets of locked mutexes),
290b57cec5SDimitry Andric // detect more types of bugs (e.g. mutex misuses, races between lock/unlock and
300b57cec5SDimitry Andric // destruction and potential deadlocks) and improve precision and performance
310b57cec5SDimitry Andric // (by ignoring individual atomic operations in mutex code). However, the
320b57cec5SDimitry Andric // downside is that annotated mutex code itself is not checked for correctness.
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric // Mutex creation flags are passed to __tsan_mutex_create annotation.
350b57cec5SDimitry Andric // If mutex has no constructor and __tsan_mutex_create is not called,
360b57cec5SDimitry Andric // the flags may be passed to __tsan_mutex_pre_lock/__tsan_mutex_post_lock
370b57cec5SDimitry Andric // annotations.
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric // Mutex has static storage duration and no-op constructor and destructor.
400b57cec5SDimitry Andric // This effectively makes tsan ignore destroy annotation.
415ffd83dbSDimitry Andric static const unsigned __tsan_mutex_linker_init      = 1 << 0;
420b57cec5SDimitry Andric // Mutex is write reentrant.
435ffd83dbSDimitry Andric static const unsigned __tsan_mutex_write_reentrant  = 1 << 1;
440b57cec5SDimitry Andric // Mutex is read reentrant.
455ffd83dbSDimitry Andric static const unsigned __tsan_mutex_read_reentrant   = 1 << 2;
460b57cec5SDimitry Andric // Mutex does not have static storage duration, and must not be used after
470b57cec5SDimitry Andric // its destructor runs.  The opposite of __tsan_mutex_linker_init.
480b57cec5SDimitry Andric // If this flag is passed to __tsan_mutex_destroy, then the destruction
490b57cec5SDimitry Andric // is ignored unless this flag was previously set on the mutex.
505ffd83dbSDimitry Andric static const unsigned __tsan_mutex_not_static       = 1 << 8;
510b57cec5SDimitry Andric 
520b57cec5SDimitry Andric // Mutex operation flags:
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric // Denotes read lock operation.
555ffd83dbSDimitry Andric static const unsigned __tsan_mutex_read_lock = 1 << 3;
560b57cec5SDimitry Andric // Denotes try lock operation.
575ffd83dbSDimitry Andric static const unsigned __tsan_mutex_try_lock = 1 << 4;
580b57cec5SDimitry Andric // Denotes that a try lock operation has failed to acquire the mutex.
595ffd83dbSDimitry Andric static const unsigned __tsan_mutex_try_lock_failed = 1 << 5;
600b57cec5SDimitry Andric // Denotes that the lock operation acquires multiple recursion levels.
610b57cec5SDimitry Andric // Number of levels is passed in recursion parameter.
620b57cec5SDimitry Andric // This is useful for annotation of e.g. Java builtin monitors,
630b57cec5SDimitry Andric // for which wait operation releases all recursive acquisitions of the mutex.
645ffd83dbSDimitry Andric static const unsigned __tsan_mutex_recursive_lock = 1 << 6;
650b57cec5SDimitry Andric // Denotes that the unlock operation releases all recursion levels.
660b57cec5SDimitry Andric // Number of released levels is returned and later must be passed to
670b57cec5SDimitry Andric // the corresponding __tsan_mutex_post_lock annotation.
685ffd83dbSDimitry Andric static const unsigned __tsan_mutex_recursive_unlock = 1 << 7;
690b57cec5SDimitry Andric 
70fe6060f1SDimitry Andric // Convenient composed constants.
71fe6060f1SDimitry Andric static const unsigned __tsan_mutex_try_read_lock =
72fe6060f1SDimitry Andric     __tsan_mutex_read_lock | __tsan_mutex_try_lock;
73fe6060f1SDimitry Andric static const unsigned __tsan_mutex_try_read_lock_failed =
74fe6060f1SDimitry Andric     __tsan_mutex_try_read_lock | __tsan_mutex_try_lock_failed;
75fe6060f1SDimitry Andric 
760b57cec5SDimitry Andric // Annotate creation of a mutex.
770b57cec5SDimitry Andric // Supported flags: mutex creation flags.
78*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_mutex_create(void *addr, unsigned flags);
790b57cec5SDimitry Andric 
800b57cec5SDimitry Andric // Annotate destruction of a mutex.
810b57cec5SDimitry Andric // Supported flags:
820b57cec5SDimitry Andric //   - __tsan_mutex_linker_init
830b57cec5SDimitry Andric //   - __tsan_mutex_not_static
84*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_mutex_destroy(void *addr, unsigned flags);
850b57cec5SDimitry Andric 
860b57cec5SDimitry Andric // Annotate start of lock operation.
870b57cec5SDimitry Andric // Supported flags:
880b57cec5SDimitry Andric //   - __tsan_mutex_read_lock
890b57cec5SDimitry Andric //   - __tsan_mutex_try_lock
900b57cec5SDimitry Andric //   - all mutex creation flags
91*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_mutex_pre_lock(void *addr, unsigned flags);
920b57cec5SDimitry Andric 
930b57cec5SDimitry Andric // Annotate end of lock operation.
940b57cec5SDimitry Andric // Supported flags:
950b57cec5SDimitry Andric //   - __tsan_mutex_read_lock (must match __tsan_mutex_pre_lock)
960b57cec5SDimitry Andric //   - __tsan_mutex_try_lock (must match __tsan_mutex_pre_lock)
970b57cec5SDimitry Andric //   - __tsan_mutex_try_lock_failed
980b57cec5SDimitry Andric //   - __tsan_mutex_recursive_lock
990b57cec5SDimitry Andric //   - all mutex creation flags
100*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_mutex_post_lock(void *addr, unsigned flags,
101*5f757f3fSDimitry Andric                                             int recursion);
1020b57cec5SDimitry Andric 
1030b57cec5SDimitry Andric // Annotate start of unlock operation.
1040b57cec5SDimitry Andric // Supported flags:
1050b57cec5SDimitry Andric //   - __tsan_mutex_read_lock
1060b57cec5SDimitry Andric //   - __tsan_mutex_recursive_unlock
107*5f757f3fSDimitry Andric int SANITIZER_CDECL __tsan_mutex_pre_unlock(void *addr, unsigned flags);
1080b57cec5SDimitry Andric 
1090b57cec5SDimitry Andric // Annotate end of unlock operation.
1100b57cec5SDimitry Andric // Supported flags:
1110b57cec5SDimitry Andric //   - __tsan_mutex_read_lock (must match __tsan_mutex_pre_unlock)
112*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_mutex_post_unlock(void *addr, unsigned flags);
1130b57cec5SDimitry Andric 
1140b57cec5SDimitry Andric // Annotate start/end of notify/signal/broadcast operation.
1150b57cec5SDimitry Andric // Supported flags: none.
116*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_mutex_pre_signal(void *addr, unsigned flags);
117*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_mutex_post_signal(void *addr, unsigned flags);
1180b57cec5SDimitry Andric 
1190b57cec5SDimitry Andric // Annotate start/end of a region of code where lock/unlock/signal operation
1200b57cec5SDimitry Andric // diverts to do something else unrelated to the mutex. This can be used to
1210b57cec5SDimitry Andric // annotate, for example, calls into cooperative scheduler or contention
1220b57cec5SDimitry Andric // profiling code.
1230b57cec5SDimitry Andric // These annotations must be called only from within
1240b57cec5SDimitry Andric // __tsan_mutex_pre/post_lock, __tsan_mutex_pre/post_unlock,
1250b57cec5SDimitry Andric // __tsan_mutex_pre/post_signal regions.
1260b57cec5SDimitry Andric // Supported flags: none.
127*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_mutex_pre_divert(void *addr, unsigned flags);
128*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_mutex_post_divert(void *addr, unsigned flags);
129*5f757f3fSDimitry Andric 
130*5f757f3fSDimitry Andric // Check that the current thread does not hold any mutexes,
131*5f757f3fSDimitry Andric // report a bug report otherwise.
132*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_check_no_mutexes_held();
1330b57cec5SDimitry Andric 
1340b57cec5SDimitry Andric // External race detection API.
1350b57cec5SDimitry Andric // Can be used by non-instrumented libraries to detect when their objects are
1360b57cec5SDimitry Andric // being used in an unsafe manner.
1370b57cec5SDimitry Andric //   - __tsan_external_read/__tsan_external_write annotates the logical reads
1380b57cec5SDimitry Andric //       and writes of the object at the specified address. 'caller_pc' should
1390b57cec5SDimitry Andric //       be the PC of the library user, which the library can obtain with e.g.
1400b57cec5SDimitry Andric //       `__builtin_return_address(0)`.
1410b57cec5SDimitry Andric //   - __tsan_external_register_tag registers a 'tag' with the specified name,
1420b57cec5SDimitry Andric //       which is later used in read/write annotations to denote the object type
1430b57cec5SDimitry Andric //   - __tsan_external_assign_tag can optionally mark a heap object with a tag
144*5f757f3fSDimitry Andric void *SANITIZER_CDECL __tsan_external_register_tag(const char *object_type);
145*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_external_register_header(void *tag,
146*5f757f3fSDimitry Andric                                                      const char *header);
147*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_external_assign_tag(void *addr, void *tag);
148*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_external_read(void *addr, void *caller_pc,
149*5f757f3fSDimitry Andric                                           void *tag);
150*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_external_write(void *addr, void *caller_pc,
151*5f757f3fSDimitry Andric                                            void *tag);
1520b57cec5SDimitry Andric 
1530b57cec5SDimitry Andric // Fiber switching API.
1540b57cec5SDimitry Andric //   - TSAN context for fiber can be created by __tsan_create_fiber
1550b57cec5SDimitry Andric //     and freed by __tsan_destroy_fiber.
1560b57cec5SDimitry Andric //   - TSAN context of current fiber or thread can be obtained
1570b57cec5SDimitry Andric //     by calling __tsan_get_current_fiber.
158fe6060f1SDimitry Andric //   - __tsan_switch_to_fiber should be called immediately before switch
1590b57cec5SDimitry Andric //     to fiber, such as call of swapcontext.
1600b57cec5SDimitry Andric //   - Fiber name can be set by __tsan_set_fiber_name.
161*5f757f3fSDimitry Andric void *SANITIZER_CDECL __tsan_get_current_fiber(void);
162*5f757f3fSDimitry Andric void *SANITIZER_CDECL __tsan_create_fiber(unsigned flags);
163*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_destroy_fiber(void *fiber);
164*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_switch_to_fiber(void *fiber, unsigned flags);
165*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_set_fiber_name(void *fiber, const char *name);
1660b57cec5SDimitry Andric 
1670b57cec5SDimitry Andric // Flags for __tsan_switch_to_fiber:
1680b57cec5SDimitry Andric // Do not establish a happens-before relation between fibers
1695ffd83dbSDimitry Andric static const unsigned __tsan_switch_to_fiber_no_sync = 1 << 0;
1700b57cec5SDimitry Andric 
171fe6060f1SDimitry Andric // User-provided callback invoked on TSan initialization.
172*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_on_initialize();
173fe6060f1SDimitry Andric 
174fe6060f1SDimitry Andric // User-provided callback invoked on TSan shutdown.
175fe6060f1SDimitry Andric // `failed` - Nonzero if TSan did detect issues, zero otherwise.
176fe6060f1SDimitry Andric // Return `0` if TSan should exit as if no issues were detected.  Return nonzero
177fe6060f1SDimitry Andric // if TSan should exit as if issues were detected.
178*5f757f3fSDimitry Andric int SANITIZER_CDECL __tsan_on_finalize(int failed);
179fe6060f1SDimitry Andric 
180349cc55cSDimitry Andric // Release TSan internal memory in a best-effort manner.
181*5f757f3fSDimitry Andric void SANITIZER_CDECL __tsan_flush_memory();
182349cc55cSDimitry Andric 
18306c3fb27SDimitry Andric // User-provided default TSAN options.
184*5f757f3fSDimitry Andric const char *SANITIZER_CDECL __tsan_default_options(void);
18506c3fb27SDimitry Andric 
18606c3fb27SDimitry Andric // User-provided default TSAN suppressions.
187*5f757f3fSDimitry Andric const char *SANITIZER_CDECL __tsan_default_suppressions(void);
18806c3fb27SDimitry Andric 
18906c3fb27SDimitry Andric /// Returns a report's description.
19006c3fb27SDimitry Andric ///
19106c3fb27SDimitry Andric /// Returns a report's description (issue type), number of duplicate issues
19206c3fb27SDimitry Andric /// found, counts of array data (stack traces, memory operations, locations,
19306c3fb27SDimitry Andric /// mutexes, threads, unique thread IDs) and a stack trace of a <c>sleep()</c>
19406c3fb27SDimitry Andric /// call (if one was involved in the issue).
19506c3fb27SDimitry Andric ///
19606c3fb27SDimitry Andric /// \param report Opaque pointer to the current report.
19706c3fb27SDimitry Andric /// \param[out] description Report type description.
19806c3fb27SDimitry Andric /// \param[out] count Count of duplicate issues.
19906c3fb27SDimitry Andric /// \param[out] stack_count Count of stack traces.
20006c3fb27SDimitry Andric /// \param[out] mop_count Count of memory operations.
20106c3fb27SDimitry Andric /// \param[out] loc_count Count of locations.
20206c3fb27SDimitry Andric /// \param[out] mutex_count Count of mutexes.
20306c3fb27SDimitry Andric /// \param[out] thread_count Count of threads.
20406c3fb27SDimitry Andric /// \param[out] unique_tid_count Count of unique thread IDs.
20506c3fb27SDimitry Andric /// \param sleep_trace A buffer to store the stack trace of a <c>sleep()</c>
20606c3fb27SDimitry Andric /// call.
20706c3fb27SDimitry Andric /// \param trace_size Size in bytes of the trace buffer.
20806c3fb27SDimitry Andric /// \returns Returns 1 if successful, 0 if not.
209*5f757f3fSDimitry Andric int SANITIZER_CDECL __tsan_get_report_data(
210*5f757f3fSDimitry Andric     void *report, const char **description, int *count, int *stack_count,
211*5f757f3fSDimitry Andric     int *mop_count, int *loc_count, int *mutex_count, int *thread_count,
212*5f757f3fSDimitry Andric     int *unique_tid_count, void **sleep_trace, unsigned long trace_size);
21306c3fb27SDimitry Andric 
21406c3fb27SDimitry Andric /// Returns information about stack traces included in the report.
21506c3fb27SDimitry Andric ///
21606c3fb27SDimitry Andric /// \param report Opaque pointer to the current report.
21706c3fb27SDimitry Andric /// \param idx Index to the report's stacks.
21806c3fb27SDimitry Andric /// \param trace A buffer to store the stack trace.
21906c3fb27SDimitry Andric /// \param trace_size Size in bytes of the trace buffer.
22006c3fb27SDimitry Andric /// \returns Returns 1 if successful, 0 if not.
221*5f757f3fSDimitry Andric int SANITIZER_CDECL __tsan_get_report_stack(void *report, unsigned long idx,
222*5f757f3fSDimitry Andric                                             void **trace,
22306c3fb27SDimitry Andric                                             unsigned long trace_size);
22406c3fb27SDimitry Andric 
22506c3fb27SDimitry Andric /// Returns information about memory operations included in the report.
22606c3fb27SDimitry Andric ///
22706c3fb27SDimitry Andric /// \param report Opaque pointer to the current report.
22806c3fb27SDimitry Andric /// \param idx Index to the report's memory operations.
22906c3fb27SDimitry Andric /// \param[out] tid Thread ID of the memory operation.
23006c3fb27SDimitry Andric /// \param[out] addr Address of the memory operation.
23106c3fb27SDimitry Andric /// \param[out] size Size of the memory operation.
23206c3fb27SDimitry Andric /// \param[out] write Write flag of the memory operation.
23306c3fb27SDimitry Andric /// \param[out] atomic Atomicity flag of the memory operation.
23406c3fb27SDimitry Andric /// \param trace A buffer to store the stack trace.
23506c3fb27SDimitry Andric /// \param trace_size Size in bytes of the trace buffer.
23606c3fb27SDimitry Andric /// \returns Returns 1 if successful, 0 if not.
237*5f757f3fSDimitry Andric int SANITIZER_CDECL __tsan_get_report_mop(void *report, unsigned long idx,
238*5f757f3fSDimitry Andric                                           int *tid, void **addr, int *size,
239*5f757f3fSDimitry Andric                                           int *write, int *atomic, void **trace,
240*5f757f3fSDimitry Andric                                           unsigned long trace_size);
24106c3fb27SDimitry Andric 
24206c3fb27SDimitry Andric /// Returns information about locations included in the report.
24306c3fb27SDimitry Andric ///
24406c3fb27SDimitry Andric /// \param report Opaque pointer to the current report.
24506c3fb27SDimitry Andric /// \param idx Index to the report's locations.
24606c3fb27SDimitry Andric /// \param[out] type Type of the location.
24706c3fb27SDimitry Andric /// \param[out] addr Address of the location.
24806c3fb27SDimitry Andric /// \param[out] start Start of the location.
24906c3fb27SDimitry Andric /// \param[out] size Size of the location.
25006c3fb27SDimitry Andric /// \param[out] tid Thread ID of the location.
25106c3fb27SDimitry Andric /// \param[out] fd File descriptor of the location.
25206c3fb27SDimitry Andric /// \param[out] suppressable Suppressable flag.
25306c3fb27SDimitry Andric /// \param trace A buffer to store the stack trace.
25406c3fb27SDimitry Andric /// \param trace_size Size in bytes of the trace buffer.
25506c3fb27SDimitry Andric /// \returns Returns 1 if successful, 0 if not.
256*5f757f3fSDimitry Andric int SANITIZER_CDECL __tsan_get_report_loc(void *report, unsigned long idx,
257*5f757f3fSDimitry Andric                                           const char **type, void **addr,
258*5f757f3fSDimitry Andric                                           void **start, unsigned long *size,
259*5f757f3fSDimitry Andric                                           int *tid, int *fd, int *suppressable,
260*5f757f3fSDimitry Andric                                           void **trace,
26106c3fb27SDimitry Andric                                           unsigned long trace_size);
26206c3fb27SDimitry Andric 
26306c3fb27SDimitry Andric /// Returns information about mutexes included in the report.
26406c3fb27SDimitry Andric ///
26506c3fb27SDimitry Andric /// \param report Opaque pointer to the current report.
26606c3fb27SDimitry Andric /// \param idx Index to the report's mutexes.
26706c3fb27SDimitry Andric /// \param[out] mutex_id Id of the mutex.
26806c3fb27SDimitry Andric /// \param[out] addr Address of the mutex.
26906c3fb27SDimitry Andric /// \param[out] destroyed Destroyed mutex flag.
27006c3fb27SDimitry Andric /// \param trace A buffer to store the stack trace.
27106c3fb27SDimitry Andric /// \param trace_size Size in bytes of the trace buffer.
27206c3fb27SDimitry Andric /// \returns Returns 1 if successful, 0 if not.
273*5f757f3fSDimitry Andric int SANITIZER_CDECL __tsan_get_report_mutex(void *report, unsigned long idx,
274*5f757f3fSDimitry Andric                                             uint64_t *mutex_id, void **addr,
275*5f757f3fSDimitry Andric                                             int *destroyed, void **trace,
27606c3fb27SDimitry Andric                                             unsigned long trace_size);
27706c3fb27SDimitry Andric 
27806c3fb27SDimitry Andric /// Returns information about threads included in the report.
27906c3fb27SDimitry Andric ///
28006c3fb27SDimitry Andric /// \param report Opaque pointer to the current report.
28106c3fb27SDimitry Andric /// \param idx Index to the report's threads.
28206c3fb27SDimitry Andric /// \param[out] tid Thread ID of the thread.
28306c3fb27SDimitry Andric /// \param[out] os_id Operating system's ID of the thread.
28406c3fb27SDimitry Andric /// \param[out] running Running flag of the thread.
28506c3fb27SDimitry Andric /// \param[out] name Name of the thread.
28606c3fb27SDimitry Andric /// \param[out] parent_tid ID of the parent thread.
28706c3fb27SDimitry Andric /// \param trace A buffer to store the stack trace.
28806c3fb27SDimitry Andric /// \param trace_size Size in bytes of the trace buffer.
28906c3fb27SDimitry Andric /// \returns Returns 1 if successful, 0 if not.
290*5f757f3fSDimitry Andric int SANITIZER_CDECL __tsan_get_report_thread(void *report, unsigned long idx,
291*5f757f3fSDimitry Andric                                              int *tid, uint64_t *os_id,
292*5f757f3fSDimitry Andric                                              int *running, const char **name,
29306c3fb27SDimitry Andric                                              int *parent_tid, void **trace,
29406c3fb27SDimitry Andric                                              unsigned long trace_size);
29506c3fb27SDimitry Andric 
29606c3fb27SDimitry Andric /// Returns information about unique thread IDs included in the report.
29706c3fb27SDimitry Andric ///
29806c3fb27SDimitry Andric /// \param report Opaque pointer to the current report.
29906c3fb27SDimitry Andric /// \param idx Index to the report's unique thread IDs.
30006c3fb27SDimitry Andric /// \param[out] tid Unique thread ID of the report.
30106c3fb27SDimitry Andric /// \returns Returns 1 if successful, 0 if not.
302*5f757f3fSDimitry Andric int SANITIZER_CDECL __tsan_get_report_unique_tid(void *report,
303*5f757f3fSDimitry Andric                                                  unsigned long idx, int *tid);
30406c3fb27SDimitry Andric 
30506c3fb27SDimitry Andric /// Returns the current report.
30606c3fb27SDimitry Andric ///
30706c3fb27SDimitry Andric /// If TSan is currently reporting a detected issue on the current thread,
30806c3fb27SDimitry Andric /// returns an opaque pointer to the current report. Otherwise returns NULL.
30906c3fb27SDimitry Andric /// \returns An opaque pointer to the current report. Otherwise returns NULL.
310*5f757f3fSDimitry Andric void *SANITIZER_CDECL __tsan_get_current_report();
31106c3fb27SDimitry Andric 
3120b57cec5SDimitry Andric #ifdef __cplusplus
3130b57cec5SDimitry Andric } // extern "C"
3140b57cec5SDimitry Andric #endif
3150b57cec5SDimitry Andric 
3160b57cec5SDimitry Andric #endif // SANITIZER_TSAN_INTERFACE_H
317