~alpine/aports

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

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

Michael Jeanson <mjeanson@efficios.com>
Details
Message ID
<20161202212553.15312-1-mjeanson@efficios.com>
Sender timestamp
1480713953
DKIM signature
missing
Download raw message
Patch: +71 -584
---
 ...Fix-snapshot-del-output-with-name-on-musl.patch |  11 -
 .../0003-Fix-error.h-common-error.h.patch          |  26 --
 ...Fix-strerror_r-behavior-is-glibc-specific.patch |  26 --
 ...8-Fix-missing-include-ctype.h-for-isdigit.patch |  25 --
 ...ation-of-various-standard-header-includes.patch |  41 --
 ...et-thread-stack-size-to-ulimit-soft-value.patch | 427 ---------------------
 testing/lttng-tools/APKBUILD                       |  40 +-
 testing/lttng-tools/missing-pthread-include.patch  |  10 +
 testing/lttng-tools/musl-has-no-dlmopen.patch      |  49 +++
 9 files changed, 71 insertions(+), 584 deletions(-)
 delete mode 100644 testing/lttng-tools/0002-Fix-snapshot-del-output-with-name-on-musl.patch
 delete mode 100644 testing/lttng-tools/0003-Fix-error.h-common-error.h.patch
 delete mode 100644 testing/lttng-tools/0004-Fix-strerror_r-behavior-is-glibc-specific.patch
 delete mode 100644 testing/lttng-tools/0008-Fix-missing-include-ctype.h-for-isdigit.patch
 delete mode 100644 testing/lttng-tools/0009-Fix-location-of-various-standard-header-includes.patch
 delete mode 100644 testing/lttng-tools/0010-Set-thread-stack-size-to-ulimit-soft-value.patch
 create mode 100644 testing/lttng-tools/missing-pthread-include.patch
 create mode 100644 testing/lttng-tools/musl-has-no-dlmopen.patch

diff --git a/testing/lttng-tools/0002-Fix-snapshot-del-output-with-name-on-musl.patch b/testing/lttng-tools/0002-Fix-snapshot-del-output-with-name-on-musl.patch
deleted file mode 100644
index b5cc7ec920..0000000000
--- a/testing/lttng-tools/0002-Fix-snapshot-del-output-with-name-on-musl.patch
@@ -1,11 +0,0 @@
--- lttng-tools-2.8.0.orig/src/bin/lttng/commands/snapshot.c
+++ lttng-tools-2.8.0/src/bin/lttng/commands/snapshot.c
@@ -447,7 +447,7 @@
 
 	errno = 0;
 	id = strtol(argv[1], &name, 10);
-	if (id == 0 && errno == 0) {
+	if (id == 0 && (errno == 0 || errno == EINVAL)) {
 		if (lttng_opt_mi) {
 			ret = mi_del_output(UINT32_MAX, name);
 		} else {
diff --git a/testing/lttng-tools/0003-Fix-error.h-common-error.h.patch b/testing/lttng-tools/0003-Fix-error.h-common-error.h.patch
deleted file mode 100644
index e646821d0b..0000000000
--- a/testing/lttng-tools/0003-Fix-error.h-common-error.h.patch
@@ -1,26 +0,0 @@
From e12508e3e4de2f3d5416d6a750142b525e9d3b5e Mon Sep 17 00:00:00 2001
From: Michael Jeanson <mjeanson@efficios.com>
Date: Mon, 13 Jun 2016 18:42:07 -0400
Subject: [PATCH lttng-tools 3/4] Fix: error.h -> common/error.h

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 src/bin/lttng-sessiond/agent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/lttng-sessiond/agent.c b/src/bin/lttng-sessiond/agent.c
index 8e1ef08..5b0b6f5 100644
--- a/src/bin/lttng-sessiond/agent.c
+++ b/src/bin/lttng-sessiond/agent.c
@@ -29,7 +29,7 @@
 #include "agent.h"
 #include "ust-app.h"
 #include "utils.h"
-#include "error.h"
+#include "common/error.h"
 
 #define AGENT_RET_CODE_INDEX(code) (code - AGENT_RET_CODE_SUCCESS)
 
--- 
2.7.4

diff --git a/testing/lttng-tools/0004-Fix-strerror_r-behavior-is-glibc-specific.patch b/testing/lttng-tools/0004-Fix-strerror_r-behavior-is-glibc-specific.patch
deleted file mode 100644
index f1fe8735c4..0000000000
--- a/testing/lttng-tools/0004-Fix-strerror_r-behavior-is-glibc-specific.patch
@@ -1,26 +0,0 @@
From fc743b22fc26eab9f9dbf48e4505ed2394924bba Mon Sep 17 00:00:00 2001
From: Michael Jeanson <mjeanson@efficios.com>
Date: Mon, 13 Jun 2016 18:44:17 -0400
Subject: [PATCH lttng-tools 4/4] Fix: strerror_r behavior is glibc specific

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 src/common/error.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/common/error.h b/src/common/error.h
index 0fbd3a2..e8c811e 100644
--- a/src/common/error.h
+++ b/src/common/error.h
@@ -198,7 +198,7 @@ static inline void __lttng_print_check_abort(enum lttng_error_level type)
 
 #define _PERROR(fmt, args...) _ERRMSG("PERROR", PRINT_ERR, fmt, ## args)
 
-#if !defined(__linux__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE))
+#if !defined(__GLIBC__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE))
 
 /*
  * Version using XSI strerror_r.
--- 
2.7.4

diff --git a/testing/lttng-tools/0008-Fix-missing-include-ctype.h-for-isdigit.patch b/testing/lttng-tools/0008-Fix-missing-include-ctype.h-for-isdigit.patch
deleted file mode 100644
index 1dc77b38c5..0000000000
--- a/testing/lttng-tools/0008-Fix-missing-include-ctype.h-for-isdigit.patch
@@ -1,25 +0,0 @@
From f4ff60d3f82c6f35aeb066772428aac3b0149276 Mon Sep 17 00:00:00 2001
From: Michael Jeanson <mjeanson@efficios.com>
Date: Wed, 15 Jun 2016 09:46:53 -0500
Subject: [PATCH lttng-tools 1/3] Fix: missing include ctype.h for isdigit()

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 src/bin/lttng-sessiond/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index 4623579..c8e4e53 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -37,6 +37,7 @@
 #include <sys/wait.h>
 #include <urcu/uatomic.h>
 #include <unistd.h>
+#include <ctype.h>
 
 #include <common/common.h>
 #include <common/compat/socket.h>
--- 
2.7.4

diff --git a/testing/lttng-tools/0009-Fix-location-of-various-standard-header-includes.patch b/testing/lttng-tools/0009-Fix-location-of-various-standard-header-includes.patch
deleted file mode 100644
index 26df2d6b6a..0000000000
--- a/testing/lttng-tools/0009-Fix-location-of-various-standard-header-includes.patch
@@ -1,41 +0,0 @@
From 080bcd6236b63e7cf354612a8687e72c70ef6c9f Mon Sep 17 00:00:00 2001
From: Michael Jeanson <mjeanson@efficios.com>
Date: Wed, 15 Jun 2016 10:05:39 -0500
Subject: [PATCH lttng-tools 2/3] Fix: location of various standard header
 includes

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 src/common/daemonize.c | 2 +-
 src/common/runas.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/daemonize.c b/src/common/daemonize.c
index 300851b..b12194e 100644
--- a/src/common/daemonize.c
+++ b/src/common/daemonize.c
@@ -20,7 +20,7 @@
 #include <unistd.h>
 #include <common/compat/paths.h>
 #include <fcntl.h>
-#include <wait.h>
+#include <sys/wait.h>
 #include <stdlib.h>
 
 #include <urcu/system.h>
diff --git a/src/common/runas.c b/src/common/runas.c
index 2a71f58..7a6be28 100644
--- a/src/common/runas.c
+++ b/src/common/runas.c
@@ -28,7 +28,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sched.h>
-#include <sys/signal.h>
+#include <signal.h>
 #include <assert.h>
 #include <signal.h>
 
--- 
2.7.4

diff --git a/testing/lttng-tools/0010-Set-thread-stack-size-to-ulimit-soft-value.patch b/testing/lttng-tools/0010-Set-thread-stack-size-to-ulimit-soft-value.patch
deleted file mode 100644
index dc6a7dda5e..0000000000
--- a/testing/lttng-tools/0010-Set-thread-stack-size-to-ulimit-soft-value.patch
@@ -1,427 +0,0 @@
From 451f4d875537c073a966d6ccfb2fe08a497fbd7b Mon Sep 17 00:00:00 2001
From: Michael Jeanson <mjeanson@efficios.com>
Date: Wed, 15 Jun 2016 11:01:08 -0500
Subject: [PATCH lttng-tools 3/3] Set thread stack size to ulimit soft value

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 src/bin/lttng-consumerd/lttng-consumerd.c | 17 ++++++----
 src/bin/lttng-relayd/live.c               | 10 +++---
 src/bin/lttng-relayd/live.h               |  2 +-
 src/bin/lttng-relayd/main.c               | 14 +++++---
 src/bin/lttng-sessiond/main.c             | 27 +++++++++------
 src/common/utils.c                        | 56 +++++++++++++++++++++++++++++++
 src/common/utils.h                        |  1 +
 7 files changed, 99 insertions(+), 28 deletions(-)

diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c
index 00660fc..2f1d01c 100644
--- a/src/bin/lttng-consumerd/lttng-consumerd.c
+++ b/src/bin/lttng-consumerd/lttng-consumerd.c
@@ -57,6 +57,8 @@
 static pthread_t channel_thread, data_thread, metadata_thread,
 		sessiond_thread, metadata_timer_thread, health_thread;
 
+static pthread_attr_t *tattr;
+
 /* to count the number of times the user pressed ctrl+c */
 static int sigintcount = 0;
 
@@ -351,6 +353,9 @@ int main(int argc, char **argv)
 		}
 	}
 
+	/* Get stacksize limit */
+	tattr = get_pthread_attr_stacksize();
+
 	/*
 	 * Starting from here, we can create threads. This needs to be after
 	 * lttng_daemonize due to RCU.
@@ -498,7 +503,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create thread to manage the client socket */
-	ret = pthread_create(&health_thread, NULL,
+	ret = pthread_create(&health_thread, tattr,
 			thread_manage_health, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -517,7 +522,7 @@ int main(int argc, char **argv)
 	cmm_smp_mb();	/* Read ready before following operations */
 
 	/* Create thread to manage channels */
-	ret = pthread_create(&channel_thread, NULL,
+	ret = pthread_create(&channel_thread, tattr,
 			consumer_thread_channel_poll,
 			(void *) ctx);
 	if (ret) {
@@ -528,7 +533,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create thread to manage the polling/writing of trace metadata */
-	ret = pthread_create(&metadata_thread, NULL,
+	ret = pthread_create(&metadata_thread, tattr,
 			consumer_thread_metadata_poll,
 			(void *) ctx);
 	if (ret) {
@@ -539,7 +544,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create thread to manage the polling/writing of trace data */
-	ret = pthread_create(&data_thread, NULL, consumer_thread_data_poll,
+	ret = pthread_create(&data_thread, tattr, consumer_thread_data_poll,
 			(void *) ctx);
 	if (ret) {
 		errno = ret;
@@ -549,7 +554,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create the thread to manage the receive of fd */
-	ret = pthread_create(&sessiond_thread, NULL,
+	ret = pthread_create(&sessiond_thread, tattr,
 			consumer_thread_sessiond_poll,
 			(void *) ctx);
 	if (ret) {
@@ -563,7 +568,7 @@ int main(int argc, char **argv)
 	 * Create the thread to manage the UST metadata periodic timer and
 	 * live timer.
 	 */
-	ret = pthread_create(&metadata_timer_thread, NULL,
+	ret = pthread_create(&metadata_timer_thread, tattr,
 			consumer_timer_thread, (void *) ctx);
 	if (ret) {
 		errno = ret;
diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c
index e2096ec..32efab1 100644
--- a/src/bin/lttng-relayd/live.c
+++ b/src/bin/lttng-relayd/live.c
@@ -2147,13 +2147,13 @@ int relayd_live_join(void)
 /*
  * main
  */
-int relayd_live_create(struct lttng_uri *uri)
+int relayd_live_create(struct lttng_uri *uri, const pthread_attr_t *tattr)
 {
 	int ret = 0, retval = 0;
 	void *status;
 	int is_root;
 
-	if (!uri) {
+	if (!uri || !tattr) {
 		retval = -1;
 		goto exit_init_data;
 	}
@@ -2186,7 +2186,7 @@ int relayd_live_create(struct lttng_uri *uri)
 	}
 
 	/* Setup the dispatcher thread */
-	ret = pthread_create(&live_dispatcher_thread, NULL,
+	ret = pthread_create(&live_dispatcher_thread, tattr,
 			thread_dispatcher, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -2196,7 +2196,7 @@ int relayd_live_create(struct lttng_uri *uri)
 	}
 
 	/* Setup the worker thread */
-	ret = pthread_create(&live_worker_thread, NULL,
+	ret = pthread_create(&live_worker_thread, tattr,
 			thread_worker, NULL);
 	if (ret) {
 		errno = ret;
@@ -2206,7 +2206,7 @@ int relayd_live_create(struct lttng_uri *uri)
 	}
 
 	/* Setup the listener thread */
-	ret = pthread_create(&live_listener_thread, NULL,
+	ret = pthread_create(&live_listener_thread, tattr,
 			thread_listener, (void *) NULL);
 	if (ret) {
 		errno = ret;
diff --git a/src/bin/lttng-relayd/live.h b/src/bin/lttng-relayd/live.h
index 2b8a3a0..6cd85e9 100644
--- a/src/bin/lttng-relayd/live.h
+++ b/src/bin/lttng-relayd/live.h
@@ -24,7 +24,7 @@
 
 #include "lttng-relayd.h"
 
-int relayd_live_create(struct lttng_uri *live_uri);
+int relayd_live_create(struct lttng_uri *live_uri, const pthread_attr_t *tattr);
 int relayd_live_stop(void);
 int relayd_live_join(void);
 
diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c
index 6ad6566..505e884 100644
--- a/src/bin/lttng-relayd/main.c
+++ b/src/bin/lttng-relayd/main.c
@@ -119,6 +119,8 @@ static pthread_t dispatcher_thread;
 static pthread_t worker_thread;
 static pthread_t health_thread;
 
+static pthread_attr_t *tattr;
+
 /*
  * last_relay_stream_id_lock protects last_relay_stream_id increment
  * atomicity on 32-bit architectures.
@@ -2778,6 +2780,8 @@ int main(int argc, char **argv)
 		}
 	}
 
+	/* Get stack size limit */
+	tattr = get_pthread_attr_stacksize();
 
 	/* Initialize thread health monitoring */
 	health_relayd = health_app_create(NR_HEALTH_RELAYD_TYPES);
@@ -2840,7 +2844,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create thread to manage the client socket */
-	ret = pthread_create(&health_thread, NULL,
+	ret = pthread_create(&health_thread, tattr,
 			thread_manage_health, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -2850,7 +2854,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Setup the dispatcher thread */
-	ret = pthread_create(&dispatcher_thread, NULL,
+	ret = pthread_create(&dispatcher_thread, tattr,
 			relay_thread_dispatcher, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -2860,7 +2864,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Setup the worker thread */
-	ret = pthread_create(&worker_thread, NULL,
+	ret = pthread_create(&worker_thread, tattr,
 			relay_thread_worker, NULL);
 	if (ret) {
 		errno = ret;
@@ -2870,7 +2874,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Setup the listener thread */
-	ret = pthread_create(&listener_thread, NULL,
+	ret = pthread_create(&listener_thread, tattr,
 			relay_thread_listener, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -2879,7 +2883,7 @@ int main(int argc, char **argv)
 		goto exit_listener_thread;
 	}
 
-	ret = relayd_live_create(live_uri);
+	ret = relayd_live_create(live_uri, tattr);
 	if (ret) {
 		ERR("Starting live viewer threads");
 		retval = -1;
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index c8e4e53..b8f1bde 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -212,6 +212,8 @@ static pthread_t ht_cleanup_thread;
 static pthread_t agent_reg_thread;
 static pthread_t load_session_thread;
 
+static pthread_attr_t *tattr;
+
 /*
  * UST registration command queue. This queue is tied with a futex and uses a N
  * wakers / 1 waiter implemented and detailed in futex.c/.h
@@ -2402,7 +2404,7 @@ static int spawn_consumer_thread(struct consumer_data *consumer_data)
 		goto error;
 	}
 
-	ret = pthread_create(&consumer_data->thread, NULL, thread_manage_consumer,
+	ret = pthread_create(&consumer_data->thread, tattr, thread_manage_consumer,
 			consumer_data);
 	if (ret) {
 		errno = ret;
@@ -5638,6 +5640,9 @@ int main(int argc, char **argv)
 		goto exit_create_run_as_worker_cleanup;
 	}
 
+	/* Get stack size limit */
+	tattr = get_pthread_attr_stacksize();
+
 	/*
 	 * Starting from here, we can create threads. This needs to be after
 	 * lttng_daemonize due to RCU.
@@ -5672,7 +5677,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create thread to clean up RCU hash tables */
-	ret = pthread_create(&ht_cleanup_thread, NULL,
+	ret = pthread_create(&ht_cleanup_thread, tattr,
 			thread_ht_cleanup, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -6044,7 +6049,7 @@ int main(int argc, char **argv)
 	load_info->path = opt_load_session_path;
 
 	/* Create health-check thread */
-	ret = pthread_create(&health_thread, NULL,
+	ret = pthread_create(&health_thread, tattr,
 			thread_manage_health, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -6054,7 +6059,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create thread to manage the client socket */
-	ret = pthread_create(&client_thread, NULL,
+	ret = pthread_create(&client_thread, tattr,
 			thread_manage_clients, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -6064,7 +6069,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create thread to dispatch registration */
-	ret = pthread_create(&dispatch_thread, NULL,
+	ret = pthread_create(&dispatch_thread, tattr,
 			thread_dispatch_ust_registration, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -6074,7 +6079,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create thread to manage application registration. */
-	ret = pthread_create(&reg_apps_thread, NULL,
+	ret = pthread_create(&reg_apps_thread, tattr,
 			thread_registration_apps, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -6084,7 +6089,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create thread to manage application socket */
-	ret = pthread_create(&apps_thread, NULL,
+	ret = pthread_create(&apps_thread, tattr,
 			thread_manage_apps, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -6094,7 +6099,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create thread to manage application notify socket */
-	ret = pthread_create(&apps_notify_thread, NULL,
+	ret = pthread_create(&apps_notify_thread, tattr,
 			ust_thread_manage_notify, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -6104,7 +6109,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create agent registration thread. */
-	ret = pthread_create(&agent_reg_thread, NULL,
+	ret = pthread_create(&agent_reg_thread, tattr,
 			agent_thread_manage_registration, (void *) NULL);
 	if (ret) {
 		errno = ret;
@@ -6116,7 +6121,7 @@ int main(int argc, char **argv)
 	/* Don't start this thread if kernel tracing is not requested nor root */
 	if (is_root && !opt_no_kernel) {
 		/* Create kernel thread to manage kernel event */
-		ret = pthread_create(&kernel_thread, NULL,
+		ret = pthread_create(&kernel_thread, tattr,
 				thread_manage_kernel, (void *) NULL);
 		if (ret) {
 			errno = ret;
@@ -6127,7 +6132,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Create session loading thread. */
-	ret = pthread_create(&load_session_thread, NULL, thread_load_session,
+	ret = pthread_create(&load_session_thread, tattr, thread_load_session,
 			load_info);
 	if (ret) {
 		errno = ret;
diff --git a/src/common/utils.c b/src/common/utils.c
index 1e52ae0..593d6cc 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -31,6 +31,8 @@
 #include <pwd.h>
 #include <sys/file.h>
 #include <unistd.h>
+#include <stdbool.h>
+#include <sys/resource.h>
 
 #include <common/common.h>
 #include <common/runas.h>
@@ -1383,3 +1385,57 @@ int utils_show_man_page(int section, const char *page_name)
 		section_string, page_name, NULL);
 	return ret;
 }
+
+static bool pthread_ss_done = false;
+static pthread_attr_t *tattr = NULL;
+static pthread_attr_t tattr_value;
+
+LTTNG_HIDDEN
+pthread_attr_t *get_pthread_attr_stacksize() {
+	int ret = 0;
+	size_t ptstacksize;
+	struct rlimit rlim;
+
+	/* Return cached value */
+	if (pthread_ss_done) {
+		goto end;
+	}
+
+	/* Get stack size limits */
+	ret = getrlimit(RLIMIT_STACK, &rlim);
+	if (ret < 0) {
+		PERROR("getrlimit");
+		goto end;
+	}
+	DBG("Stack size limits: soft %lld, hard %lld bytes",
+			(long long) rlim.rlim_cur,
+			(long long) rlim.rlim_max);
+
+	/* Get default thread stack size */
+	ret = pthread_attr_getstacksize(&tattr_value, &ptstacksize);
+	if (ret < 0) {
+		PERROR("pthread_attr_getstacksize");
+		goto end;
+	}
+	DBG("Default pthread stack size is %zu bytes", ptstacksize);
+
+	/* Check if default thread stack size respects ulimits */
+	if (ptstacksize < rlim.rlim_cur) {
+		DBG("Your libc doesn't honor stack size limits, setting thread stack size to soft limit (%lld bytes)", (long long) rlim.rlim_cur);
+
+		/* Create pthread_attr_t struct with ulimit stack size */
+		ret = pthread_attr_setstacksize(&tattr_value, rlim.rlim_cur);
+		if (ret < 0) {
+			PERROR("pthread_attr_setstacksize");
+			goto end;
+		}
+
+		/* Set pointer */
+		tattr = &tattr_value;
+	}
+
+	/* Enable cached value */
+	pthread_ss_done = true;
+end:
+	return tattr;
+}
diff --git a/src/common/utils.h b/src/common/utils.h
index 7285f5c..568c123 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -60,5 +60,6 @@ int utils_create_lock_file(const char *filepath);
 int utils_recursive_rmdir(const char *path);
 int utils_truncate_stream_file(int fd, off_t length);
 int utils_show_man_page(int section, const char *page_name);
+pthread_attr_t *get_pthread_attr_stacksize();
 
 #endif /* _COMMON_UTILS_H */
--- 
2.7.4

diff --git a/testing/lttng-tools/APKBUILD b/testing/lttng-tools/APKBUILD
index f009b9f7fc..bc2b0f7aee 100644
--- a/testing/lttng-tools/APKBUILD
+++ b/testing/lttng-tools/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: Michael Jeanson <mjeanson@efficios.com>
# Maintainer: Michael Jeanson <mjeanson@efficios.com>
pkgname=lttng-tools
pkgver=2.8.1
pkgver=2.9.0
pkgrel=0
pkgdesc="LTTng 2.0 control and utility programs"
url="https://lttng.org"
@@ -14,12 +14,8 @@ makedepends="$depends_dev bash grep coreutils automake autoconf"
install=""
subpackages="$pkgname-dev $pkgname-doc"
source="https://lttng.org/files/$pkgname/$pkgname-$pkgver.tar.bz2
	0002-Fix-snapshot-del-output-with-name-on-musl.patch
	0008-Fix-missing-include-ctype.h-for-isdigit.patch
	0003-Fix-error.h-common-error.h.patch
	0009-Fix-location-of-various-standard-header-includes.patch
	0004-Fix-strerror_r-behavior-is-glibc-specific.patch
	0010-Set-thread-stack-size-to-ulimit-soft-value.patch"
	missing-pthread-include.patch
	musl-has-no-dlmopen.patch"

builddir="$srcdir/$pkgname-$pkgver"

@@ -47,24 +43,12 @@ package() {
		"$pkgdir"/usr/share/licenses/$pkgname/
}

md5sums="276e72f68bff75eb7abc9b8c2ecd9f03  lttng-tools-2.8.1.tar.bz2
f592a8ca1e4e5125a2c7bebe8725ecbe  0002-Fix-snapshot-del-output-with-name-on-musl.patch
caf2e21365cad8940f984affc83da5ad  0008-Fix-missing-include-ctype.h-for-isdigit.patch
f10946cbfeadd54035ea6088cfceb7f1  0003-Fix-error.h-common-error.h.patch
54a29190c3e2e7165b1c615973f2dee1  0009-Fix-location-of-various-standard-header-includes.patch
80c64f3e33d46f68372578afc11e254f  0004-Fix-strerror_r-behavior-is-glibc-specific.patch
51a51e03cd4fabd812168bac4fc235dc  0010-Set-thread-stack-size-to-ulimit-soft-value.patch"
sha256sums="e8e030c111a6fb509d640206c26175ff997c06c2b93224c0ef7964c7d813e492  lttng-tools-2.8.1.tar.bz2
117f3876419a78ab1d9638bce63afd75dbd1cfcbfd15d52542f34c2c5591b983  0002-Fix-snapshot-del-output-with-name-on-musl.patch
ee57eebe3baef7f784a3b45f2cab47af40205cb279fe57586dc1ef0384441e5e  0008-Fix-missing-include-ctype.h-for-isdigit.patch
11380dafa6f4a02225a754518ae9792d31e4e0a2a30895b9544dc30b423f0edd  0003-Fix-error.h-common-error.h.patch
a14dc45efdd9a978c4fdae06d400b11c9ee770710596551e9212e6ac966ec89d  0009-Fix-location-of-various-standard-header-includes.patch
1a8777ab9d724bdef7b76619777b733522d1bb3bed6df96887ef4820d17a6f72  0004-Fix-strerror_r-behavior-is-glibc-specific.patch
759ef937508d3dfa3f58f2b31793277139575b09743f857705c8e6947d50f28b  0010-Set-thread-stack-size-to-ulimit-soft-value.patch"
sha512sums="76dec338e9ab6efbb950c2503f712b558c5b76919934e981a5db8d17c33e6df2d56b6db5a1f35afe98310862a800a4b5adc337b5ed9ab189dd168426b9448172  lttng-tools-2.8.1.tar.bz2
9ed87e171a286126d3c09eb53104084b1baf7417baf1aaa998a523bb0cc1388d783e1a3c47218b5dfae17792e3587808594423224cecbc198f133eba3a5487b6  0002-Fix-snapshot-del-output-with-name-on-musl.patch
57c424f7ae28283c2d8b43c08afdb23c5aeeee3fdd6db41450b6117116b28cd0f2fa3708f3d431b1565c097ec3d14e8e4cca3427f9f04ef198fe4c9847286aac  0008-Fix-missing-include-ctype.h-for-isdigit.patch
3dec5721b6c89fd101b873b8c862963279c395e155b1dc5ae3461bf97943b269c29a814f3a1d2650a07687dff2c34f383aadd884f6c0e84fbc928dd43c17cb87  0003-Fix-error.h-common-error.h.patch
96386508a157b2c8bf68c026f50e50b76a1b2d25c8556b904ec3acee6160c79dbfa8e22c0d5eeef7b37187152d4abc300ad2518acb2bcf3e3736c0057d8addbe  0009-Fix-location-of-various-standard-header-includes.patch
b996a0b21add39b3a9bd6850ff89946b8203f4b6a39e014fe7a65171205d97f93fad388d0636edce4381481d739773ebfc26c98a6d22f70eea7245e845727355  0004-Fix-strerror_r-behavior-is-glibc-specific.patch
13dda11c7d882bc1ec67219457fee90f55668a1ec945bcc8e15a2a520856d9daf2e28721ebb096134e169e0c4fbd1281ecb0e503d3c74c8099d0ab0a4b73c573  0010-Set-thread-stack-size-to-ulimit-soft-value.patch"
md5sums="75b5feb18aa2a136ebf70a14d2a5a6e5  lttng-tools-2.9.0.tar.bz2
7c8b69cca2afaf2b17461874ef0bc2e2  missing-pthread-include.patch
0efce284ccaf2a40d515981a107d8b75  musl-has-no-dlmopen.patch"
sha256sums="eff3003f3c37ae8f2921ba76de777171405935eec48f4c1a15abdda8d0859422  lttng-tools-2.9.0.tar.bz2
ca9a432ace06a47d23cd3ac793ac6fb0aa46da065b0e7eb72f71f1248cc11274  missing-pthread-include.patch
937501ebba41568872abc28da58e1f8d1d033ae6f3d761f132f75434955de64c  musl-has-no-dlmopen.patch"
sha512sums="d33c1d0ec7f26827a6fdcb0ab0f329c97ccac4bc6fc2ea80a4d824600d58ae766593a9ac923681c2d73cd9632a17adc06dfd15e246077f68eedffb1a20327419  lttng-tools-2.9.0.tar.bz2
04cb96de65ba4d111cd9d3e128a029514c8157f29b21db811da451fbf0a892f883361d7092983605c087c8beaa6387b3384c39dce9af4a0e7db706aab4702cbd  missing-pthread-include.patch
cb5136007b0d8ea0a84557ab025e709dc4c5d818272f057a9f6c78ed7cf5104b9d904a1b8c5e8674e3455fe85dc28bb890c190cc04f0c1d9c29d87b40dadb88b  musl-has-no-dlmopen.patch"
diff --git a/testing/lttng-tools/missing-pthread-include.patch b/testing/lttng-tools/missing-pthread-include.patch
new file mode 100644
index 0000000000..e94b59462b
--- /dev/null
+++ b/testing/lttng-tools/missing-pthread-include.patch
@@ -0,0 +1,10 @@
--- lttng-tools-2.9.0.orig/src/common/defaults.h
+++ lttng-tools-2.9.0/src/common/defaults.h
@@ -20,6 +20,7 @@
 #ifndef _DEFAULTS_H
 #define _DEFAULTS_H
 
+#include <pthread.h>
 #include <src/common/macros.h>
 
 /* Default unix group name for tracing. */
diff --git a/testing/lttng-tools/musl-has-no-dlmopen.patch b/testing/lttng-tools/musl-has-no-dlmopen.patch
new file mode 100644
index 0000000000..e5f4806373
--- /dev/null
+++ b/testing/lttng-tools/musl-has-no-dlmopen.patch
@@ -0,0 +1,49 @@
--- lttng-tools-2.9.0.orig/tests/regression/ust/ust-dl/prog.c
+++ lttng-tools-2.9.0/tests/regression/ust/ust-dl/prog.c
@@ -21,7 +21,7 @@
 	if (!h0) {
 		goto get_error;
 	}
-	h1 = dlmopen(LM_ID_BASE, "libfoo.so", RTLD_LAZY);
+	h1 = dlopen("libfoo.so", RTLD_LAZY);
 	if (!h1) {
 		goto get_error;
 	}
--- lttng-tools-2.9.0.orig/tests/regression/ust/ust-dl/test_ust-dl.py
+++ lttng-tools-2.9.0/tests/regression/ust/ust-dl/test_ust-dl.py
@@ -31,7 +31,7 @@
 from test_utils import *
 
 
-NR_TESTS = 14
+NR_TESTS = 13
 current_test = 1
 print("1..{0}".format(NR_TESTS))
 
@@ -65,7 +65,6 @@
     bail("Could not open babeltrace. Please make sure it is installed.", session_info)
 
 dlopen_event_found = 0
-dlmopen_event_found = 0
 build_id_event_found = 0
 debug_link_event_found = 0
 dlclose_event_found = 0
@@ -82,8 +81,6 @@
     event_line = event_line.decode('utf-8').replace("\n", "")
     if re.search(r".*lttng_ust_dl:dlopen.*", event_line) is not None:
         dlopen_event_found += 1
-    elif re.search(r".*lttng_ust_dl:dlmopen.*", event_line) is not None:
-        dlmopen_event_found += 1
     elif re.search(r".*lttng_ust_dl:build_id.*", event_line) is not None:
         build_id_event_found += 1
     elif re.search(r".*lttng_ust_dl:debug_link.*", event_line) is not None:
@@ -111,9 +108,6 @@
 current_test += 1
 
 print_test_result(dlopen_event_found > 0, current_test, "lttng_ust_dl:dlopen event found in resulting trace")
-current_test += 1
-
-print_test_result(dlmopen_event_found > 0, current_test, "lttng_ust_dl:dlmopen event found in resulting trace")
 current_test += 1
 
 print_test_result(build_id_event_found > 0, current_test, "lttng_ust_dl:build_id event found in resulting trace")
-- 
2.11.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)