X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Ftid.h;h=4a6ff74c2954a2dbb53e842c600cb7c7513f573f;hb=e6a39346997db7e1d40026b2cc10be5893723eb3;hp=40f562f9749668f7f1ebbcea4b6e1d0513ca22c0;hpb=ffe600149a7608221985751e1bf293234bf2545c;p=lttng-tools.git diff --git a/src/common/compat/tid.h b/src/common/compat/tid.h index 40f562f97..4a6ff74c2 100644 --- a/src/common/compat/tid.h +++ b/src/common/compat/tid.h @@ -1,25 +1,8 @@ /* - * Copyright 2012 (c) - Mathieu Desnoyers + * Copyright 2012 (C) Mathieu Desnoyers * - * gettid compatibility layer. + * SPDX-License-Identifier: MIT * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. */ #ifndef LTTNG_TID_H @@ -29,23 +12,25 @@ #include #endif -#if defined(_syscall0) -_syscall0(pid_t, gettid) -#elif defined(__NR_gettid) +#if defined(__NR_gettid) + #include -static inline pid_t gettid(void) +static inline pid_t lttng_gettid(void) { return syscall(__NR_gettid); } + #else + #include #include /* Fall-back on getpid for tid if not available. */ -static inline pid_t gettid(void) +static inline pid_t lttng_gettid(void) { return getpid(); } + #endif #endif /* LTTNG_TID_H */