Commit | Line | Data |
---|---|---|
cb8d0d24 MJ |
1 | /* |
2 | * Copyright (C) 2020 Michael Jeanson <mjeanson@efficios.com> | |
3 | * | |
4 | * SPDX-License-Identifier: GPL-2.0-only | |
5 | * | |
6 | */ | |
7 | ||
8 | #ifndef _COMPAT_PTHREAD_H | |
9 | #define _COMPAT_PTHREAD_H | |
10 | ||
11 | #include <pthread.h> | |
8bd71dea | 12 | #include <errno.h> |
cb8d0d24 MJ |
13 | |
14 | #if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID) | |
15 | static inline | |
16 | int lttng_pthread_setname_np(const char *name) | |
17 | { | |
18 | return pthread_setname_np(pthread_self(), name); | |
19 | } | |
20 | #elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) | |
21 | static inline | |
22 | int lttng_pthread_setname_np(const char *name) | |
23 | { | |
24 | return pthread_setname_np(name); | |
25 | } | |
26 | #else | |
27 | /* | |
28 | * For platforms without thread name support, do nothing. | |
29 | */ | |
30 | static inline | |
31 | int lttng_pthread_setname_np(const char *name) | |
32 | { | |
33 | return -ENOSYS; | |
34 | } | |
35 | #endif | |
36 | ||
37 | #endif /* _COMPAT_PTHREAD_H */ |