Readd VLOGs removed by mistake

PiperOrigin-RevId: 557739843
Change-Id: I21497028fc26388fec8a45ee1bfa2f11cf9022d2
This commit is contained in:
Wiktor Garbacz 2023-08-17 01:12:41 -07:00 committed by Copybara-Service
parent 7d78b89777
commit 0a0bf05dc3
2 changed files with 9 additions and 2 deletions

View File

@ -157,6 +157,7 @@ target_link_libraries(sandbox2_ipc PRIVATE
sandbox2::network_proxy_client sandbox2::network_proxy_client
sandbox2::network_proxy_server sandbox2::network_proxy_server
sapi::base sapi::base
sapi::raw_logging
) )
# sandboxed_api/sandbox2:policy # sandboxed_api/sandbox2:policy

View File

@ -29,12 +29,14 @@
#include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/comms.h"
#include "sandboxed_api/sandbox2/logserver.h" #include "sandboxed_api/sandbox2/logserver.h"
#include "sandboxed_api/sandbox2/logsink.h" #include "sandboxed_api/sandbox2/logsink.h"
#include "sandboxed_api/util/raw_logging.h"
namespace sandbox2 { namespace sandbox2 {
void IPC::SetUpServerSideComms(int fd) { comms_ = std::make_unique<Comms>(fd); } void IPC::SetUpServerSideComms(int fd) { comms_ = std::make_unique<Comms>(fd); }
void IPC::MapFd(int local_fd, int remote_fd) { void IPC::MapFd(int local_fd, int remote_fd) {
VLOG(3) << "Will send: " << local_fd << ", to overwrite: " << remote_fd;
fd_map_.push_back(std::make_tuple(local_fd, remote_fd, "")); fd_map_.push_back(std::make_tuple(local_fd, remote_fd, ""));
} }
@ -43,6 +45,8 @@ void IPC::MapDupedFd(int local_fd, int remote_fd) {
if (dup_local_fd == -1) { if (dup_local_fd == -1) {
PLOG(FATAL) << "dup(" << local_fd << ")"; PLOG(FATAL) << "dup(" << local_fd << ")";
} }
VLOG(3) << "Will send: " << dup_local_fd << " (dup of " << local_fd
<< "), to overwrite: " << remote_fd;
fd_map_.push_back(std::make_tuple(dup_local_fd, remote_fd, "")); fd_map_.push_back(std::make_tuple(dup_local_fd, remote_fd, ""));
} }
@ -55,9 +59,9 @@ int IPC::ReceiveFd(int remote_fd, absl::string_view name) {
if (socketpair(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) == -1) { if (socketpair(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) == -1) {
PLOG(FATAL) << "socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)"; PLOG(FATAL) << "socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)";
} }
VLOG(3) << "Created a socketpair (" << sv[0] << "/" << sv[1] << "), "
<< "which will overwrite remote_fd: " << remote_fd;
fd_map_.push_back(std::make_tuple(sv[1], remote_fd, std::string(name))); fd_map_.push_back(std::make_tuple(sv[1], remote_fd, std::string(name)));
return sv[0]; return sv[0];
} }
@ -81,6 +85,8 @@ bool IPC::SendFdsOverComms() {
LOG(ERROR) << "SendString: Couldn't send " << std::get<2>(fd_tuple); LOG(ERROR) << "SendString: Couldn't send " << std::get<2>(fd_tuple);
return false; return false;
} }
VLOG(3) << "IPC: local_fd: " << std::get<0>(fd_tuple)
<< ", remote_fd: " << std::get<1>(fd_tuple) << " sent";
} }
return true; return true;