| 444 | |
| 445 | |
| 446 | Try<set<string>> hierarchies() |
| 447 | { |
| 448 | // Read currently mounted file systems from /proc/mounts. |
| 449 | Try<fs::MountTable> table = fs::MountTable::read("/proc/mounts"); |
| 450 | if (table.isError()) { |
| 451 | return Error(table.error()); |
| 452 | } |
| 453 | |
| 454 | set<string> results; |
| 455 | foreach (const fs::MountTable::Entry& entry, table->entries) { |
| 456 | if (entry.type == "cgroup") { |
| 457 | Result<string> realpath = os::realpath(entry.dir); |
| 458 | if (!realpath.isSome()) { |
| 459 | return Error( |
| 460 | "Failed to determine canonical path of " + entry.dir + ": " + |
| 461 | (realpath.isError() |
| 462 | ? realpath.error() |
| 463 | : "No such file or directory")); |
| 464 | } |
| 465 | results.insert(realpath.get()); |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | return results; |
| 470 | } |
| 471 | |
| 472 | |
| 473 | Result<string> hierarchy(const string& subsystems) |