(Mostly) internal change. Add `pid()` accessor.
PiperOrigin-RevId: 397070773
Change-Id: I9ebac9078f3866ef3e0061ec79da5c9f71e5f480
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 @@
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 @@
// 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 @@
// 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() {