| 407 | |
| 408 | |
| 409 | Try<Nothing> verify( |
| 410 | const string& hierarchy, |
| 411 | const string& cgroup, |
| 412 | const string& control) |
| 413 | { |
| 414 | Try<bool> mounted = cgroups::mounted(hierarchy); |
| 415 | if (mounted.isError()) { |
| 416 | return Error( |
| 417 | "Failed to determine if the hierarchy at '" + hierarchy + |
| 418 | "' is mounted: " + mounted.error()); |
| 419 | } else if (!mounted.get()) { |
| 420 | return Error("'" + hierarchy + "' is not a valid hierarchy"); |
| 421 | } |
| 422 | |
| 423 | if (cgroup != "") { |
| 424 | if (!os::exists(path::join(hierarchy, cgroup))) { |
| 425 | return Error("'" + cgroup + "' is not a valid cgroup"); |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | if (control != "") { |
| 430 | if (!os::exists(path::join(hierarchy, cgroup, control))) { |
| 431 | return Error( |
| 432 | "'" + control + "' is not a valid control (is subsystem attached?)"); |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | return Nothing(); |
| 437 | } |
| 438 | |
| 439 | |
| 440 | bool enabled() |