diff options
author | Bernard Normier <bernard@zeroc.com> | 2003-05-19 19:58:08 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2003-05-19 19:58:08 +0000 |
commit | 2787116fe13f780deee2086f8a94ae2442ffd338 (patch) | |
tree | 25baca28074fae7bae33a28d1709a00133995aa5 /cpp/src/IcePack/ActivatorI.cpp | |
parent | All leaf build.xml files now include config/build.properties to get build (diff) | |
download | ice-2787116fe13f780deee2086f8a94ae2442ffd338.tar.bz2 ice-2787116fe13f780deee2086f8a94ae2442ffd338.tar.xz ice-2787116fe13f780deee2086f8a94ae2442ffd338.zip |
Switched to process groups on Linux
Diffstat (limited to 'cpp/src/IcePack/ActivatorI.cpp')
-rw-r--r-- | cpp/src/IcePack/ActivatorI.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cpp/src/IcePack/ActivatorI.cpp b/cpp/src/IcePack/ActivatorI.cpp index 807dd2e5c10..e9a992566c2 100644 --- a/cpp/src/IcePack/ActivatorI.cpp +++ b/cpp/src/IcePack/ActivatorI.cpp @@ -227,6 +227,13 @@ IcePack::ActivatorI::activate(const ServerPtr& server) } if(pid == 0) // Child process. { + +#ifdef __linux + // Create a process group for this child, to be able to send + // a signal to all the thread-processes with killpg + // + setpgrp(); +#endif // // Close all file descriptors, except for standard input, // standard output, standard error output, and the write side @@ -365,7 +372,13 @@ IcePack::ActivatorI::deactivate(const ServerPtr& server) // // Send a SIGTERM to the process. // + +#ifdef __linux + // Use process groups on Linux instead of processes + int ret = ::killpg(static_cast<pid_t>(pid), SIGTERM); +#else int ret = ::kill(static_cast<pid_t>(pid), SIGTERM); +#endif if(ret != 0 && getSystemErrno() != ESRCH) { SyscallException ex(__FILE__, __LINE__); @@ -396,7 +409,12 @@ IcePack::ActivatorI::kill(const ServerPtr& server) // // Send a SIGKILL to the process. // +#ifdef __linux + // Use process groups on Linux instead of processes + int ret = ::killpg(static_cast<pid_t>(pid), SIGKILL); +#else int ret = ::kill(static_cast<pid_t>(pid), SIGKILL); +#endif if(ret != 0 && getSystemErrno() != ESRCH) { SyscallException ex(__FILE__, __LINE__); |