diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2015-06-24 07:16:08 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2015-06-24 07:16:08 +0300 |
commit | 2e4984c185ddcd2da789017cd147338846ff409a (patch) | |
tree | 0293831900c860600efbaa747ea886d9d1cbf5bd /mysql-test/lib/My/SafeProcess/safe_process.cc | |
parent | 792b53e80806df893ee62c9a1c1bd117114c8c6d (diff) | |
parent | a6087e7dc1ef3561d8189c8db15e9591d0f9b520 (diff) | |
download | mariadb-git-10.0-FusionIO.tar.gz |
Merge tag 'mariadb-10.0.20' into 10.0-FusionIO10.0-FusionIO
Conflicts:
storage/innobase/os/os0file.cc
storage/xtradb/os/os0file.cc
storage/xtradb/srv/srv0start.cc
Diffstat (limited to 'mysql-test/lib/My/SafeProcess/safe_process.cc')
-rw-r--r-- | mysql-test/lib/My/SafeProcess/safe_process.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc index d6110f5f8c8..feb3eb4df66 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc @@ -125,7 +125,7 @@ extern "C" void handle_abort(int sig) message("Got signal %d, child_pid: %d, sending ABRT", sig, child_pid); if (child_pid > 0) { - kill (-child_pid, SIGABRT); // Don't wait for it to terminate + kill(-child_pid, SIGABRT); // Don't wait for it to terminate } } @@ -226,6 +226,18 @@ int main(int argc, char* const argv[] ) sleep(1); } + /* + Child: Make this process it's own process group to be able to kill + it and any its children that hasn't changed a group themselves) + + Parent: Detach from the parent's process group, so that killing a parent + group wouldn't kill us (if we're killed, there's no one to kill our child + processes that run in their own process group). There's a loop below + that monitors the parent, it's enough. + */ + setpgid(0, 0); + + if (child_pid == 0) { close(pfd[0]); // Close unused read end @@ -236,10 +248,6 @@ int main(int argc, char* const argv[] ) signal(SIGHUP, SIG_DFL); signal(SIGCHLD, SIG_DFL); - // Make this process it's own process group to be able to kill - // it and any childs(that hasn't changed group themself) - setpgid(0, 0); - if (nocore) { struct rlimit corelim = { 0, 0 }; |