| 2520 | |
| 2521 | |
| 2522 | Try<Nothing> disable(const string& hierarchy, const string& cgroup) |
| 2523 | { |
| 2524 | Try<bool> enabled = killer::enabled(hierarchy, cgroup); |
| 2525 | |
| 2526 | if (enabled.isError()) { |
| 2527 | return Error(enabled.error()); |
| 2528 | } |
| 2529 | |
| 2530 | if (enabled.get()) { |
| 2531 | Try<Nothing> write = cgroups::write( |
| 2532 | hierarchy, cgroup, "memory.oom_control", "1"); |
| 2533 | |
| 2534 | if (write.isError()) { |
| 2535 | return Error("Could not write 'memory.oom_control' control file: " + |
| 2536 | write.error()); |
| 2537 | } |
| 2538 | } |
| 2539 | |
| 2540 | return Nothing(); |
| 2541 | } |
| 2542 | |
| 2543 | } // namespace killer { |
| 2544 | |