[gimp] Bug 795510 - SYS_gettid is not available on non-Linux system.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 795510 - SYS_gettid is not available on non-Linux system.
- Date: Tue, 24 Apr 2018 22:30:29 +0000 (UTC)
commit 106fc9309f2884bb91f2c9c6a17a9aa3e67c359b
Author: Jehan <jehan girinstud io>
Date: Wed Apr 25 00:19:37 2018 +0200
Bug 795510 - SYS_gettid is not available on non-Linux system.
I could not find for sure what to use on FreeBSD instead, so let's just
not get this information there. It is quite useful information to know
where thread traces were asked from, but it is more important to make
sure the program can be compiled everywhere. Also we can just check
which thread has gimp_stack_trace*() calls. Thus it can be seen as
redundant information in any case.
SYS_gettid is apparently defined as a macro, so let's simply check for
it being defined.
libgimpbase/gimputils.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/libgimpbase/gimputils.c b/libgimpbase/gimputils.c
index eb2c5ad..d95528f 100644
--- a/libgimpbase/gimputils.c
+++ b/libgimpbase/gimputils.c
@@ -1178,7 +1178,7 @@ gimp_stack_trace_print (const gchar *prog_name,
pid_t pid = getpid();
#if defined(G_OS_WIN32)
DWORD tid = GetCurrentThreadId ();
-#else
+#elif defined(SYS_gettid)
long tid = syscall (SYS_gettid);
#endif
@@ -1272,16 +1272,20 @@ gimp_stack_trace_print (const gchar *prog_name,
{
if (! stack_printed)
{
+#if defined(G_OS_WIN32) || defined(SYS_gettid)
if (stream)
g_fprintf (stream,
"\n# Stack traces obtained from PID %d - Thread %lu #\n\n",
pid, tid);
+#endif
if (trace)
{
gtrace = g_string_new (NULL);
+#if defined(G_OS_WIN32) || defined(SYS_gettid)
g_string_printf (gtrace,
"\n# Stack traces obtained from PID %d - Thread %lu #\n\n",
pid, tid);
+#endif
}
}
/* It's hard to know if the debugger was found since it
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]