diff --git a/cmake_modules/TokuFeatureDetection.cmake b/cmake_modules/TokuFeatureDetection.cmake index f9cf28e92cb..59346cbaebd 100644 --- a/cmake_modules/TokuFeatureDetection.cmake +++ b/cmake_modules/TokuFeatureDetection.cmake @@ -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/file.h HAVE_SYS_FILE_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/statvfs.h HAVE_SYS_STATVFS_H) check_include_files(sys/syscall.h HAVE_SYS_SYSCALL_H) diff --git a/portability/toku_crash.cc b/portability/toku_crash.cc index a0b1b30a073..d933a7792b0 100644 --- a/portability/toku_crash.cc +++ b/portability/toku_crash.cc @@ -88,9 +88,10 @@ PATENT RIGHTS GRANT: #ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved." #include +#ifdef HAVE_SYS_PRCTL_H #include +#endif -//#include #include #include #include "toku_crash.h" @@ -126,7 +127,9 @@ run_gdb(pid_t parent_pid, const char *gdb_path) { static void intermediate_process(pid_t parent_pid, const char *gdb_path) { // Disable generating of core dumps +#if defined(HAVE_SYS_PRCTL_H) && defined(HAVE_PR_SET_PTRACER) prctl(PR_SET_DUMPABLE, 0, 0, 0); +#endif pid_t worker_pid = fork(); if (worker_pid < 0) { perror("spawn gdb fork: "); @@ -177,7 +180,7 @@ failure: static void spawn_gdb(const char *gdb_path) { 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, // give permission for this process and (more importantly) all its children to debug this process. prctl(PR_SET_PTRACER, parent_pid, 0, 0, 0);