| 3197 | |
| 3198 | |
| 3199 | Future<Option<int>> MesosContainerizerProcess::reap( |
| 3200 | const ContainerID& containerId, |
| 3201 | pid_t pid) |
| 3202 | { |
| 3203 | #ifdef __WINDOWS__ |
| 3204 | // We currently don't checkpoint the wait status on windows so |
| 3205 | // just return the reaped status directly. |
| 3206 | return process::reap(pid); |
| 3207 | #else |
| 3208 | return process::reap(pid) |
| 3209 | .then(defer(self(), [=](const Option<int>& status) -> Future<Option<int>> { |
| 3210 | // Determine if we just reaped a legacy container or a |
| 3211 | // non-legacy container. We do this by checking for the |
| 3212 | // existence of the container runtime directory (which only |
| 3213 | // exists for new (i.e. non-legacy) containers). If it is a |
| 3214 | // legacy container, we simply forward the reaped exit status |
| 3215 | // back to the caller. |
| 3216 | const string runtimePath = |
| 3217 | containerizer::paths::getRuntimePath(flags.runtime_dir, containerId); |
| 3218 | |
| 3219 | if (!os::exists(runtimePath)) { |
| 3220 | return status; |
| 3221 | } |
| 3222 | |
| 3223 | // If we are a non-legacy container, attempt to reap the |
| 3224 | // container status from the checkpointed status file. |
| 3225 | Result<int> containerStatus = |
| 3226 | containerizer::paths::getContainerStatus( |
| 3227 | flags.runtime_dir, |
| 3228 | containerId); |
| 3229 | |
| 3230 | if (containerStatus.isError()) { |
| 3231 | return Failure("Failed to get container status: " + |
| 3232 | containerStatus.error()); |
| 3233 | } else if (containerStatus.isSome()) { |
| 3234 | return containerStatus.get(); |
| 3235 | } |
| 3236 | |
| 3237 | // If there isn't a container status file or it is empty, then the |
| 3238 | // init process must have been interrupted by a SIGKILL before |
| 3239 | // it had a chance to write the file. Return as such. |
| 3240 | return W_EXITCODE(0, SIGKILL); |
| 3241 | })); |
| 3242 | #endif // __WINDOWS__ |
| 3243 | } |
| 3244 | |
| 3245 | |
| 3246 | void MesosContainerizerProcess::reaped(const ContainerID& containerId) |
nothing calls this directly
no test coverage detected