std::string ProcessReturnCode::str() const { switch (state()) { case NOT_STARTED: return "not started"; case RUNNING: return "running"; case EXITED: return to<std::string>("exited with status ", exitStatus()); case KILLED: return to<std::string>("killed by signal ", killSignal(), (coreDumped() ? " (core dumped)" : "")); } CHECK(false); // unreached }
// // Perform the canonical last rites for a formerly alive child. // Requires master lock held throughout. // void Child::bury(int status) { assert(mState == alive); mState = dead; mStatus = status; mChildren().erase(mPid); #if !defined(NDEBUG) if (bySignal()) secdebug("unixchild", "%p (pid %d) died by signal %d%s", this, mPid, exitSignal(), coreDumped() ? " and dumped core" : ""); else secdebug("unixchild", "%p (pid %d) died by exit(%d)", this, mPid, exitCode()); #endif //NDEBUG }