src/common: use single Makefile for parallel builds
[lttng-tools.git] / src / common / compat / tid.h
1 /*
2 * Copyright 2012 (C) Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #ifndef LTTNG_TID_H
9 #define LTTNG_TID_H
10
11 #ifdef __linux__
12 #include <syscall.h>
13 #endif
14
15 #if defined(__NR_gettid)
16
17 #include <unistd.h>
18 static inline pid_t lttng_gettid(void)
19 {
20 return syscall(__NR_gettid);
21 }
22
23 #else
24
25 #include <sys/types.h>
26 #include <unistd.h>
27
28 /* Fall-back on getpid for tid if not available. */
29 static inline pid_t lttng_gettid(void)
30 {
31 return getpid();
32 }
33
34 #endif
35
36 #endif /* LTTNG_TID_H */
This page took 0.031007 seconds and 4 git commands to generate.