X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-context-vtid.c;h=ea153fe27b688155d5fa253a7d9d593c9085c878;hb=bf5ff35ed0a3a7f60e92d654a5b97e73b94da852;hp=6f7e078d22d2910072748adfd0ee59b8c9a695b4;hpb=aab17bfec51be0eb306ff1197a38d8acc5e877a3;p=lttng-ust.git diff --git a/liblttng-ust/lttng-context-vtid.c b/liblttng-ust/lttng-context-vtid.c index 6f7e078d..ea153fe2 100644 --- a/liblttng-ust/lttng-context-vtid.c +++ b/liblttng-ust/lttng-context-vtid.c @@ -1,10 +1,23 @@ /* - * (C) Copyright 2009-2011 - - * Mathieu Desnoyers + * lttng-context-vtid.c * * LTTng UST vtid context. * - * Dual LGPL v2.1/GPL v2 license. + * Copyright (C) 2009-2012 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; only + * version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -12,25 +25,8 @@ #include #include #include - -#ifdef __linux__ -#include -#endif - -#if defined(_syscall0) -_syscall0(pid_t, gettid) -#elif defined(__NR_gettid) -static inline pid_t gettid(void) -{ - return syscall(__NR_gettid); -} -#else -#warning "use pid as tid" -static inline pid_t gettid(void) -{ - return getpid(); -} -#endif +#include "ltt-tracer-core.h" +#include /* * We cache the result to ensure we don't trigger a system call for @@ -92,3 +88,11 @@ int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx) field->record = vtid_record; return 0; } + +/* + * Force a read (imply TLS fixup for dlopen) of TLS variables. + */ +void lttng_fixup_vtid_tls(void) +{ + asm volatile ("" : : "m" (cached_vtid)); +}