Move liblttng-ust-dl to 'src/lib/'
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 9 Apr 2021 18:25:52 +0000 (14:25 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 13 Apr 2021 18:06:34 +0000 (14:06 -0400)
Move all public libraries under 'src/lib/'.

This is part of an effort to standardize our autotools setup across
projects to simplify maintenance.

Change-Id: I1e6a0597ed9ea79f661393a48f149a982f360d1d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 files changed:
.gitignore
configure.ac
src/Makefile.am
src/lib/Makefile.am
src/lib/lttng-ust-dl/Makefile.am [new file with mode: 0644]
src/lib/lttng-ust-dl/lttng-ust-dl.c [new file with mode: 0644]
src/lib/lttng-ust-dl/ust_dl.c [new file with mode: 0644]
src/lib/lttng-ust-dl/ust_dl.h [new file with mode: 0644]
src/liblttng-ust-dl/Makefile.am [deleted file]
src/liblttng-ust-dl/lttng-ust-dl.c [deleted file]
src/liblttng-ust-dl/ust_dl.c [deleted file]
src/liblttng-ust-dl/ust_dl.h [deleted file]

index 098b2277aaf9b2b7b6129ef26e405cb25956cdb8..88f36282e48cedc1909e887ff1a30a5109f4408b 100644 (file)
@@ -129,7 +129,7 @@ cscope.*
 /src/liblttng-ust-comm/Makefile
 /src/liblttng-ust-ctl/Makefile
 /src/lib/lttng-ust-cyg-profile/Makefile
-/src/liblttng-ust-dl/Makefile
+/src/lib/lttng-ust-dl/Makefile
 /src/lib/lttng-ust-fd/Makefile
 /src/lib/lttng-ust-fork/Makefile
 /src/liblttng-ust-java-agent/Makefile
index a75b323ee19e99cb369b7249e32343251bea11ae..8b6fb56251c204570ca775a68c1185212a56a32e 100644 (file)
@@ -523,7 +523,7 @@ AC_CONFIG_FILES([
   src/liblttng-ust-comm/Makefile
   src/liblttng-ust-ctl/Makefile
   src/lib/lttng-ust-cyg-profile/Makefile
-  src/liblttng-ust-dl/Makefile
+  src/lib/lttng-ust-dl/Makefile
   src/lib/lttng-ust-fd/Makefile
   src/lib/lttng-ust-fork/Makefile
   src/liblttng-ust-java-agent/java/lttng-ust-agent-all/Makefile
index 864808401e1c2d5b58e1dcf9d5d72ee8d6f01fa4..f51694ec2f4e198820372ce0be0b879f4938d72d 100644 (file)
@@ -9,10 +9,6 @@ SUBDIRS = \
        liblttng-ust-ctl \
        lib
 
-if ENABLE_UST_DL
-SUBDIRS += liblttng-ust-dl
-endif
-
 if ENABLE_JNI_INTERFACE
 SUBDIRS += liblttng-ust-java
 endif
index 0803fc00c46227dc2cf297512d9cde7c1364ea3c..0b33906e751615a085bfa1a8e61b90688a3eed75 100644 (file)
@@ -6,6 +6,10 @@ SUBDIRS = \
        lttng-ust-cyg-profile \
        lttng-ust-libc-wrapper
 
+if ENABLE_UST_DL
+SUBDIRS += lttng-ust-dl
+endif
+
 if ENABLE_PYTHON_AGENT
 SUBDIRS += lttng-ust-python-agent
 endif
diff --git a/src/lib/lttng-ust-dl/Makefile.am b/src/lib/lttng-ust-dl/Makefile.am
new file mode 100644 (file)
index 0000000..75149ea
--- /dev/null
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: LGPL-2.1-only
+
+AM_CFLAGS += -I$(srcdir) -fno-strict-aliasing
+
+lib_LTLIBRARIES = liblttng-ust-dl.la
+liblttng_ust_dl_la_SOURCES = \
+       lttng-ust-dl.c \
+       ust_dl.c \
+       ust_dl.h
+
+liblttng_ust_dl_la_LIBADD = \
+       $(top_builddir)/src/liblttng-ust/liblttng-ust.la \
+       $(top_builddir)/src/common/libcommon.la \
+       $(DL_LIBS)
+
+liblttng_ust_dl_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-dl $(AM_CFLAGS)
+liblttng_ust_dl_la_LDFLAGS = -version-info $(LTTNG_UST_LIBRARY_VERSION)
diff --git a/src/lib/lttng-ust-dl/lttng-ust-dl.c b/src/lib/lttng-ust-dl/lttng-ust-dl.c
new file mode 100644 (file)
index 0000000..62bda02
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ * 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 _LGPL_SOURCE
+
+/* Has to be included first to override dlfcn.h */
+#include <common/compat/dlfcn.h>
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "common/elf.h"
+#include <lttng/ust-events.h>
+#include "common/macros.h"
+#include "common/logging.h"
+
+#include "liblttng-ust/ust-events-internal.h"
+
+/* Include link.h last else it conflicts with ust-dlfcn. */
+#include <link.h>
+
+#define TRACEPOINT_DEFINE
+#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)
+{
+       if (!__lttng_ust_plibc_dlopen) {
+               __lttng_ust_plibc_dlopen = dlsym(RTLD_NEXT, "dlopen");
+               if (!__lttng_ust_plibc_dlopen) {
+                       fprintf(stderr, "%s\n", dlerror());
+                       return NULL;
+               }
+       }
+       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)
+{
+       if (!__lttng_ust_plibc_dlmopen) {
+               __lttng_ust_plibc_dlmopen = dlsym(RTLD_NEXT, "dlmopen");
+               if (!__lttng_ust_plibc_dlmopen) {
+                       fprintf(stderr, "%s\n", dlerror());
+                       return NULL;
+               }
+       }
+       return __lttng_ust_plibc_dlmopen(nsid, filename, flags);
+}
+#endif
+
+static
+int _lttng_ust_dl_libc_dlclose(void *handle)
+{
+       if (!__lttng_ust_plibc_dlclose) {
+               __lttng_ust_plibc_dlclose = dlsym(RTLD_NEXT, "dlclose");
+               if (!__lttng_ust_plibc_dlclose) {
+                       fprintf(stderr, "%s\n", dlerror());
+                       return -1;
+               }
+       }
+       return __lttng_ust_plibc_dlclose(handle);
+}
+
+static
+void lttng_ust_dl_dlopen(void *so_base, const char *so_name,
+               int flags, void *ip)
+{
+       char resolved_path[PATH_MAX];
+       struct lttng_ust_elf *elf;
+       uint64_t memsz;
+       uint8_t *build_id = NULL;
+       size_t build_id_len;
+       char *dbg_file = NULL;
+       uint32_t crc;
+       int has_build_id = 0, has_debug_link = 0;
+       int ret;
+
+       if (!realpath(so_name, resolved_path)) {
+               ERR("could not resolve path '%s'", so_name);
+               return;
+       }
+
+       elf = lttng_ust_elf_create(resolved_path);
+       if (!elf) {
+               ERR("could not access file %s", resolved_path);
+               return;
+       }
+
+       ret = lttng_ust_elf_get_memsz(elf, &memsz);
+       if (ret) {
+               goto end;
+       }
+       ret = lttng_ust_elf_get_build_id(
+               elf, &build_id, &build_id_len, &has_build_id);
+       if (ret) {
+               goto end;
+       }
+       ret = lttng_ust_elf_get_debug_link(
+               elf, &dbg_file, &crc, &has_debug_link);
+       if (ret) {
+               goto end;
+       }
+
+       tracepoint(lttng_ust_dl, dlopen,
+               ip, so_base, resolved_path, flags, memsz,
+               has_build_id, has_debug_link);
+
+       if (has_build_id) {
+               tracepoint(lttng_ust_dl, build_id,
+                       ip, so_base, build_id, build_id_len);
+       }
+
+       if (has_debug_link) {
+               tracepoint(lttng_ust_dl, debug_link,
+                       ip, so_base, dbg_file, crc);
+       }
+
+end:
+       free(dbg_file);
+       free(build_id);
+       lttng_ust_elf_destroy(elf);
+       return;
+}
+
+#ifdef HAVE_DLMOPEN
+static
+void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name,
+               int flags, void *ip)
+{
+       char resolved_path[PATH_MAX];
+       struct lttng_ust_elf *elf;
+       uint64_t memsz;
+       uint8_t *build_id = NULL;
+       size_t build_id_len;
+       char *dbg_file = NULL;
+       uint32_t crc;
+       int has_build_id = 0, has_debug_link = 0;
+       int ret;
+
+       if (!realpath(so_name, resolved_path)) {
+               ERR("could not resolve path '%s'", so_name);
+               return;
+       }
+
+       elf = lttng_ust_elf_create(resolved_path);
+       if (!elf) {
+               ERR("could not access file %s", resolved_path);
+               return;
+       }
+
+       ret = lttng_ust_elf_get_memsz(elf, &memsz);
+       if (ret) {
+               goto end;
+       }
+       ret = lttng_ust_elf_get_build_id(
+               elf, &build_id, &build_id_len, &has_build_id);
+       if (ret) {
+               goto end;
+       }
+       ret = lttng_ust_elf_get_debug_link(
+               elf, &dbg_file, &crc, &has_debug_link);
+       if (ret) {
+               goto end;
+       }
+
+       tracepoint(lttng_ust_dl, dlmopen,
+               ip, so_base, nsid, resolved_path, flags, memsz,
+               has_build_id, has_debug_link);
+
+       if (has_build_id) {
+               tracepoint(lttng_ust_dl, build_id,
+                       ip, so_base, build_id, build_id_len);
+       }
+
+       if (has_debug_link) {
+               tracepoint(lttng_ust_dl, debug_link,
+                       ip, so_base, dbg_file, crc);
+       }
+
+end:
+       free(dbg_file);
+       free(build_id);
+       lttng_ust_elf_destroy(elf);
+       return;
+}
+#endif
+
+void *dlopen(const char *filename, int flags)
+{
+       void *handle;
+
+       handle = _lttng_ust_dl_libc_dlopen(filename, flags);
+       if (__tracepoint_ptrs_registered && handle) {
+               struct link_map *p = NULL;
+               int ret;
+
+               ret = dlinfo(handle, RTLD_DI_LINKMAP, &p);
+               if (ret != -1 && p != NULL && p->l_addr != 0) {
+                       lttng_ust_dl_dlopen((void *) p->l_addr,
+                               p->l_name, flags, LTTNG_UST_CALLER_IP());
+               }
+       }
+       lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
+       return handle;
+}
+
+#ifdef HAVE_DLMOPEN
+void *dlmopen(Lmid_t nsid, const char *filename, int flags)
+{
+       void *handle;
+
+       handle = _lttng_ust_dl_libc_dlmopen(nsid, filename, flags);
+       if (__tracepoint_ptrs_registered && handle) {
+               struct link_map *p = NULL;
+               int ret;
+
+               ret = dlinfo(handle, RTLD_DI_LINKMAP, &p);
+               if (ret != -1 && p != NULL && p->l_addr != 0) {
+                       lttng_ust_dl_dlmopen((void *) p->l_addr,
+                               nsid, p->l_name, flags,
+                               LTTNG_UST_CALLER_IP());
+               }
+       }
+       lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
+       return handle;
+
+}
+#endif
+
+int dlclose(void *handle)
+{
+       int ret;
+
+       if (__tracepoint_ptrs_registered) {
+               struct link_map *p = NULL;
+
+               ret = dlinfo(handle, RTLD_DI_LINKMAP, &p);
+               if (ret != -1 && p != NULL && p->l_addr != 0) {
+                       tracepoint(lttng_ust_dl, dlclose,
+                               LTTNG_UST_CALLER_IP(),
+                               (void *) p->l_addr);
+               }
+       }
+       ret = _lttng_ust_dl_libc_dlclose(handle);
+       lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
+       return ret;
+}
diff --git a/src/lib/lttng-ust-dl/ust_dl.c b/src/lib/lttng-ust-dl/ust_dl.c
new file mode 100644 (file)
index 0000000..b35ed62
--- /dev/null
@@ -0,0 +1,10 @@
+/*
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * Copyright (C) 2013 Paul Woegerer <paul_woegerer@mentor.com>
+ */
+
+#define _LGPL_SOURCE
+#define TRACEPOINT_CREATE_PROBES
+#define TP_IP_PARAM ip
+#include "ust_dl.h"
diff --git a/src/lib/lttng-ust-dl/ust_dl.h b/src/lib/lttng-ust-dl/ust_dl.h
new file mode 100644 (file)
index 0000000..7f618da
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright (C) 2013 Paul Woegerer <paul_woegerer@mentor.com>
+ * Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+ */
+
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER lttng_ust_dl
+
+#if !defined(_TRACEPOINT_UST_DL_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TRACEPOINT_UST_DL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#define LTTNG_UST_DL_PROVIDER
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(lttng_ust_dl, dlopen,
+       TP_ARGS(void *, ip, void *, baddr, const char *, path,
+               int, flags, uint64_t, memsz, uint8_t, has_build_id,
+               uint8_t, has_debug_link),
+       TP_FIELDS(
+               ctf_unused(ip)
+               ctf_integer_hex(void *, baddr, baddr)
+               ctf_integer(uint64_t, memsz, memsz)
+               ctf_integer_hex(int, flags, flags)
+               ctf_string(path, path)
+               ctf_integer(uint8_t, has_build_id, has_build_id)
+               ctf_integer(uint8_t, has_debug_link, has_debug_link)
+       )
+)
+
+#ifdef HAVE_DLMOPEN
+TRACEPOINT_EVENT(lttng_ust_dl, dlmopen,
+       TP_ARGS(void *, ip, void *, baddr, Lmid_t, nsid,
+               const char *, path, int, flags,
+               uint64_t, memsz, uint8_t, has_build_id,
+               uint8_t, has_debug_link),
+       TP_FIELDS(
+               ctf_unused(ip)
+               ctf_integer_hex(void *, baddr, baddr)
+               ctf_integer(uint64_t, memsz, memsz)
+               ctf_integer(Lmid_t, nsid, nsid)
+               ctf_integer_hex(int, flags, flags)
+               ctf_string(path, path)
+               ctf_integer(uint8_t, has_build_id, has_build_id)
+               ctf_integer(uint8_t, has_debug_link, has_debug_link)
+       )
+)
+#endif
+
+TRACEPOINT_EVENT(lttng_ust_dl, build_id,
+       TP_ARGS(
+               void *, ip,
+               void *, baddr,
+               uint8_t *, build_id,
+               size_t, build_id_len
+       ),
+       TP_FIELDS(
+               ctf_unused(ip)
+               ctf_integer_hex(void *, baddr, baddr)
+               ctf_sequence_hex(uint8_t, build_id, build_id,
+                       size_t, build_id_len)
+       )
+)
+
+TRACEPOINT_EVENT(lttng_ust_dl, debug_link,
+       TP_ARGS(
+               void *, ip,
+               void *, baddr,
+               char *, filename,
+               uint32_t, crc
+       ),
+       TP_FIELDS(
+               ctf_unused(ip)
+               ctf_integer_hex(void *, baddr, baddr)
+               ctf_integer(uint32_t, crc, crc)
+               ctf_string(filename, filename)
+       )
+)
+
+TRACEPOINT_EVENT(lttng_ust_dl, dlclose,
+       TP_ARGS(void *, ip, void *, baddr),
+       TP_FIELDS(
+               ctf_unused(ip)
+               ctf_integer_hex(void *, baddr, baddr)
+       )
+)
+
+#endif /* _TRACEPOINT_UST_DL_H */
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./ust_dl.h"
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/liblttng-ust-dl/Makefile.am b/src/liblttng-ust-dl/Makefile.am
deleted file mode 100644 (file)
index 75149ea..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-only
-
-AM_CFLAGS += -I$(srcdir) -fno-strict-aliasing
-
-lib_LTLIBRARIES = liblttng-ust-dl.la
-liblttng_ust_dl_la_SOURCES = \
-       lttng-ust-dl.c \
-       ust_dl.c \
-       ust_dl.h
-
-liblttng_ust_dl_la_LIBADD = \
-       $(top_builddir)/src/liblttng-ust/liblttng-ust.la \
-       $(top_builddir)/src/common/libcommon.la \
-       $(DL_LIBS)
-
-liblttng_ust_dl_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-dl $(AM_CFLAGS)
-liblttng_ust_dl_la_LDFLAGS = -version-info $(LTTNG_UST_LIBRARY_VERSION)
diff --git a/src/liblttng-ust-dl/lttng-ust-dl.c b/src/liblttng-ust-dl/lttng-ust-dl.c
deleted file mode 100644 (file)
index 6444e3f..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- * 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 _LGPL_SOURCE
-
-/* Has to be included first to override dlfcn.h */
-#include <common/compat/dlfcn.h>
-
-#include <limits.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include "common/elf.h"
-#include <lttng/ust-events.h>
-#include "common/macros.h"
-#include "common/logging.h"
-
-#include "../liblttng-ust/ust-events-internal.h"
-
-/* Include link.h last else it conflicts with ust-dlfcn. */
-#include <link.h>
-
-#define TRACEPOINT_DEFINE
-#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)
-{
-       if (!__lttng_ust_plibc_dlopen) {
-               __lttng_ust_plibc_dlopen = dlsym(RTLD_NEXT, "dlopen");
-               if (!__lttng_ust_plibc_dlopen) {
-                       fprintf(stderr, "%s\n", dlerror());
-                       return NULL;
-               }
-       }
-       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)
-{
-       if (!__lttng_ust_plibc_dlmopen) {
-               __lttng_ust_plibc_dlmopen = dlsym(RTLD_NEXT, "dlmopen");
-               if (!__lttng_ust_plibc_dlmopen) {
-                       fprintf(stderr, "%s\n", dlerror());
-                       return NULL;
-               }
-       }
-       return __lttng_ust_plibc_dlmopen(nsid, filename, flags);
-}
-#endif
-
-static
-int _lttng_ust_dl_libc_dlclose(void *handle)
-{
-       if (!__lttng_ust_plibc_dlclose) {
-               __lttng_ust_plibc_dlclose = dlsym(RTLD_NEXT, "dlclose");
-               if (!__lttng_ust_plibc_dlclose) {
-                       fprintf(stderr, "%s\n", dlerror());
-                       return -1;
-               }
-       }
-       return __lttng_ust_plibc_dlclose(handle);
-}
-
-static
-void lttng_ust_dl_dlopen(void *so_base, const char *so_name,
-               int flags, void *ip)
-{
-       char resolved_path[PATH_MAX];
-       struct lttng_ust_elf *elf;
-       uint64_t memsz;
-       uint8_t *build_id = NULL;
-       size_t build_id_len;
-       char *dbg_file = NULL;
-       uint32_t crc;
-       int has_build_id = 0, has_debug_link = 0;
-       int ret;
-
-       if (!realpath(so_name, resolved_path)) {
-               ERR("could not resolve path '%s'", so_name);
-               return;
-       }
-
-       elf = lttng_ust_elf_create(resolved_path);
-       if (!elf) {
-               ERR("could not access file %s", resolved_path);
-               return;
-       }
-
-       ret = lttng_ust_elf_get_memsz(elf, &memsz);
-       if (ret) {
-               goto end;
-       }
-       ret = lttng_ust_elf_get_build_id(
-               elf, &build_id, &build_id_len, &has_build_id);
-       if (ret) {
-               goto end;
-       }
-       ret = lttng_ust_elf_get_debug_link(
-               elf, &dbg_file, &crc, &has_debug_link);
-       if (ret) {
-               goto end;
-       }
-
-       tracepoint(lttng_ust_dl, dlopen,
-               ip, so_base, resolved_path, flags, memsz,
-               has_build_id, has_debug_link);
-
-       if (has_build_id) {
-               tracepoint(lttng_ust_dl, build_id,
-                       ip, so_base, build_id, build_id_len);
-       }
-
-       if (has_debug_link) {
-               tracepoint(lttng_ust_dl, debug_link,
-                       ip, so_base, dbg_file, crc);
-       }
-
-end:
-       free(dbg_file);
-       free(build_id);
-       lttng_ust_elf_destroy(elf);
-       return;
-}
-
-#ifdef HAVE_DLMOPEN
-static
-void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name,
-               int flags, void *ip)
-{
-       char resolved_path[PATH_MAX];
-       struct lttng_ust_elf *elf;
-       uint64_t memsz;
-       uint8_t *build_id = NULL;
-       size_t build_id_len;
-       char *dbg_file = NULL;
-       uint32_t crc;
-       int has_build_id = 0, has_debug_link = 0;
-       int ret;
-
-       if (!realpath(so_name, resolved_path)) {
-               ERR("could not resolve path '%s'", so_name);
-               return;
-       }
-
-       elf = lttng_ust_elf_create(resolved_path);
-       if (!elf) {
-               ERR("could not access file %s", resolved_path);
-               return;
-       }
-
-       ret = lttng_ust_elf_get_memsz(elf, &memsz);
-       if (ret) {
-               goto end;
-       }
-       ret = lttng_ust_elf_get_build_id(
-               elf, &build_id, &build_id_len, &has_build_id);
-       if (ret) {
-               goto end;
-       }
-       ret = lttng_ust_elf_get_debug_link(
-               elf, &dbg_file, &crc, &has_debug_link);
-       if (ret) {
-               goto end;
-       }
-
-       tracepoint(lttng_ust_dl, dlmopen,
-               ip, so_base, nsid, resolved_path, flags, memsz,
-               has_build_id, has_debug_link);
-
-       if (has_build_id) {
-               tracepoint(lttng_ust_dl, build_id,
-                       ip, so_base, build_id, build_id_len);
-       }
-
-       if (has_debug_link) {
-               tracepoint(lttng_ust_dl, debug_link,
-                       ip, so_base, dbg_file, crc);
-       }
-
-end:
-       free(dbg_file);
-       free(build_id);
-       lttng_ust_elf_destroy(elf);
-       return;
-}
-#endif
-
-void *dlopen(const char *filename, int flags)
-{
-       void *handle;
-
-       handle = _lttng_ust_dl_libc_dlopen(filename, flags);
-       if (__tracepoint_ptrs_registered && handle) {
-               struct link_map *p = NULL;
-               int ret;
-
-               ret = dlinfo(handle, RTLD_DI_LINKMAP, &p);
-               if (ret != -1 && p != NULL && p->l_addr != 0) {
-                       lttng_ust_dl_dlopen((void *) p->l_addr,
-                               p->l_name, flags, LTTNG_UST_CALLER_IP());
-               }
-       }
-       lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
-       return handle;
-}
-
-#ifdef HAVE_DLMOPEN
-void *dlmopen(Lmid_t nsid, const char *filename, int flags)
-{
-       void *handle;
-
-       handle = _lttng_ust_dl_libc_dlmopen(nsid, filename, flags);
-       if (__tracepoint_ptrs_registered && handle) {
-               struct link_map *p = NULL;
-               int ret;
-
-               ret = dlinfo(handle, RTLD_DI_LINKMAP, &p);
-               if (ret != -1 && p != NULL && p->l_addr != 0) {
-                       lttng_ust_dl_dlmopen((void *) p->l_addr,
-                               nsid, p->l_name, flags,
-                               LTTNG_UST_CALLER_IP());
-               }
-       }
-       lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
-       return handle;
-
-}
-#endif
-
-int dlclose(void *handle)
-{
-       int ret;
-
-       if (__tracepoint_ptrs_registered) {
-               struct link_map *p = NULL;
-
-               ret = dlinfo(handle, RTLD_DI_LINKMAP, &p);
-               if (ret != -1 && p != NULL && p->l_addr != 0) {
-                       tracepoint(lttng_ust_dl, dlclose,
-                               LTTNG_UST_CALLER_IP(),
-                               (void *) p->l_addr);
-               }
-       }
-       ret = _lttng_ust_dl_libc_dlclose(handle);
-       lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
-       return ret;
-}
diff --git a/src/liblttng-ust-dl/ust_dl.c b/src/liblttng-ust-dl/ust_dl.c
deleted file mode 100644 (file)
index b35ed62..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * SPDX-License-Identifier: LGPL-2.1-or-later
- *
- * Copyright (C) 2013 Paul Woegerer <paul_woegerer@mentor.com>
- */
-
-#define _LGPL_SOURCE
-#define TRACEPOINT_CREATE_PROBES
-#define TP_IP_PARAM ip
-#include "ust_dl.h"
diff --git a/src/liblttng-ust-dl/ust_dl.h b/src/liblttng-ust-dl/ust_dl.h
deleted file mode 100644 (file)
index 7f618da..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * Copyright (C) 2013 Paul Woegerer <paul_woegerer@mentor.com>
- * Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
- */
-
-#undef TRACEPOINT_PROVIDER
-#define TRACEPOINT_PROVIDER lttng_ust_dl
-
-#if !defined(_TRACEPOINT_UST_DL_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
-#define _TRACEPOINT_UST_DL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stddef.h>
-#include <stdint.h>
-#include <unistd.h>
-
-#define LTTNG_UST_DL_PROVIDER
-#include <lttng/tracepoint.h>
-
-TRACEPOINT_EVENT(lttng_ust_dl, dlopen,
-       TP_ARGS(void *, ip, void *, baddr, const char *, path,
-               int, flags, uint64_t, memsz, uint8_t, has_build_id,
-               uint8_t, has_debug_link),
-       TP_FIELDS(
-               ctf_unused(ip)
-               ctf_integer_hex(void *, baddr, baddr)
-               ctf_integer(uint64_t, memsz, memsz)
-               ctf_integer_hex(int, flags, flags)
-               ctf_string(path, path)
-               ctf_integer(uint8_t, has_build_id, has_build_id)
-               ctf_integer(uint8_t, has_debug_link, has_debug_link)
-       )
-)
-
-#ifdef HAVE_DLMOPEN
-TRACEPOINT_EVENT(lttng_ust_dl, dlmopen,
-       TP_ARGS(void *, ip, void *, baddr, Lmid_t, nsid,
-               const char *, path, int, flags,
-               uint64_t, memsz, uint8_t, has_build_id,
-               uint8_t, has_debug_link),
-       TP_FIELDS(
-               ctf_unused(ip)
-               ctf_integer_hex(void *, baddr, baddr)
-               ctf_integer(uint64_t, memsz, memsz)
-               ctf_integer(Lmid_t, nsid, nsid)
-               ctf_integer_hex(int, flags, flags)
-               ctf_string(path, path)
-               ctf_integer(uint8_t, has_build_id, has_build_id)
-               ctf_integer(uint8_t, has_debug_link, has_debug_link)
-       )
-)
-#endif
-
-TRACEPOINT_EVENT(lttng_ust_dl, build_id,
-       TP_ARGS(
-               void *, ip,
-               void *, baddr,
-               uint8_t *, build_id,
-               size_t, build_id_len
-       ),
-       TP_FIELDS(
-               ctf_unused(ip)
-               ctf_integer_hex(void *, baddr, baddr)
-               ctf_sequence_hex(uint8_t, build_id, build_id,
-                       size_t, build_id_len)
-       )
-)
-
-TRACEPOINT_EVENT(lttng_ust_dl, debug_link,
-       TP_ARGS(
-               void *, ip,
-               void *, baddr,
-               char *, filename,
-               uint32_t, crc
-       ),
-       TP_FIELDS(
-               ctf_unused(ip)
-               ctf_integer_hex(void *, baddr, baddr)
-               ctf_integer(uint32_t, crc, crc)
-               ctf_string(filename, filename)
-       )
-)
-
-TRACEPOINT_EVENT(lttng_ust_dl, dlclose,
-       TP_ARGS(void *, ip, void *, baddr),
-       TP_FIELDS(
-               ctf_unused(ip)
-               ctf_integer_hex(void *, baddr, baddr)
-       )
-)
-
-#endif /* _TRACEPOINT_UST_DL_H */
-
-#undef TRACEPOINT_INCLUDE
-#define TRACEPOINT_INCLUDE "./ust_dl.h"
-
-/* This part must be outside ifdef protection */
-#include <lttng/tracepoint-event.h>
-
-#ifdef __cplusplus
-}
-#endif
This page took 0.036148 seconds and 4 git commands to generate.