brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 7587a07 Raw
50 lines · c
1//=-- lsan_posix.h -----------------------------------------------------===//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 LeakSanitizer.10// Standalone LSan RTL code common to POSIX-like systems.11//12//===---------------------------------------------------------------------===//13 14#ifndef LSAN_POSIX_H15#define LSAN_POSIX_H16 17#include "lsan_thread.h"18#include "sanitizer_common/sanitizer_platform.h"19 20#if !SANITIZER_POSIX21#error "lsan_posix.h is used only on POSIX-like systems (SANITIZER_POSIX)"22#endif23 24namespace __sanitizer {25struct DTLS;26}27 28namespace __lsan {29 30class ThreadContext final : public ThreadContextLsanBase {31 public:32  explicit ThreadContext(int tid);33  void OnStarted(void *arg) override;34  uptr tls_begin() { return tls_begin_; }35  uptr tls_end() { return tls_end_; }36  DTLS *dtls() { return dtls_; }37 38 private:39  uptr tls_begin_ = 0;40  uptr tls_end_ = 0;41  DTLS *dtls_ = nullptr;42};43 44void ThreadStart(u32 tid, ThreadID os_id,45                 ThreadType thread_type = ThreadType::Regular);46 47}  // namespace __lsan48 49#endif  // LSAN_POSIX_H50