logging: print human-readable thread names when logging
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 11 Feb 2020 23:22:13 +0000 (18:22 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 11 Aug 2020 20:50:22 +0000 (16:50 -0400)
commitf5fb86c1254b785eee8caf87cb996d33eda0ede9
tree1bcdbbe6646d43569f2b1761f9862f9137393af6
parentf37d0f861f20a72a0b77fb43fa27744521dd7995
logging: print human-readable thread names when logging

The lttng_thread interface used by the session daemon uniquely names
all threads. This name can be used to augment the thread's logging
statement with a human-readable name rather than using the pid/tid
tuple used elsewhere.

Additionally, the thread name is set using the pthread API so that it
is visible in GDB and other tools (e.g. htop).

Invocations of pgrep in the test utilities are replaced by 'pgrep -f',
which matches against the process name.

We are not the first to encounter this problem after renaming the main
thread, see
https://github.com/mongodb/mongo/commit/726cafd713c7333640f8458ec9808ed4f678e3a7#diff-a9003101d1e4a99ac2d43d9b1b839587R122

pgrep uses the name name in /proc/$PID/status which contains the
thread name, not the executable name. In the case of the sessiond,
this is now "Main".

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I73dfe8683b2ea31f7ed0c2ffdfa8332f36e28f9b
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/thread.c
src/common/error.c
src/common/error.h
tests/utils/utils.sh
This page took 0.03432 seconds and 4 git commands to generate.