mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
Refs Tokutek/ft-index#28 Fix compile failure on machines without prctl
This commit is contained in:
parent
a921615d73
commit
53a9e3fa6a
2 changed files with 6 additions and 2 deletions
|
@ -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:
|
||||||
#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) {
|
||||||
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:
|
||||||
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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue