Replace deprecated calls

PiperOrigin-RevId: 423037776
Change-Id: Id568d54854dde3778686b778648555e0b48204bc
This commit is contained in:
Wiktor Garbacz 2022-01-20 04:39:48 -08:00 committed by Copybara-Service
parent 38a1cb707f
commit 4a945a1748
6 changed files with 14 additions and 14 deletions

View File

@ -175,10 +175,10 @@ void Client::ReceivePolicy() {
} }
void Client::ApplyPolicyAndBecomeTracee() { void Client::ApplyPolicyAndBecomeTracee() {
// When running under TSAN, we need to notify TSANs background thread that we // When running under *SAN, we need to notify *SANs background thread that we
// want it to exit and wait for it to be done. When not running under TSAN, // want it to exit and wait for it to be done. When not running under *SAN,
// this function does nothing. // this function does nothing.
sanitizer::WaitForTsan(); sanitizer::WaitForSanitizer();
// Creds can be received w/o synchronization, once the connection is // Creds can be received w/o synchronization, once the connection is
// established. // established.

View File

@ -36,7 +36,7 @@ class CRC4Test : public ::testing::Test {
protected: protected:
void SetUp() override { void SetUp() override {
path_ = GetTestSourcePath("sandbox2/examples/crc4/crc4sandbox"); path_ = GetTestSourcePath("sandbox2/examples/crc4/crc4sandbox");
util::CharPtrArrToVecString(environ, &env_); env_ = util::CharPtrArray(environ).ToStringVector();
} }
std::string path_; std::string path_;

View File

@ -83,7 +83,7 @@ static int SandboxIteration(sandbox2::ForkClient* fork_client, int32_t i) {
CHECK(s2.comms()->SendInt32(i)); CHECK(s2.comms()->SendInt32(i));
sandbox2::Result result = s2.AwaitResult(); sandbox2::Result result = s2.AwaitResult();
LOG(INFO) << "Final execution status of PID " << s2.GetPid() << ": " LOG(INFO) << "Final execution status of PID " << s2.pid() << ": "
<< result.ToString(); << result.ToString();
if (result.final_status() != sandbox2::Result::OK) { if (result.final_status() != sandbox2::Result::OK) {

View File

@ -113,13 +113,13 @@ int main(int argc, char** argv) {
} }
// Pass everything after '--' to the sandbox. // Pass everything after '--' to the sandbox.
std::vector<std::string> args; std::vector<std::string> args =
sandbox2::util::CharPtrArrToVecString(&argv[1], &args); sandbox2::util::CharPtrArray(&argv[1]).ToStringVector();
// Pass the current environ pointer, depending on the flag. // Pass the current environ pointer, depending on the flag.
std::vector<std::string> envp; std::vector<std::string> envp;
if (absl::GetFlag(FLAGS_sandbox2tool_keep_env)) { if (absl::GetFlag(FLAGS_sandbox2tool_keep_env)) {
sandbox2::util::CharPtrArrToVecString(environ, &envp); envp = sandbox2::util::CharPtrArray(environ).ToStringVector();
} }
auto executor = absl::make_unique<sandbox2::Executor>(argv[1], args, envp); auto executor = absl::make_unique<sandbox2::Executor>(argv[1], args, envp);
@ -200,15 +200,15 @@ int main(int argc, char** argv) {
if (s2.RunAsync()) { if (s2.RunAsync()) {
if (absl::GetFlag(FLAGS_sandbox2tool_pause_resume)) { if (absl::GetFlag(FLAGS_sandbox2tool_pause_resume)) {
sleep(3); sleep(3);
kill(s2.GetPid(), SIGSTOP); kill(s2.pid(), SIGSTOP);
sleep(3); sleep(3);
s2.SetWallTimeLimit(3); s2.SetWallTimeLimit(3);
kill(s2.GetPid(), SIGCONT); kill(s2.pid(), SIGCONT);
} else if (absl::GetFlag(FLAGS_sandbox2tool_pause_kill)) { } else if (absl::GetFlag(FLAGS_sandbox2tool_pause_kill)) {
sleep(3); sleep(3);
kill(s2.GetPid(), SIGSTOP); kill(s2.pid(), SIGSTOP);
sleep(1); sleep(1);
kill(s2.GetPid(), SIGKILL); kill(s2.pid(), SIGKILL);
sleep(1); sleep(1);
} else if (absl::GetFlag(FLAGS_sandbox2tool_dump_stack)) { } else if (absl::GetFlag(FLAGS_sandbox2tool_dump_stack)) {
sleep(1); sleep(1);

View File

@ -27,7 +27,7 @@ pid_t ForkingClient::WaitAndFork() {
// place (in order to conserve resources, and avoid calling Fork-Server // place (in order to conserve resources, and avoid calling Fork-Server
// initialization routines). // initialization routines).
if (!fork_server_worker_) { if (!fork_server_worker_) {
sanitizer::WaitForTsan(); sanitizer::WaitForSanitizer();
// Perform that check once only, because it's quite CPU-expensive. // Perform that check once only, because it's quite CPU-expensive.
int n = sanitizer::GetNumberOfThreads(getpid()); int n = sanitizer::GetNumberOfThreads(getpid());
CHECK_NE(n, -1) << "sanitizer::GetNumberOfThreads failed"; CHECK_NE(n, -1) << "sanitizer::GetNumberOfThreads failed";

View File

@ -648,7 +648,7 @@ bool Monitor::WaitForSandboxReady() {
} }
bool Monitor::InitPtraceAttach() { bool Monitor::InitPtraceAttach() {
sanitizer::WaitForTsan(); sanitizer::WaitForSanitizer();
// Get a list of tasks. // Get a list of tasks.
absl::flat_hash_set<int> tasks; absl::flat_hash_set<int> tasks;