|
|
|
@ -74,8 +74,10 @@ void Booster::initialize(int initialArgc, char ** initialArgv, int newPipeFd[2])
|
|
|
|
popPriority();
|
|
|
|
popPriority();
|
|
|
|
|
|
|
|
|
|
|
|
// Wait and read commands from the invoker
|
|
|
|
// Wait and read commands from the invoker
|
|
|
|
Logger::logNotice("Daemon: Wait for message from invoker");
|
|
|
|
Logger::logNotice("Booster: Wait for message from invoker");
|
|
|
|
readCommand();
|
|
|
|
if (!readCommand()) {
|
|
|
|
|
|
|
|
Logger::logError("Booster: Couldn't read command\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Give the process the real application name now that it
|
|
|
|
// Give the process the real application name now that it
|
|
|
|
// has been read from invoker in readCommand().
|
|
|
|
// has been read from invoker in readCommand().
|
|
|
|
@ -84,15 +86,13 @@ void Booster::initialize(int initialArgc, char ** initialArgv, int newPipeFd[2])
|
|
|
|
// Signal the parent process that it can create a new
|
|
|
|
// Signal the parent process that it can create a new
|
|
|
|
// waiting booster process and close write end
|
|
|
|
// waiting booster process and close write end
|
|
|
|
const char msg = boosterType();
|
|
|
|
const char msg = boosterType();
|
|
|
|
ssize_t ret = write(pipeFd(1), reinterpret_cast<const void *>(&msg), 1);
|
|
|
|
if (write(pipeFd(1), reinterpret_cast<const void *>(&msg), 1) == -1) {
|
|
|
|
if (ret == -1) {
|
|
|
|
|
|
|
|
Logger::logError("Booster: Couldn't send type message to launcher process\n");
|
|
|
|
Logger::logError("Booster: Couldn't send type message to launcher process\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Send to the parent process pid of invoker for tracking
|
|
|
|
// Send to the parent process pid of invoker for tracking
|
|
|
|
pid_t pid = invokersPid();
|
|
|
|
pid_t pid = invokersPid();
|
|
|
|
ret = write(pipeFd(1), reinterpret_cast<const void *>(&pid), sizeof(pid_t));
|
|
|
|
if (write(pipeFd(1), reinterpret_cast<const void *>(&pid), sizeof(pid_t)) == -1) {
|
|
|
|
if (ret == -1) {
|
|
|
|
|
|
|
|
Logger::logError("Booster: Couldn't send invoker's pid to launcher process\n");
|
|
|
|
Logger::logError("Booster: Couldn't send invoker's pid to launcher process\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -121,13 +121,15 @@ bool Booster::readCommand()
|
|
|
|
// Accept a new invocation.
|
|
|
|
// Accept a new invocation.
|
|
|
|
if (m_conn->acceptConn(m_app))
|
|
|
|
if (m_conn->acceptConn(m_app))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool res = m_conn->receiveApplicationData(m_app);
|
|
|
|
// Receive application data from the invoker
|
|
|
|
if(!res)
|
|
|
|
if(!m_conn->receiveApplicationData(m_app))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_conn->closeConn();
|
|
|
|
m_conn->closeConn();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Close the connection if exit status doesn't need
|
|
|
|
|
|
|
|
// to be sent back to invoker
|
|
|
|
if (!m_conn->isReportAppExitStatusNeeded())
|
|
|
|
if (!m_conn->isReportAppExitStatusNeeded())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_conn->closeConn();
|
|
|
|
m_conn->closeConn();
|
|
|
|
|