From c400f92eaa8c6fe197badcc840d2c3f09840fc42 Mon Sep 17 00:00:00 2001 From: Christian Blichmann Date: Thu, 16 Sep 2021 06:56:52 -0700 Subject: [PATCH] (Mostly) internal change. Add `pid()` accessor. PiperOrigin-RevId: 397070773 Change-Id: I9ebac9078f3866ef3e0061ec79da5c9f71e5f480 --- sandboxed_api/sandbox2/sandbox2.cc | 4 ---- sandboxed_api/sandbox2/sandbox2.h | 11 ++++++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sandboxed_api/sandbox2/sandbox2.cc b/sandboxed_api/sandbox2/sandbox2.cc index d0c1e22..ebbd9ab 100644 --- a/sandboxed_api/sandbox2/sandbox2.cc +++ b/sandboxed_api/sandbox2/sandbox2.cc @@ -99,10 +99,6 @@ bool Sandbox2::IsTerminated() const { return monitor_->IsDone(); } -void Sandbox2::SetWallTimeLimit(time_t limit) const { - set_walltime_limit(absl::Seconds(limit)); -} - void Sandbox2::set_walltime_limit(absl::Duration limit) const { if (limit == absl::ZeroDuration()) { VLOG(1) << "Disarming walltime timer to "; diff --git a/sandboxed_api/sandbox2/sandbox2.h b/sandboxed_api/sandbox2/sandbox2.h index a3ae98e..6ec1db1 100644 --- a/sandboxed_api/sandbox2/sandbox2.h +++ b/sandboxed_api/sandbox2/sandbox2.h @@ -95,7 +95,9 @@ class Sandbox2 final { // for responses after each request and reset the deadline in between. // Sandboxed API can be used to implement persistent sandboxes. ABSL_DEPRECATED("Use set_walltime_limit() instead") - void SetWallTimeLimit(time_t limit) const; + void SetWallTimeLimit(time_t limit) const { + this->set_walltime_limit(absl::Seconds(limit)); + } // Sets a wall time limit on a running sandboxee, absl::ZeroDuration() to // disarm. This can be useful in a persistent sandbox scenario, to impose a @@ -103,8 +105,11 @@ class Sandbox2 final { // between. Sandboxed API can be used to implement persistent sandboxes. void set_walltime_limit(absl::Duration limit) const; - // Gets the pid inside the executor. - pid_t GetPid() { return monitor_ != nullptr ? monitor_->pid_ : -1; } + // Returns the process id inside the executor. + ABSL_DEPRECATED("Use pid() instead") + pid_t GetPid() { return this->pid(); } + + pid_t pid() const { return monitor_ != nullptr ? monitor_->pid_ : -1; } // Gets the comms inside the executor. Comms* comms() {