| 472 | } |
| 473 | |
| 474 | int AdminSocket::execute_command( |
| 475 | const std::vector<std::string>& cmd, |
| 476 | const bufferlist& inbl, |
| 477 | std::ostream& errss, |
| 478 | bufferlist *outbl) |
| 479 | { |
| 480 | #ifdef WITH_CRIMSON |
| 481 | // TODO: crimson: blocking execute_command() in alien thread |
| 482 | return -ENOSYS; |
| 483 | #else |
| 484 | bool done = false; |
| 485 | int rval = 0; |
| 486 | ceph::mutex mylock = ceph::make_mutex("admin_socket::excute_command::mylock"); |
| 487 | ceph::condition_variable mycond; |
| 488 | C_SafeCond fin(mylock, mycond, &done, &rval); |
| 489 | execute_command( |
| 490 | cmd, |
| 491 | inbl, |
| 492 | [&errss, outbl, &fin](int r, std::string_view err, bufferlist& out) { |
| 493 | errss << err; |
| 494 | *outbl = std::move(out); |
| 495 | fin.finish(r); |
| 496 | }); |
| 497 | { |
| 498 | std::unique_lock l{mylock}; |
| 499 | mycond.wait(l, [&done] { return done;}); |
| 500 | } |
| 501 | return rval; |
| 502 | #endif |
| 503 | } |
| 504 | |
| 505 | void AdminSocket::execute_command( |
| 506 | const std::vector<std::string>& cmdvec, |
no test coverage detected