Remove gettid warning
[lttng-ust.git] / include / lttng / ust-tid.h
CommitLineData
d9ecffa9
MD
1#ifndef _LTTNG_UST_TID_H
2#define _LTTNG_UST_TID_H
3
4/*
5 * lttng/ust-tid.h
6 *
7 * Copyright 2012 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
9 * gettid compatibility layer.
10 *
11 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
12 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
13 *
14 * Permission is hereby granted to use or copy this program
15 * for any purpose, provided the above notices are retained on all copies.
16 * Permission to modify the code and to distribute modified code is granted,
17 * provided the above notices are retained, and a notice that the code was
18 * modified is included with the above copyright notice.
19 */
20
21#ifdef __linux__
22#include <syscall.h>
23#endif
24
25#if defined(_syscall0)
26_syscall0(pid_t, gettid)
27#elif defined(__NR_gettid)
28#include <unistd.h>
29static inline pid_t gettid(void)
30{
31 return syscall(__NR_gettid);
32}
33#else
34#include <sys/types.h>
35#include <unistd.h>
36
273973c0 37/* Fall-back on getpid for tid if not available. */
d9ecffa9
MD
38static inline pid_t gettid(void)
39{
40 return getpid();
41}
42#endif
43
44#endif /* _LTTNG_UST_TID_H */
This page took 0.023572 seconds and 4 git commands to generate.