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.
This commit is contained in:
Jehan 2018-04-25 00:19:37 +02:00
parent 44a931e16c
commit 106fc9309f
1 changed files with 5 additions and 1 deletions

View File

@ -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