/*
- * Copyright (C) 2013 Paul Woegerer <paul.woegerer@mentor.com>
- * Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
- * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * 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 <paul.woegerer@mentor.com>
+ * Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+ * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*/
-#define _GNU_SOURCE
#define _LGPL_SOURCE
#include <limits.h>
#include <stdio.h>
+#include <stdint.h>
#include <sys/types.h>
#include <unistd.h>
-#include <lttng/ust-dlfcn.h>
-#include <lttng/ust-elf.h>
+#include <ust-dlfcn.h>
+#include <ust-elf.h>
#include <lttng/ust-events.h>
-#include <helper.h>
+#include <ust-helper.h>
#include "usterr-signal-safe.h"
+#include "../liblttng-ust/ust-events-internal.h"
+
/* Include link.h last else it conflicts with ust-dlfcn. */
#include <link.h>
#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
+void _lttng_ust_dl_init(void)
+ __attribute__((constructor));
+static
+void _lttng_ust_dl_init(void)
+{
+ ust_err_init();
+}
+
static
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)
}
return __lttng_ust_plibc_dlmopen(nsid, filename, flags);
}
+#endif
static
int _lttng_ust_dl_libc_dlclose(void *handle)
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;
}
return;
}
+#ifdef HAVE_DLMOPEN
static
void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name,
int flags, void *ip)
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;
}
lttng_ust_elf_destroy(elf);
return;
}
+#endif
void *dlopen(const char *filename, int flags)
{
return handle;
}
+#ifdef HAVE_DLMOPEN
void *dlmopen(Lmid_t nsid, const char *filename, int flags)
{
void *handle;
return handle;
}
+#endif
int dlclose(void *handle)
{