Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
# Checks for libraries.
AC_CHECK_LIB([dl], [dlopen], [
have_libdl=yes
# Checks for libraries.
AC_CHECK_LIB([dl], [dlopen], [
have_libdl=yes
], [
#libdl not found, check for dlopen in libc.
AC_CHECK_LIB([c], [dlopen], [
have_libc_dl=yes
], [
#libdl not found, check for dlopen in libc.
AC_CHECK_LIB([c], [dlopen], [
have_libc_dl=yes
], [
AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
])
])
], [
AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
])
])
+# Check if libdl has dlmopen support.
+AH_TEMPLATE([HAVE_DLMOPEN], ["Define to 1 if dlmopen is available."])
+AC_CHECK_LIB([$libdl_name], [dlmopen],
+ [AC_DEFINE([HAVE_DLMOPEN], [1])]
+)
+
AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"])
AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"])
#include "ust_dl.h"
static void *(*__lttng_ust_plibc_dlopen)(const char *filename, int flags);
#include "ust_dl.h"
static void *(*__lttng_ust_plibc_dlopen)(const char *filename, int flags);
static void *(*__lttng_ust_plibc_dlmopen)(Lmid_t nsid, const char *filename,
int flags);
static void *(*__lttng_ust_plibc_dlmopen)(Lmid_t nsid, const char *filename,
int flags);
static int (*__lttng_ust_plibc_dlclose)(void *handle);
static
static int (*__lttng_ust_plibc_dlclose)(void *handle);
static
return __lttng_ust_plibc_dlopen(filename, flags);
}
return __lttng_ust_plibc_dlopen(filename, flags);
}
static
void *_lttng_ust_dl_libc_dlmopen(Lmid_t nsid, const char *filename,
int flags)
static
void *_lttng_ust_dl_libc_dlmopen(Lmid_t nsid, const char *filename,
int flags)
}
return __lttng_ust_plibc_dlmopen(nsid, filename, flags);
}
}
return __lttng_ust_plibc_dlmopen(nsid, filename, flags);
}
static
int _lttng_ust_dl_libc_dlclose(void *handle)
static
int _lttng_ust_dl_libc_dlclose(void *handle)
static
void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name,
int flags, void *ip)
static
void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name,
int flags, void *ip)
lttng_ust_elf_destroy(elf);
return;
}
lttng_ust_elf_destroy(elf);
return;
}
void *dlopen(const char *filename, int flags)
{
void *dlopen(const char *filename, int flags)
{
void *dlmopen(Lmid_t nsid, const char *filename, int flags)
{
void *handle;
void *dlmopen(Lmid_t nsid, const char *filename, int flags)
{
void *handle;
int dlclose(void *handle)
{
int dlclose(void *handle)
{
TRACEPOINT_EVENT(lttng_ust_dl, dlmopen,
TP_ARGS(void *, ip, void *, baddr, Lmid_t, nsid,
const char *, path, int, flags,
TRACEPOINT_EVENT(lttng_ust_dl, dlmopen,
TP_ARGS(void *, ip, void *, baddr, Lmid_t, nsid,
const char *, path, int, flags,
ctf_integer(uint8_t, has_debug_link, has_debug_link)
)
)
ctf_integer(uint8_t, has_debug_link, has_debug_link)
)
)
TRACEPOINT_EVENT(lttng_ust_dl, build_id,
TP_ARGS(
TRACEPOINT_EVENT(lttng_ust_dl, build_id,
TP_ARGS(