| 525 | |
| 526 | |
| 527 | Try<bool> busy(const string& subsystems) |
| 528 | { |
| 529 | Try<map<string, internal::SubsystemInfo>> infosResult = |
| 530 | internal::subsystems(); |
| 531 | if (infosResult.isError()) { |
| 532 | return Error(infosResult.error()); |
| 533 | } |
| 534 | |
| 535 | map<string, internal::SubsystemInfo> infos = infosResult.get(); |
| 536 | bool busy = false; |
| 537 | |
| 538 | foreach (const string& subsystem, strings::tokenize(subsystems, ",")) { |
| 539 | if (infos.find(subsystem) == infos.end()) { |
| 540 | return Error("'" + subsystem + "' not found"); |
| 541 | } |
| 542 | if (infos[subsystem].hierarchy != 0) { |
| 543 | // Here, we don't return false immediately because we want to return |
| 544 | // error if any of the given subsystems is missing. |
| 545 | busy = true; |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | return busy; |
| 550 | } |
| 551 | |
| 552 | |
| 553 | Try<set<string>> subsystems() |