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#include <sys/syscall.h>
12#include <unistd.h>
13
14namespace gwp_asan {
15
16uint64_t getThreadID() {
17#ifdef SYS_gettid
18  return syscall(SYS_gettid);
19#else
20  return kInvalidThreadID;
21#endif
22}
23
24} // namespace gwp_asan
25