| 2350 | |
| 2351 | |
| 2352 | Result<Bytes> memsw_limit_in_bytes( |
| 2353 | const string& hierarchy, |
| 2354 | const string& cgroup) |
| 2355 | { |
| 2356 | if (!cgroups::exists(hierarchy, cgroup, "memory.memsw.limit_in_bytes")) { |
| 2357 | return None(); |
| 2358 | } |
| 2359 | |
| 2360 | Try<string> read = cgroups::read( |
| 2361 | hierarchy, cgroup, "memory.memsw.limit_in_bytes"); |
| 2362 | |
| 2363 | if (read.isError()) { |
| 2364 | return Error(read.error()); |
| 2365 | } |
| 2366 | |
| 2367 | Try<Bytes> bytes = Bytes::parse(strings::trim(read.get()) + "B"); |
| 2368 | |
| 2369 | if (bytes.isError()) { |
| 2370 | return Error(bytes.error()); |
| 2371 | } |
| 2372 | |
| 2373 | return bytes.get(); |
| 2374 | } |
| 2375 | |
| 2376 | |
| 2377 | Try<bool> memsw_limit_in_bytes( |