OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <dirent.h> | 5 #include <dirent.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
(...skipping 25 matching lines...) Expand all Loading... |
36 return GetCurrentProcId(); | 36 return GetCurrentProcId(); |
37 } | 37 } |
38 | 38 |
39 bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle) { | 39 bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle) { |
40 // On Posix platforms, process handles are the same as PIDs, so we | 40 // On Posix platforms, process handles are the same as PIDs, so we |
41 // don't need to do anything. | 41 // don't need to do anything. |
42 *handle = pid; | 42 *handle = pid; |
43 return true; | 43 return true; |
44 } | 44 } |
45 | 45 |
| 46 bool OpenPrivilegedProcessHandle(ProcessId pid, ProcessHandle* handle) { |
| 47 // On POSIX permissions are checked for each operation on process, |
| 48 // not when opening a "handle". |
| 49 return OpenProcessHandle(pid, handle); |
| 50 } |
| 51 |
46 void CloseProcessHandle(ProcessHandle process) { | 52 void CloseProcessHandle(ProcessHandle process) { |
47 // See OpenProcessHandle, nothing to do. | 53 // See OpenProcessHandle, nothing to do. |
48 return; | 54 return; |
49 } | 55 } |
50 | 56 |
51 ProcessId GetProcId(ProcessHandle process) { | 57 ProcessId GetProcId(ProcessHandle process) { |
52 return process; | 58 return process; |
53 } | 59 } |
54 | 60 |
55 // Attempts to kill the process identified by the given process | 61 // Attempts to kill the process identified by the given process |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 const ProcessFilter* filter) { | 447 const ProcessFilter* filter) { |
442 bool exited_cleanly = | 448 bool exited_cleanly = |
443 WaitForProcessesToExit(executable_name, wait_milliseconds, | 449 WaitForProcessesToExit(executable_name, wait_milliseconds, |
444 filter); | 450 filter); |
445 if (!exited_cleanly) | 451 if (!exited_cleanly) |
446 KillProcesses(executable_name, exit_code, filter); | 452 KillProcesses(executable_name, exit_code, filter); |
447 return exited_cleanly; | 453 return exited_cleanly; |
448 } | 454 } |
449 | 455 |
450 } // namespace base | 456 } // namespace base |
OLD | NEW |