Deprecate IPC::comms()

PiperOrigin-RevId: 358380648
Change-Id: Iaf8f7dc0890be0e7e910649c6f519504f6b0a1a5
This commit is contained in:
Wiktor Garbacz 2021-02-19 04:42:52 -08:00 committed by Copybara-Service
parent 3d0fa1f891
commit 298271f0a7
4 changed files with 7 additions and 9 deletions

View File

@ -141,12 +141,10 @@ TEST(BufferTest, TestWithSandboxeeSendRecv) {
const std::string path = GetTestSourcePath("sandbox2/testcases/buffer");
std::vector<std::string> args = {path, "2"};
auto executor = absl::make_unique<Executor>(path, args);
auto* comms = executor->ipc()->comms();
auto policy = BufferTestcasePolicy();
Sandbox2 s2(std::move(executor), std::move(policy));
Sandbox2 s2(std::move(executor), BufferTestcasePolicy());
ASSERT_THAT(s2.RunAsync(), IsTrue());
Comms* comms = s2.comms();
SAPI_ASSERT_OK_AND_ASSIGN(auto buffer,
Buffer::CreateWithSize(1ULL << 20 /* 1MiB */));

View File

@ -116,10 +116,7 @@ int main(int argc, char** argv) {
.set_rlimit_cpu(60) // The CPU time limit in seconds.
.set_walltime_limit(absl::Seconds(5));
auto* comms = executor->ipc()->comms();
auto policy = GetPolicy();
sandbox2::Sandbox2 s2(std::move(executor), std::move(policy));
sandbox2::Sandbox2 s2(std::move(executor), GetPolicy());
// Let the sandboxee run.
if (!s2.RunAsync()) {
@ -128,6 +125,8 @@ int main(int argc, char** argv) {
return 2;
}
sandbox2::Comms* comms = s2.comms();
uint32_t crc4;
if (!SandboxedCRC4(comms, &crc4)) {
LOG(ERROR) << "GetCRC4 failed";

View File

@ -37,6 +37,7 @@ class IPC final {
~IPC() { InternalCleanupFdMap(); }
ABSL_DEPRECATED("Use Sandbox2::comms() instead")
Comms* comms() const { return comms_.get(); }
// Marks local_fd so that it should be sent to the remote process (sandboxee),

View File

@ -241,11 +241,11 @@ bool StackTracePeer::LaunchLibunwindSandbox(const Regs* regs,
if (!policy) {
return false;
}
auto* comms = executor->ipc()->comms();
Sandbox2 sandbox(std::move(executor), std::move(policy));
VLOG(1) << "Running libunwind sandbox";
sandbox.RunAsync();
Comms* comms = sandbox.comms();
UnwindSetup msg;
msg.set_pid(pid);