summaryrefslogtreecommitdiff
path: root/mysql-test/lib/My/SafeProcess
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-03-11 15:03:25 +0200
committerGeorgi Kodinov <joro@sun.com>2009-03-11 15:03:25 +0200
commitfb36c97705b48d527a5eff6269ab82af28532a07 (patch)
treeeb902365720d8ee8c4d55a862e2f68b602625cf4 /mysql-test/lib/My/SafeProcess
parentba1b5eb4b5149293df466f8713c02f2614dd22f4 (diff)
parent11570d64fcffa66feaf1fdb8072fdfb9dbd865ca (diff)
downloadmariadb-git-fb36c97705b48d527a5eff6269ab82af28532a07.tar.gz
merged 5.1-main -> 5.1-bugteam
Diffstat (limited to 'mysql-test/lib/My/SafeProcess')
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index 7932f3fd2d6..6ad45a3226e 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -45,6 +45,7 @@
#include <sys/types.h>
#include <sys/wait.h>
+#include <sys/resource.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdio.h>
@@ -149,7 +150,8 @@ int main(int argc, char* const argv[] )
char* const* child_argv= 0;
pid_t own_pid= getpid();
pid_t parent_pid= getppid();
-
+ bool nocore = false;
+
/* Install signal handlers */
signal(SIGTERM, handle_signal);
signal(SIGINT, handle_signal);
@@ -181,6 +183,9 @@ int main(int argc, char* const argv[] )
start++; /* Step past = */
if ((parent_pid= atoi(start)) == 0)
die("Invalid value '%s' passed to --parent-id", start);
+ } else if ( strcmp(arg, "--nocore") == 0 )
+ {
+ nocore = true; // Don't allow the process to dump core
}
else
die("Unknown option: %s", arg);
@@ -218,6 +223,15 @@ int main(int argc, char* const argv[] )
// it and any childs(that hasn't changed group themself)
setpgid(0, 0);
+ if (nocore)
+ {
+ struct rlimit corelim = { 0, 0 };
+ if (setrlimit (RLIMIT_CORE, &corelim) < 0)
+ {
+ message("setrlimit failed, errno=%d", errno);
+ }
+ }
+
// Signal that child is ready
buf= 37;
write(pfd[1], &buf, 1);