NOTE: Returning an Error implies the child process will be killed.
| 75 | |
| 76 | // NOTE: Returning an Error implies the child process will be killed. |
| 77 | Try<Nothing> extendLifetime(pid_t child) |
| 78 | { |
| 79 | if (!systemd::exists()) { |
| 80 | return Error("Failed to contain process on systemd: " |
| 81 | "systemd does not exist on this system"); |
| 82 | } |
| 83 | |
| 84 | if (!systemd::enabled()) { |
| 85 | return Error("Failed to contain process on systemd: " |
| 86 | "systemd is not configured as enabled on this system"); |
| 87 | } |
| 88 | |
| 89 | Try<Nothing> assign = cgroups::assign( |
| 90 | hierarchy(), |
| 91 | systemd::mesos::MESOS_EXECUTORS_SLICE, |
| 92 | child); |
| 93 | |
| 94 | if (assign.isError()) { |
| 95 | return Error("Failed to contain process on systemd: " |
| 96 | "Failed to assign process to its systemd executor slice: " + |
| 97 | assign.error()); |
| 98 | } |
| 99 | |
| 100 | LOG(INFO) << "Assigned child process '" << child << "' to '" |
| 101 | << systemd::mesos::MESOS_EXECUTORS_SLICE << "'"; |
| 102 | |
| 103 | return Nothing(); |
| 104 | } |
| 105 | |
| 106 | } // namespace mesos { |
| 107 |