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-exception
6//
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_H
15#define LSAN_POSIX_H
16
17#include "lsan_thread.h"
18#include "sanitizer_common/sanitizer_platform.h"
19
20#if !SANITIZER_POSIX
21#error "lsan_posix.h is used only on POSIX-like systems (SANITIZER_POSIX)"
22#endif
23
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, tid_t os_id,
45 ThreadType thread_type = ThreadType::Regular);
46
47} // namespace __lsan
48
49#endif // LSAN_POSIX_H
50