X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=liblttng-ust-dl%2Flttng-ust-dl.c;h=b2e43b9613847318839bfb3e0eb82abfcccb871a;hb=7ee76145ae6a7efc03968571b9e4a22d46e92929;hp=b0737b65f9f4222d6beef931b7ce3a07eef0ea1c;hpb=7b0fdd83c137bea1d7302df1a45252dfdccd8172;p=lttng-ust.git diff --git a/liblttng-ust-dl/lttng-ust-dl.c b/liblttng-ust-dl/lttng-ust-dl.c index b0737b65..b2e43b96 100644 --- a/liblttng-ust-dl/lttng-ust-dl.c +++ b/liblttng-ust-dl/lttng-ust-dl.c @@ -1,34 +1,22 @@ /* - * Copyright (C) 2013 Paul Woegerer - * Copyright (C) 2015 Antoine Busque - * Copyright (C) 2016 Mathieu Desnoyers + * SPDX-License-Identifier: LGPL-2.1-only * - * 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; 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 + * Copyright (C) 2013 Paul Woegerer + * Copyright (C) 2015 Antoine Busque + * Copyright (C) 2016 Mathieu Desnoyers */ -#define _GNU_SOURCE #define _LGPL_SOURCE #include #include +#include #include #include -#include +#include #include #include -#include +#include #include "usterr-signal-safe.h" /* Include link.h last else it conflicts with ust-dlfcn. */ @@ -38,10 +26,18 @@ #include "ust_dl.h" static void *(*__lttng_ust_plibc_dlopen)(const char *filename, int flags); +#ifdef HAVE_DLMOPEN static void *(*__lttng_ust_plibc_dlmopen)(Lmid_t nsid, const char *filename, int flags); +#endif static int (*__lttng_ust_plibc_dlclose)(void *handle); +static __attribute__((constructor)) +void _lttng_ust_dl_init(void) +{ + ust_err_init(); +} + static void *_lttng_ust_dl_libc_dlopen(const char *filename, int flags) { @@ -55,6 +51,7 @@ void *_lttng_ust_dl_libc_dlopen(const char *filename, int flags) return __lttng_ust_plibc_dlopen(filename, flags); } +#ifdef HAVE_DLMOPEN static void *_lttng_ust_dl_libc_dlmopen(Lmid_t nsid, const char *filename, int flags) @@ -68,6 +65,7 @@ void *_lttng_ust_dl_libc_dlmopen(Lmid_t nsid, const char *filename, } return __lttng_ust_plibc_dlmopen(nsid, filename, flags); } +#endif static int _lttng_ust_dl_libc_dlclose(void *handle) @@ -103,7 +101,7 @@ void lttng_ust_dl_dlopen(void *so_base, const char *so_name, elf = lttng_ust_elf_create(resolved_path); if (!elf) { - ERR("could not acces file %s", resolved_path); + ERR("could not access file %s", resolved_path); return; } @@ -143,6 +141,7 @@ end: return; } +#ifdef HAVE_DLMOPEN static void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name, int flags, void *ip) @@ -164,7 +163,7 @@ void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name, elf = lttng_ust_elf_create(resolved_path); if (!elf) { - ERR("could not acces file %s", resolved_path); + ERR("could not access file %s", resolved_path); return; } @@ -203,6 +202,7 @@ end: lttng_ust_elf_destroy(elf); return; } +#endif void *dlopen(const char *filename, int flags) { @@ -223,6 +223,7 @@ void *dlopen(const char *filename, int flags) return handle; } +#ifdef HAVE_DLMOPEN void *dlmopen(Lmid_t nsid, const char *filename, int flags) { void *handle; @@ -243,6 +244,7 @@ void *dlmopen(Lmid_t nsid, const char *filename, int flags) return handle; } +#endif int dlclose(void *handle) {