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

Side by Side Diff: base/process_util_posix.cc

Issue 2804042: Incomplete changes to make scoped_ptr_malloc use plain functions. (Closed)
Patch Set: chrome now builds & links Created 10 years, 5 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
« no previous file with comments | « base/file_util.h ('k') | base/scoped_ptr.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (!exited) 175 if (!exited)
176 result = kill(process_id, SIGKILL) == 0; 176 result = kill(process_id, SIGKILL) == 0;
177 } 177 }
178 178
179 if (!result) 179 if (!result)
180 DPLOG(ERROR) << "Unable to terminate process " << process_id; 180 DPLOG(ERROR) << "Unable to terminate process " << process_id;
181 181
182 return result; 182 return result;
183 } 183 }
184 184
185 // A class to handle auto-closing of DIR*'s. 185 typedef scoped_ptr_malloc<DIR, FreeFnIgnoreReturn<DIR, closedir> > ScopedDIR;
186 class ScopedDIRClose {
187 public:
188 inline void operator()(DIR* x) const {
189 if (x) {
190 closedir(x);
191 }
192 }
193 };
194 typedef scoped_ptr_malloc<DIR, ScopedDIRClose> ScopedDIR;
195 186
196 #if defined(OS_LINUX) 187 #if defined(OS_LINUX)
197 static const rlim_t kSystemDefaultMaxFds = 8192; 188 static const rlim_t kSystemDefaultMaxFds = 8192;
198 static const char kFDDir[] = "/proc/self/fd"; 189 static const char kFDDir[] = "/proc/self/fd";
199 #elif defined(OS_MACOSX) 190 #elif defined(OS_MACOSX)
200 static const rlim_t kSystemDefaultMaxFds = 256; 191 static const rlim_t kSystemDefaultMaxFds = 256;
201 static const char kFDDir[] = "/dev/fd"; 192 static const char kFDDir[] = "/dev/fd";
202 #elif defined(OS_SOLARIS) 193 #elif defined(OS_SOLARIS)
203 static const rlim_t kSystemDefaultMaxFds = 8192; 194 static const rlim_t kSystemDefaultMaxFds = 8192;
204 static const char kFDDir[] = "/dev/fd"; 195 static const char kFDDir[] = "/dev/fd";
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 const ProcessFilter* filter) { 881 const ProcessFilter* filter) {
891 bool exited_cleanly = 882 bool exited_cleanly =
892 WaitForProcessesToExit(executable_name, wait_milliseconds, 883 WaitForProcessesToExit(executable_name, wait_milliseconds,
893 filter); 884 filter);
894 if (!exited_cleanly) 885 if (!exited_cleanly)
895 KillProcesses(executable_name, exit_code, filter); 886 KillProcesses(executable_name, exit_code, filter);
896 return exited_cleanly; 887 return exited_cleanly;
897 } 888 }
898 889
899 } // namespace base 890 } // namespace base
OLDNEW
« no previous file with comments | « base/file_util.h ('k') | base/scoped_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698