Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Side by Side Diff: base/process_util_posix.cc

Issue 774001: BSD port changes for base/ (OS_POSIX/GTK instead of OS_LINUX... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/process_util.h ('k') | base/sys_info_openbsd.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 } 263 }
264 264
265 // Sets all file descriptors to close on exec except for stdin, stdout 265 // Sets all file descriptors to close on exec except for stdin, stdout
266 // and stderr. 266 // and stderr.
267 // TODO(agl): Remove this function. It's fundamentally broken for multithreaded 267 // TODO(agl): Remove this function. It's fundamentally broken for multithreaded
268 // apps. 268 // apps.
269 void SetAllFDsToCloseOnExec() { 269 void SetAllFDsToCloseOnExec() {
270 #if defined(OS_LINUX) 270 #if defined(OS_LINUX)
271 const char fd_dir[] = "/proc/self/fd"; 271 const char fd_dir[] = "/proc/self/fd";
272 #elif defined(OS_MACOSX) || defined(OS_FREEBSD) || defined(OS_SOLARIS) 272 #elif defined(OS_MACOSX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
273 defined(OS_SOLARIS)
273 const char fd_dir[] = "/dev/fd"; 274 const char fd_dir[] = "/dev/fd";
274 #endif 275 #endif
275 ScopedDIR dir_closer(opendir(fd_dir)); 276 ScopedDIR dir_closer(opendir(fd_dir));
276 DIR *dir = dir_closer.get(); 277 DIR *dir = dir_closer.get();
277 if (NULL == dir) { 278 if (NULL == dir) {
278 DLOG(ERROR) << "Unable to open " << fd_dir; 279 DLOG(ERROR) << "Unable to open " << fd_dir;
279 return; 280 return;
280 } 281 }
281 282
282 struct dirent *ent; 283 struct dirent *ent;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 473
473 #if !defined(OS_MACOSX) 474 #if !defined(OS_MACOSX)
474 ProcessMetrics::ProcessMetrics(ProcessHandle process) 475 ProcessMetrics::ProcessMetrics(ProcessHandle process)
475 #else 476 #else
476 ProcessMetrics::ProcessMetrics(ProcessHandle process, 477 ProcessMetrics::ProcessMetrics(ProcessHandle process,
477 ProcessMetrics::PortProvider* port_provider) 478 ProcessMetrics::PortProvider* port_provider)
478 #endif 479 #endif
479 : process_(process), 480 : process_(process),
480 last_time_(0), 481 last_time_(0),
481 last_system_time_(0) 482 last_system_time_(0)
482 #if defined(OS_LINUX) 483 #if defined(OS_MACOSX)
484 , port_provider_(port_provider)
485 #elif defined(OS_POSIX)
483 , last_cpu_(0) 486 , last_cpu_(0)
484 #elif defined(OS_MACOSX)
485 , port_provider_(port_provider)
486 #endif 487 #endif
487 { 488 {
488 processor_count_ = base::SysInfo::NumberOfProcessors(); 489 processor_count_ = base::SysInfo::NumberOfProcessors();
489 } 490 }
490 491
491 // static 492 // static
492 #if !defined(OS_MACOSX) 493 #if !defined(OS_MACOSX)
493 ProcessMetrics* ProcessMetrics::CreateProcessMetrics(ProcessHandle process) { 494 ProcessMetrics* ProcessMetrics::CreateProcessMetrics(ProcessHandle process) {
494 return new ProcessMetrics(process); 495 return new ProcessMetrics(process);
495 } 496 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 const ProcessFilter* filter) { 788 const ProcessFilter* filter) {
788 bool exited_cleanly = 789 bool exited_cleanly =
789 WaitForProcessesToExit(executable_name, wait_milliseconds, 790 WaitForProcessesToExit(executable_name, wait_milliseconds,
790 filter); 791 filter);
791 if (!exited_cleanly) 792 if (!exited_cleanly)
792 KillProcesses(executable_name, exit_code, filter); 793 KillProcesses(executable_name, exit_code, filter);
793 return exited_cleanly; 794 return exited_cleanly;
794 } 795 }
795 796
796 } // namespace base 797 } // namespace base
OLDNEW
« no previous file with comments | « base/process_util.h ('k') | base/sys_info_openbsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698