77 lines · c
1//===-- tsan_posix_util.h ---------------------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// This file is a part of ThreadSanitizer (TSan), a race detector.10//11// Test POSIX utils.12//===----------------------------------------------------------------------===//13#ifndef TSAN_POSIX_UTIL_H14#define TSAN_POSIX_UTIL_H15 16#include <pthread.h>17 18#ifdef __APPLE__19#define __interceptor_memcpy wrap_memcpy20#define __interceptor_memset wrap_memset21#define __interceptor_pthread_create wrap_pthread_create22#define __interceptor_pthread_join wrap_pthread_join23#define __interceptor_pthread_detach wrap_pthread_detach24#define __interceptor_pthread_mutex_init wrap_pthread_mutex_init25#define __interceptor_pthread_mutex_lock wrap_pthread_mutex_lock26#define __interceptor_pthread_mutex_unlock wrap_pthread_mutex_unlock27#define __interceptor_pthread_mutex_destroy wrap_pthread_mutex_destroy28#define __interceptor_pthread_mutex_trylock wrap_pthread_mutex_trylock29#define __interceptor_pthread_rwlock_init wrap_pthread_rwlock_init30#define __interceptor_pthread_rwlock_destroy wrap_pthread_rwlock_destroy31#define __interceptor_pthread_rwlock_trywrlock wrap_pthread_rwlock_trywrlock32#define __interceptor_pthread_rwlock_wrlock wrap_pthread_rwlock_wrlock33#define __interceptor_pthread_rwlock_unlock wrap_pthread_rwlock_unlock34#define __interceptor_pthread_rwlock_rdlock wrap_pthread_rwlock_rdlock35#define __interceptor_pthread_rwlock_tryrdlock wrap_pthread_rwlock_tryrdlock36#define __interceptor_pthread_cond_init wrap_pthread_cond_init37#define __interceptor_pthread_cond_signal wrap_pthread_cond_signal38#define __interceptor_pthread_cond_broadcast wrap_pthread_cond_broadcast39#define __interceptor_pthread_cond_wait wrap_pthread_cond_wait40#define __interceptor_pthread_cond_destroy wrap_pthread_cond_destroy41#endif42 43extern "C" void *__interceptor_memcpy(void *, const void *, uptr);44extern "C" void *__interceptor_memset(void *, int, uptr);45extern "C" int __interceptor_pthread_create(pthread_t *thread,46 const pthread_attr_t *attr,47 void *(*start_routine)(void *),48 void *arg);49extern "C" int __interceptor_pthread_join(pthread_t thread, void **value_ptr);50extern "C" int __interceptor_pthread_detach(pthread_t thread);51 52extern "C" int __interceptor_pthread_mutex_init(53 pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);54extern "C" int __interceptor_pthread_mutex_lock(pthread_mutex_t *mutex);55extern "C" int __interceptor_pthread_mutex_unlock(pthread_mutex_t *mutex);56extern "C" int __interceptor_pthread_mutex_destroy(pthread_mutex_t *mutex);57extern "C" int __interceptor_pthread_mutex_trylock(pthread_mutex_t *mutex);58 59extern "C" int __interceptor_pthread_rwlock_init(60 pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr);61extern "C" int __interceptor_pthread_rwlock_destroy(pthread_rwlock_t *rwlock);62extern "C" int __interceptor_pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock);63extern "C" int __interceptor_pthread_rwlock_wrlock(pthread_rwlock_t *rwlock);64extern "C" int __interceptor_pthread_rwlock_unlock(pthread_rwlock_t *rwlock);65extern "C" int __interceptor_pthread_rwlock_rdlock(pthread_rwlock_t *rwlock);66extern "C" int __interceptor_pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock);67 68extern "C" int __interceptor_pthread_cond_init(pthread_cond_t *cond,69 const pthread_condattr_t *attr);70extern "C" int __interceptor_pthread_cond_signal(pthread_cond_t *cond);71extern "C" int __interceptor_pthread_cond_broadcast(pthread_cond_t *cond);72extern "C" int __interceptor_pthread_cond_wait(pthread_cond_t *cond,73 pthread_mutex_t *mutex);74extern "C" int __interceptor_pthread_cond_destroy(pthread_cond_t *cond);75 76#endif // #ifndef TSAN_POSIX_UTIL_H77