summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2003-12-04 17:56:55 +0000
committerMarc Laukien <marc@zeroc.com>2003-12-04 17:56:55 +0000
commite54c2096d0b749fe9b46a233779837fdb759613c (patch)
treeb1123ac86ecc159562e82971983a30e3adb8ddd5
parentminor fix to usage (diff)
downloadice-e54c2096d0b749fe9b46a233779837fdb759613c.tar.bz2
ice-e54c2096d0b749fe9b46a233779837fdb759613c.tar.xz
ice-e54c2096d0b749fe9b46a233779837fdb759613c.zip
fix
-rw-r--r--cpp/src/Glacier/GlacierStarter.cpp7
-rw-r--r--cpp/src/Glacier/StarterI.cpp12
-rw-r--r--cpp/src/IcePack/ActivatorI.cpp3
3 files changed, 20 insertions, 2 deletions
diff --git a/cpp/src/Glacier/GlacierStarter.cpp b/cpp/src/Glacier/GlacierStarter.cpp
index 3b946904c45..a00e8f88bb9 100644
--- a/cpp/src/Glacier/GlacierStarter.cpp
+++ b/cpp/src/Glacier/GlacierStarter.cpp
@@ -166,11 +166,18 @@ Glacier::RouterApp::run(int argc, char* argv[])
extern "C"
{
+
static void
childHandler(int)
{
+ //
+ // Call wait to de-allocate any ressources allocated for the child
+ // process and avoid zombie processes. See man wait or waitpid for
+ // more information.
+ //
wait(0);
}
+
}
int
diff --git a/cpp/src/Glacier/StarterI.cpp b/cpp/src/Glacier/StarterI.cpp
index 5be32d5b995..80a56e487b2 100644
--- a/cpp/src/Glacier/StarterI.cpp
+++ b/cpp/src/Glacier/StarterI.cpp
@@ -57,7 +57,8 @@ Glacier::StarterI::StarterI(const CommunicatorPtr& communicator, const PasswordV
Int bitStrength = _properties->getPropertyAsIntWithDefault(
"Glacier.Starter.Certificate.BitStrength", 1024);
Int secondsValid = _properties->getPropertyAsIntWithDefault(
- "Glacier.Starter.Certificate.SecondsValid", static_cast<Int>(IceSSL::RSACertificateGenContext::daysToSeconds(1)));
+ "Glacier.Starter.Certificate.SecondsValid",
+ static_cast<Int>(IceSSL::RSACertificateGenContext::daysToSeconds(1)));
Int issuedAdjust = _properties->getPropertyAsIntWithDefault("Glacier.Starter.Certificate.IssuedAdjust", 0);
_certContext.setCountry(country);
@@ -283,6 +284,14 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
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 filedescriptors, except for standard input,
// standard output, standard error output, and the write side
@@ -325,6 +334,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
string msg = "can't execute `" + path + "': " + strerror(errno);
write(fds[1], msg.c_str(), msg.length());
close(fds[1]);
+ //sleep(100000); //XXX
exit(EXIT_FAILURE);
}
}
diff --git a/cpp/src/IcePack/ActivatorI.cpp b/cpp/src/IcePack/ActivatorI.cpp
index cbf990cfed7..531521fa138 100644
--- a/cpp/src/IcePack/ActivatorI.cpp
+++ b/cpp/src/IcePack/ActivatorI.cpp
@@ -211,9 +211,9 @@ IcePack::ActivatorI::activate(const ServerPtr& server)
ex.error = getSystemErrno();
throw ex;
}
+
if(pid == 0) // Child process.
{
-
#ifdef __linux
//
// Create a process group for this child, to be able to send
@@ -221,6 +221,7 @@ IcePack::ActivatorI::activate(const ServerPtr& server)
//
setpgrp();
#endif
+
//
// Close all file descriptors, except for standard input,
// standard output, standard error output, and the write side