Changes: Minor refactoring, added/improved some comments.

pull/1/head
Jussi Lind 15 years ago
parent ae7a5b72eb
commit bcd260fca8

@ -178,7 +178,11 @@ bool Booster::bootMode() const
void Booster::sendDataToParent() void Booster::sendDataToParent()
{ {
struct iovec iov[3]; // Number of data items to be sent to
// the parent (launcher) process
const unsigned int NUM_DATA_ITEMS = 3;
struct iovec iov[NUM_DATA_ITEMS];
struct msghdr msg; struct msghdr msg;
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
char buf[CMSG_SPACE(sizeof(int))]; char buf[CMSG_SPACE(sizeof(int))];
@ -200,9 +204,15 @@ void Booster::sendDataToParent()
iov[2].iov_len = sizeof(int); iov[2].iov_len = sizeof(int);
msg.msg_iov = iov; msg.msg_iov = iov;
msg.msg_iovlen = 3; msg.msg_iovlen = NUM_DATA_ITEMS;
msg.msg_name = NULL; msg.msg_name = NULL;
msg.msg_namelen = 0; msg.msg_namelen = 0;
// Set special control fields if exit status of the launched
// application is needed. In this case we want to give the fd of the
// invoker <-> booster socket connection to the parent process (launcher)
// so that it can send the exit status back to invoker. It'd be impossible
// from the booster process if exec() was used.
if (m_connection->isReportAppExitStatusNeeded()) if (m_connection->isReportAppExitStatusNeeded())
{ {
// Send socket file descriptor to parent // Send socket file descriptor to parent

@ -201,10 +201,11 @@ protected:
//! Restore the old priority stored by the previous successful setPriority(). //! Restore the old priority stored by the previous successful setPriority().
bool popPriority(); bool popPriority();
//! Sets socket fd's used to communicate with the parent process //! Sets the socket fd used in the communication between
//! the booster and launcher.
void setBoosterLauncherSocket(int boosterLauncherSocket); void setBoosterLauncherSocket(int boosterLauncherSocket);
//! Returns the given socket //! Returns the socket fd between the booster and launcher.
int boosterLauncherSocket() const; int boosterLauncherSocket() const;
//! Reset out-of-memory killer adjustment //! Reset out-of-memory killer adjustment

Loading…
Cancel
Save