Commit e3277708 authored by Yoni Fogel's avatar Yoni Fogel

Refs Tokutek/ft-index#28 Fix compile failure on machines without prctl

parent 7148e0b9
...@@ -39,6 +39,7 @@ check_include_files(syscall.h HAVE_SYSCALL_H) ...@@ -39,6 +39,7 @@ check_include_files(syscall.h HAVE_SYSCALL_H)
check_include_files(sys/endian.h HAVE_SYS_ENDIAN_H) check_include_files(sys/endian.h HAVE_SYS_ENDIAN_H)
check_include_files(sys/file.h HAVE_SYS_FILE_H) check_include_files(sys/file.h HAVE_SYS_FILE_H)
check_include_files(sys/malloc.h HAVE_SYS_MALLOC_H) check_include_files(sys/malloc.h HAVE_SYS_MALLOC_H)
check_include_files(sys/prctl.h HAVE_SYS_PRCTL_H)
check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H) check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_files(sys/statvfs.h HAVE_SYS_STATVFS_H) check_include_files(sys/statvfs.h HAVE_SYS_STATVFS_H)
check_include_files(sys/syscall.h HAVE_SYS_SYSCALL_H) check_include_files(sys/syscall.h HAVE_SYS_SYSCALL_H)
......
...@@ -88,9 +88,10 @@ PATENT RIGHTS GRANT: ...@@ -88,9 +88,10 @@ PATENT RIGHTS GRANT:
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h> #include <sys/prctl.h>
#endif
//#include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <toku_race_tools.h> #include <toku_race_tools.h>
#include "toku_crash.h" #include "toku_crash.h"
...@@ -126,7 +127,9 @@ run_gdb(pid_t parent_pid, const char *gdb_path) { ...@@ -126,7 +127,9 @@ run_gdb(pid_t parent_pid, const char *gdb_path) {
static void static void
intermediate_process(pid_t parent_pid, const char *gdb_path) { intermediate_process(pid_t parent_pid, const char *gdb_path) {
// Disable generating of core dumps // Disable generating of core dumps
#if defined(HAVE_SYS_PRCTL_H) && defined(HAVE_PR_SET_PTRACER)
prctl(PR_SET_DUMPABLE, 0, 0, 0); prctl(PR_SET_DUMPABLE, 0, 0, 0);
#endif
pid_t worker_pid = fork(); pid_t worker_pid = fork();
if (worker_pid < 0) { if (worker_pid < 0) {
perror("spawn gdb fork: "); perror("spawn gdb fork: ");
...@@ -177,7 +180,7 @@ failure: ...@@ -177,7 +180,7 @@ failure:
static void static void
spawn_gdb(const char *gdb_path) { spawn_gdb(const char *gdb_path) {
pid_t parent_pid = getpid(); pid_t parent_pid = getpid();
#if defined(HAVE_PR_SET_PTRACER) #if defined(HAVE_SYS_PRCTL_H) && defined(HAVE_PR_SET_PTRACER)
// On systems that require permission for the same user to ptrace, // On systems that require permission for the same user to ptrace,
// give permission for this process and (more importantly) all its children to debug this process. // give permission for this process and (more importantly) all its children to debug this process.
prctl(PR_SET_PTRACER, parent_pid, 0, 0, 0); prctl(PR_SET_PTRACER, parent_pid, 0, 0, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment