Subject: [alpine-aports] [PATCH] testing/lttng-ust: upgrade to 2.9.0

From: Michael Jeanson <[email-masked]>
Date: Fri, 2 Dec 2016 14:35:43 -0500

---
 testing/lttng-ust/APKBUILD                  |  14 ++-
 testing/lttng-ust/musl-has-no-dlmopen.patch | 153 ++++++++++++++++++++++++++++
 2 files changed, 162 insertions(+), 5 deletions(-)
 create mode 100644 testing/lttng-ust/musl-has-no-dlmopen.patch

diff --git a/testing/lttng-ust/APKBUILD b/testing/lttng-ust/APKBUILD
index a12ff7a3da..259b680015 100644
--- a/testing/lttng-ust/APKBUILD
+++ b/testing/lttng-ust/APKBUILD
@@ -1,7 +1,7 @@
 # Contributor: Michael Jeanson <[email-masked]>
 # Maintainer: Michael Jeanson <[email-masked]>
 pkgname=lttng-ust
-pkgver=2.8.1
+pkgver=2.9.0
 pkgrel=0
 pkgdesc="LTTng 2.0 Userspace Tracer"
 url="https://lttng.org"
@@ -12,7 +12,8 @@ depends_dev=""
 makedepends="$depends_dev userspace-rcu-dev util-linux-dev bash"
 install=""
 subpackages="$pkgname-dev $pkgname-doc"
-source="https://lttng.org/files/$pkgname/$pkgname-$pkgver.tar.bz2"
+source="https://lttng.org/files/$pkgname/$pkgname-$pkgver.tar.bz2
+        musl-has-no-dlmopen.patch"
 
 builddir="$srcdir"/$pkgname-$pkgver
 
@@ -42,6 +43,9 @@ dev() {
 	rm -rf "$subpkgdir"/usr/share/doc/$pkgname
 }
 
-md5sums="be505077245dc05f93370a565eec15f4  lttng-ust-2.8.1.tar.bz2"
-sha256sums="6e41349107e83e7b43c69ed358e48788ca2fd095bad61737b850e3f3d2c0508a  lttng-ust-2.8.1.tar.bz2"
-sha512sums="15c459620cb73ef5be8c7df2ef02663ef650555b973a3d1ed976ae38068b53a8c83143a611bcb53e91a3f211361c44cd2a331cb41dd53d28a69924f7ac44cc95  lttng-ust-2.8.1.tar.bz2"
+md5sums="77f3378ba37a36801420bce87b702e9c  lttng-ust-2.9.0.tar.bz2
+90cb166ae29bd68b71f016a7d8144853  musl-has-no-dlmopen.patch"
+sha256sums="4d541a863f42dfc685ca05024027a442c70d03594c154a43e62bc109b1ea5daf  lttng-ust-2.9.0.tar.bz2
+10011dc0d8c300400c5da86867912f3600d5c40a1d45e20fd6cd544c860b4e85  musl-has-no-dlmopen.patch"
+sha512sums="72cbc167918d7675f86314dd9ecca91bfbf2a0c94e8befecc03633296a3d071049ab9dccd9f75e03e67b95518a8917096652d90c88e0daf17fe6b31b2df28d17  lttng-ust-2.9.0.tar.bz2
+1b5d88ac0fe340b93fe0e1b391e63d069d104bf11e8b418a594a3e50eb6266aea51daeb36dbda8d39b862bd71bce4146c90fd3a9f7b878754b27b676d149f8e8  musl-has-no-dlmopen.patch"
diff --git a/testing/lttng-ust/musl-has-no-dlmopen.patch b/testing/lttng-ust/musl-has-no-dlmopen.patch
new file mode 100644
index 0000000000..3e2fcc0b77
--- /dev/null
+++ b/testing/lttng-ust/musl-has-no-dlmopen.patch
@@ -0,0 +1,153 @@
+--- ./lttng-ust-2.9.0.orig/liblttng-ust-dl/lttng-ust-dl.c
++++ lttng-ust-2.9.0/liblttng-ust-dl/lttng-ust-dl.c
+@@ -38,8 +38,6 @@
+ #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 int (*__lttng_ust_plibc_dlclose)(void *handle);
+ 
+ static
+@@ -56,20 +54,6 @@
+ }
+ 
+ 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);
+-}
+-
+-static
+ int _lttng_ust_dl_libc_dlclose(void *handle)
+ {
+ 	if (!__lttng_ust_plibc_dlclose) {
+@@ -143,67 +127,6 @@
+ 	return;
+ }
+ 
+-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 acces 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;
+-}
+-
+ void *dlopen(const char *filename, int flags)
+ {
+ 	void *handle;
+@@ -221,27 +144,6 @@
+ 	}
+ 	lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
+ 	return handle;
+-}
+-
+-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;
+-
+ }
+ 
+ int dlclose(void *handle)
+--- ./lttng-ust-2.9.0.orig/liblttng-ust-dl/ust_dl.h
++++ lttng-ust-2.9.0/liblttng-ust-dl/ust_dl.h
+@@ -51,22 +51,6 @@
+ 	)
+ )
+ 
+-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_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)
+-	)
+-)
+-
+ TRACEPOINT_EVENT(lttng_ust_dl, build_id,
+ 	TP_ARGS(
+ 		void *, ip,
-- 
2.11.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---