[lttng-dev] [RFC PATCH lttng-tools] Fix: runas: set thread name
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Fri Sep 18 12:00:04 EDT 2015
In case some system check for the thread name in pidof.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
src/common/runas.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/common/runas.c b/src/common/runas.c
index 2634ae9..d313e83 100644
--- a/src/common/runas.c
+++ b/src/common/runas.c
@@ -302,6 +302,7 @@ int run_as_worker(struct run_as_worker *worker)
ssize_t writelen;
struct run_as_ret sendret;
size_t proc_orig_len;
+ int ret;
/*
* Initialize worker. Set a different process cmdline.
@@ -310,6 +311,14 @@ int run_as_worker(struct run_as_worker *worker)
memset(worker->procname, 0, proc_orig_len);
strncpy(worker->procname, "lttng-runas", proc_orig_len);
+ ret = pthread_setname_np(pthread_self(), "lttng-runas");
+ if (ret) {
+ errno = ret;
+ ret = -1;
+ PERROR("pthread_setname_np");
+ return EXIT_FAILURE;
+ }
+
sendret.ret = 0;
sendret._errno = 0;
writelen = lttcomm_send_unix_sock(worker->sockpair[1], &sendret,
--
2.1.4
More information about the lttng-dev
mailing list