(Mostly) internal change. Add pid() accessor.

PiperOrigin-RevId: 397070773
Change-Id: I9ebac9078f3866ef3e0061ec79da5c9f71e5f480
This commit is contained in:
Christian Blichmann 2021-09-16 06:56:52 -07:00 committed by Copybara-Service
parent aea8bb2ed0
commit c400f92eaa
2 changed files with 8 additions and 7 deletions

View File

@ -99,10 +99,6 @@ bool Sandbox2::IsTerminated() const {
return monitor_->IsDone(); 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 { void Sandbox2::set_walltime_limit(absl::Duration limit) const {
if (limit == absl::ZeroDuration()) { if (limit == absl::ZeroDuration()) {
VLOG(1) << "Disarming walltime timer to "; VLOG(1) << "Disarming walltime timer to ";

View File

@ -95,7 +95,9 @@ class Sandbox2 final {
// for responses after each request and reset the deadline in between. // for responses after each request and reset the deadline in between.
// Sandboxed API can be used to implement persistent sandboxes. // Sandboxed API can be used to implement persistent sandboxes.
ABSL_DEPRECATED("Use set_walltime_limit() instead") 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 // 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 // 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. // between. Sandboxed API can be used to implement persistent sandboxes.
void set_walltime_limit(absl::Duration limit) const; void set_walltime_limit(absl::Duration limit) const;
// Gets the pid inside the executor. // Returns the process id inside the executor.
pid_t GetPid() { return monitor_ != nullptr ? monitor_->pid_ : -1; } 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. // Gets the comms inside the executor.
Comms* comms() { Comms* comms() {