Replace deprecated SetWalltimeLimit call

PiperOrigin-RevId: 433414976
Change-Id: I0597a2d8215d4b228794da409e3533651972a98c
This commit is contained in:
Wiktor Garbacz 2022-03-09 01:01:16 -08:00 committed by Copybara-Service
parent 622ca18cef
commit 612ff57913
3 changed files with 4 additions and 1 deletions

View File

@ -38,6 +38,7 @@ cc_binary(
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/time",
], ],
) )

View File

@ -21,6 +21,7 @@ add_executable(sandbox2::sandbox2tool ALIAS sandbox2_sandbox2tool)
target_link_libraries(sandbox2_sandbox2tool PRIVATE target_link_libraries(sandbox2_sandbox2tool PRIVATE
absl::memory absl::memory
absl::strings absl::strings
absl::time
sandbox2::bpf_helper sandbox2::bpf_helper
# sandbox2::ipc # sandbox2::ipc
sandbox2::sandbox2 sandbox2::sandbox2

View File

@ -39,6 +39,7 @@
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
#include "absl/time/time.h"
#include "sandboxed_api/sandbox2/executor.h" #include "sandboxed_api/sandbox2/executor.h"
#include "sandboxed_api/sandbox2/ipc.h" #include "sandboxed_api/sandbox2/ipc.h"
#include "sandboxed_api/sandbox2/limits.h" #include "sandboxed_api/sandbox2/limits.h"
@ -202,7 +203,7 @@ int main(int argc, char** argv) {
sleep(3); sleep(3);
kill(s2.pid(), SIGSTOP); kill(s2.pid(), SIGSTOP);
sleep(3); sleep(3);
s2.SetWallTimeLimit(3); s2.set_walltime_limit(absl::Seconds(3));
kill(s2.pid(), 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);