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