Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/process/process.h" | 5 #include "base/process/process.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
| 10 #include <sys/wait.h> | 10 #include <sys/wait.h> |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 result = kill(process_, SIGKILL) == 0; | 343 result = kill(process_, SIGKILL) == 0; |
| 344 } | 344 } |
| 345 | 345 |
| 346 if (!result) | 346 if (!result) |
| 347 DPLOG(ERROR) << "Unable to terminate process " << process_; | 347 DPLOG(ERROR) << "Unable to terminate process " << process_; |
| 348 | 348 |
| 349 return result; | 349 return result; |
| 350 } | 350 } |
| 351 #endif // !defined(OS_NACL_NONSFI) | 351 #endif // !defined(OS_NACL_NONSFI) |
| 352 | 352 |
| 353 void Process::TerminateImmediately(int exit_code) const { | |
| 354 _exit(0); | |
|
Primiano Tucci (use gerrit)
2017/01/13 17:08:17
two things here:
1) s/0/exit_code/ :)
2) note that
Nico
2017/01/13 19:24:59
Agreed, 1 or 2 seem more appropriate. 1 seems a ti
| |
| 355 } | |
| 356 | |
| 353 bool Process::WaitForExit(int* exit_code) const { | 357 bool Process::WaitForExit(int* exit_code) const { |
| 354 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code); | 358 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code); |
| 355 } | 359 } |
| 356 | 360 |
| 357 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const { | 361 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const { |
| 358 // Record the event that this thread is blocking upon (for hang diagnosis). | 362 // Record the event that this thread is blocking upon (for hang diagnosis). |
| 359 base::debug::ScopedProcessWaitActivity process_activity(this); | 363 base::debug::ScopedProcessWaitActivity process_activity(this); |
| 360 | 364 |
| 361 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout); | 365 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout); |
| 362 } | 366 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 376 return false; | 380 return false; |
| 377 } | 381 } |
| 378 #endif // !defined(OS_LINUX) && !defined(OS_MACOSX) | 382 #endif // !defined(OS_LINUX) && !defined(OS_MACOSX) |
| 379 | 383 |
| 380 int Process::GetPriority() const { | 384 int Process::GetPriority() const { |
| 381 DCHECK(IsValid()); | 385 DCHECK(IsValid()); |
| 382 return getpriority(PRIO_PROCESS, process_); | 386 return getpriority(PRIO_PROCESS, process_); |
| 383 } | 387 } |
| 384 | 388 |
| 385 } // namespace base | 389 } // namespace base |
| OLD | NEW |