OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file/namespace contains utility functions for enumerating, ending and | 5 // This file/namespace contains utility functions for enumerating, ending and |
6 // computing statistics of processes. | 6 // computing statistics of processes. |
7 | 7 |
8 #ifndef BASE_PROCESS_UTIL_H_ | 8 #ifndef BASE_PROCESS_UTIL_H_ |
9 #define BASE_PROCESS_UTIL_H_ | 9 #define BASE_PROCESS_UTIL_H_ |
10 | 10 |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 // circumstances of the child process' death. |exit_code| is set to | 505 // circumstances of the child process' death. |exit_code| is set to |
506 // the status returned by waitpid() on POSIX, and from | 506 // the status returned by waitpid() on POSIX, and from |
507 // GetExitCodeProcess() on Windows. |exit_code| may be NULL if the | 507 // GetExitCodeProcess() on Windows. |exit_code| may be NULL if the |
508 // caller is not interested in it. Note that on Linux, this function | 508 // caller is not interested in it. Note that on Linux, this function |
509 // will only return a useful result the first time it is called after | 509 // will only return a useful result the first time it is called after |
510 // the child exits (because it will reap the child and the information | 510 // the child exits (because it will reap the child and the information |
511 // will no longer be available). | 511 // will no longer be available). |
512 BASE_EXPORT TerminationStatus GetTerminationStatus(ProcessHandle handle, | 512 BASE_EXPORT TerminationStatus GetTerminationStatus(ProcessHandle handle, |
513 int* exit_code); | 513 int* exit_code); |
514 | 514 |
| 515 #if defined(OS_POSIX) |
| 516 // Wait for the process to exit and get the termination status. See |
| 517 // GetTerminationStatus for more information. On POSIX systems, we can't call |
| 518 // WaitForExitCode and then GetTerminationStatus as the child will be reaped |
| 519 // when WaitForExitCode return and this information will be lost. |
| 520 BASE_EXPORT TerminationStatus WaitForTerminationStatus(ProcessHandle handle, |
| 521 int* exit_code); |
| 522 #endif // defined(OS_POSIX) |
| 523 |
515 // Waits for process to exit. On POSIX systems, if the process hasn't been | 524 // Waits for process to exit. On POSIX systems, if the process hasn't been |
516 // signaled then puts the exit code in |exit_code|; otherwise it's considered | 525 // signaled then puts the exit code in |exit_code|; otherwise it's considered |
517 // a failure. On Windows |exit_code| is always filled. Returns true on success, | 526 // a failure. On Windows |exit_code| is always filled. Returns true on success, |
518 // and closes |handle| in any case. | 527 // and closes |handle| in any case. |
519 BASE_EXPORT bool WaitForExitCode(ProcessHandle handle, int* exit_code); | 528 BASE_EXPORT bool WaitForExitCode(ProcessHandle handle, int* exit_code); |
520 | 529 |
521 // Waits for process to exit. If it did exit within |timeout_milliseconds|, | 530 // Waits for process to exit. If it did exit within |timeout_milliseconds|, |
522 // then puts the exit code in |exit_code|, and returns true. | 531 // then puts the exit code in |exit_code|, and returns true. |
523 // In POSIX systems, if the process has been signaled then |exit_code| is set | 532 // In POSIX systems, if the process has been signaled then |exit_code| is set |
524 // to -1. Returns false on failure (the caller is then responsible for closing | 533 // to -1. Returns false on failure (the caller is then responsible for closing |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 // YOUR CODE IS LIKELY TO BE REVERTED. THANK YOU. | 883 // YOUR CODE IS LIKELY TO BE REVERTED. THANK YOU. |
875 // | 884 // |
876 // TODO(shess): Weird place to put it, but this is where the OOM | 885 // TODO(shess): Weird place to put it, but this is where the OOM |
877 // killer currently lives. | 886 // killer currently lives. |
878 BASE_EXPORT void* UncheckedMalloc(size_t size); | 887 BASE_EXPORT void* UncheckedMalloc(size_t size); |
879 #endif // defined(OS_MACOSX) | 888 #endif // defined(OS_MACOSX) |
880 | 889 |
881 } // namespace base | 890 } // namespace base |
882 | 891 |
883 #endif // BASE_PROCESS_UTIL_H_ | 892 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |