diff options
author | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-05 19:53:30 +0000 |
---|---|---|
committer | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-05 19:53:30 +0000 |
commit | 8cf7cebdf712b188970a396be6918d6d6a222835 (patch) | |
tree | 14db9f00124e7a911f6fe08e9614cd2c110b63ce /base/process_util_linux.cc | |
parent | 786a5fafa65bf9735f7e5060e126303307bb73bc (diff) | |
download | chromium_src-8cf7cebdf712b188970a396be6918d6d6a222835.zip chromium_src-8cf7cebdf712b188970a396be6918d6d6a222835.tar.gz chromium_src-8cf7cebdf712b188970a396be6918d6d6a222835.tar.bz2 |
Move KillProcess from linux to posix so it can be used on the Mac.
This was originally part of http://codereview.chromium.org/16207
and is broken out here so I can get the small stuff out of the way.
Review URL: http://codereview.chromium.org/16498
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7554 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_linux.cc')
-rw-r--r-- | base/process_util_linux.cc | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc index ba22a40..aa8ba94 100644 --- a/base/process_util_linux.cc +++ b/base/process_util_linux.cc @@ -92,30 +92,6 @@ bool LaunchApp(const CommandLine& cl, return LaunchApp(cl.argv(), no_files, wait, process_handle); } -// Attempts to kill the process identified by the given process -// entry structure. Ignores specified exit_code; linux can't force that. -// Returns true if this is successful, false otherwise. -bool KillProcess(int process_id, int exit_code, bool wait) { - bool result = false; - - int status = kill(process_id, SIGTERM); - if (!status && wait) { - int tries = 60; - // The process may not end immediately due to pending I/O - while (tries-- > 0) { - int pid = waitpid(process_id, &status, WNOHANG); - if (pid == process_id) { - result = true; - break; - } - sleep(1); - } - } - if (!result) - DLOG(ERROR) << "Unable to terminate process."; - return result; -} - bool DidProcessCrash(ProcessHandle handle) { int status; if (waitpid(handle, &status, WNOHANG)) { |