OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <sys/resource.h> | 7 #include <sys/resource.h> |
8 #include <sys/wait.h> | 8 #include <sys/wait.h> |
9 | 9 |
10 #include "base/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 #else | 186 #else |
187 // Currently on Linux we can't handle non child processes. | 187 // Currently on Linux we can't handle non child processes. |
188 NOTIMPLEMENTED(); | 188 NOTIMPLEMENTED(); |
189 #endif // OS_MACOSX | 189 #endif // OS_MACOSX |
190 } | 190 } |
191 | 191 |
192 int status; | 192 int status; |
193 if (!WaitpidWithTimeout(handle, &status, timeout)) | 193 if (!WaitpidWithTimeout(handle, &status, timeout)) |
194 return false; | 194 return false; |
195 if (WIFSIGNALED(status)) { | 195 if (WIFSIGNALED(status)) { |
196 *exit_code = -1; | 196 if (exit_code) |
| 197 *exit_code = -1; |
197 return true; | 198 return true; |
198 } | 199 } |
199 if (WIFEXITED(status)) { | 200 if (WIFEXITED(status)) { |
200 *exit_code = WEXITSTATUS(status); | 201 if (exit_code) |
| 202 *exit_code = WEXITSTATUS(status); |
201 return true; | 203 return true; |
202 } | 204 } |
203 return false; | 205 return false; |
204 } | 206 } |
205 #endif // !defined(OS_NACL_NONSFI) | 207 #endif // !defined(OS_NACL_NONSFI) |
206 | 208 |
207 } // namespace | 209 } // namespace |
208 | 210 |
209 namespace base { | 211 namespace base { |
210 | 212 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 return false; | 370 return false; |
369 } | 371 } |
370 #endif // !defined(OS_LINUX) | 372 #endif // !defined(OS_LINUX) |
371 | 373 |
372 int Process::GetPriority() const { | 374 int Process::GetPriority() const { |
373 DCHECK(IsValid()); | 375 DCHECK(IsValid()); |
374 return getpriority(PRIO_PROCESS, process_); | 376 return getpriority(PRIO_PROCESS, process_); |
375 } | 377 } |
376 | 378 |
377 } // namespace base | 379 } // namespace base |
OLD | NEW |