summaryrefslogtreecommitdiff
path: root/debuginfod
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2021-03-30 13:22:43 -0400
committerFrank Ch. Eigler <fche@redhat.com>2021-03-30 13:22:43 -0400
commit69fc2b3a5cbbe6222cfe84e2e76b8b4b9195a4b3 (patch)
treeb05bf9a8757b116342f46e670ffd28e0476c3d58 /debuginfod
parenta51f2783716054ec2f6e501737f3f5058f7dbd80 (diff)
downloadelfutils-69fc2b3a5cbbe6222cfe84e2e76b8b4b9195a4b3.tar.gz
debuginfod: Set child thread names via pthread_setname_np()
In order to assist problem diagnosis / monitoring, use this gnu-flavoured pthread function to set purpose names to the various child threads debuginfod starts. libmicrohttpd already sets this for its threads. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
Diffstat (limited to 'debuginfod')
-rw-r--r--debuginfod/ChangeLog4
-rw-r--r--debuginfod/debuginfod.cxx16
2 files changed, 18 insertions, 2 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 56c2ec2b..c98a8374 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-30 Frank Ch. Eigler <fche@redhat.com>
+
+ * debuginfod.cxx (main): Set child thread names.
+
2021-03-07 Timm Bäder <tbaeder@redhat.com>
* debuginfod-client.c (debuginfod_query_server): Tweak
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 2aecc049..473511ea 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -3473,23 +3473,35 @@ main (int argc, char *argv[])
if (rc)
error (EXIT_FAILURE, rc, "cannot spawn thread to groom database\n");
else
- all_threads.push_back(pt);
+ {
+#ifdef HAVE_PTHREAD_SETNAME_NP
+ (void) pthread_setname_np (pt, "groom");
+#endif
+ all_threads.push_back(pt);
+ }
if (scan_files || scan_archives.size() > 0)
{
rc = pthread_create (& pt, NULL, thread_main_fts_source_paths, NULL);
if (rc)
error (EXIT_FAILURE, rc, "cannot spawn thread to traverse source paths\n");
+#ifdef HAVE_PTHREAD_SETNAME_NP
+ (void) pthread_setname_np (pt, "traverse");
+#endif
all_threads.push_back(pt);
+
for (unsigned i=0; i<concurrency; i++)
{
rc = pthread_create (& pt, NULL, thread_main_scanner, NULL);
if (rc)
error (EXIT_FAILURE, rc, "cannot spawn thread to scan source files / archives\n");
+#ifdef HAVE_PTHREAD_SETNAME_NP
+ (void) pthread_setname_np (pt, "scan");
+#endif
all_threads.push_back(pt);
}
}
-
+
/* Trivial main loop! */
set_metric("ready", 1);
while (! interrupted)