Put ifdefs around Linux-specific header/function.

Closes #2366.
(cherry picked from commit 2d4d2d807d98fd9cd3b49891faf0b34976330915)
master
cybersphinx 2010-11-30 01:50:34 +01:00
parent a7f468cc7c
commit d6e2ad0c56
1 changed files with 4 additions and 0 deletions

View File

@ -122,10 +122,12 @@ static LONG WINAPI windowsExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo)
# include <sys/stat.h>
# include <sys/wait.h>
# include <sys/utsname.h>
#ifdef WZ_OS_LINUX
# include <sys/prctl.h>
#ifndef PR_SET_PTRACER
# define PR_SET_PTRACER 0x59616d61 // prctl will ignore unknown options
#endif
#endif
// GNU extension for backtrace():
# if defined(__GLIBC__)
@ -434,8 +436,10 @@ static pid_t execGdb(int const dumpFile, int* gdbWritePipe)
// Check to see if we're the parent
if (pid != 0)
{
#ifdef WZ_OS_LINUX
// Allow tracing the process, some hardened kernel configurations disallow this.
prctl(PR_SET_PTRACER, pid, 0, 0, 0);
#endif
// Return the write end of the pipe
*gdbWritePipe = gdbPipe[1];