1 //===-- common_posix.cpp ---------------------------------*- 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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "gwp_asan/common.h"
10 
11 namespace gwp_asan {
12 
13 uint64_t getThreadID() {
14 #ifdef SYS_gettid
15   return syscall(SYS_gettid);
16 #else
17   return kInvalidThreadID;
18 #endif
19 }
20 
21 } // namespace gwp_asan
22