X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-context-vtid.c;h=dd443774d4c9ef35386cda1d1c4f3e067682a381;hb=refs%2Fheads%2Fstable-2.1;hp=3fe86405c112307a47e6c1abe0a9c62fe8b2175b;hpb=49c0da7df5e7bd32c06d69822e9b92120bf4d392;p=lttng-ust.git diff --git a/liblttng-ust/lttng-context-vtid.c b/liblttng-ust/lttng-context-vtid.c index 3fe86405..dd443774 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 @@ -13,6 +26,7 @@ #include #include #include +#include "lttng-tracer-core.h" /* * We cache the result to ensure we don't trigger a system call for @@ -43,7 +57,7 @@ size_t vtid_get_size(size_t offset) static void vtid_record(struct lttng_ctx_field *field, struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct ltt_channel *chan) + struct lttng_channel *chan) { if (caa_unlikely(!cached_vtid)) cached_vtid = gettid(); @@ -74,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)); +}