summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-10-31 09:41:05 -0400
committerBen Gamari <ben@smart-cactus.org>2022-10-31 09:42:48 -0400
commitb3cebbf31cb96c1ef402a4dbd617805423b51593 (patch)
treebdb6c53ad467178554cfbf1777c8c2a413d090f5
parent270037faa124bf59dda8ba4f3d73b97d4c109a5f (diff)
downloadhaskell-wip/program-invocation-short-name.tar.gz
rts: Check for program_invocation_short_name via autoconfwip/program-invocation-short-name
Instead of assuming support on all Linuxes.
-rw-r--r--configure.ac5
-rw-r--r--rts/Task.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 4a69f5e833..720f64c6fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -918,6 +918,11 @@ AC_CHECK_DECLS([ctime_r], , ,
#define _POSIX_C_SOURCE 199506L
#include <time.h>])
+dnl On Linux we should have program_invocation_short_name
+AC_CHECK_DECLS([program_invocation_short_name], , ,
+[#define _GNU_SOURCE 1
+#include <errno.h>])
+
dnl ** check for mingwex library
AC_CHECK_LIB(
[mingwex],
diff --git a/rts/Task.c b/rts/Task.c
index 5c6d3cdf44..6dbc597769 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -477,7 +477,7 @@ startWorkerTask (Capability *cap)
// Set the name of the worker thread to the original process name followed by
// ":w", but only if we're on Linux where the program_invocation_short_name
// global is available.
-#if defined(linux_HOST_OS)
+#if defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME)
size_t procname_len = strlen(program_invocation_short_name);
char worker_name[16];
// The kernel only allocates 16 bytes for thread names, so we truncate if the