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

Side by Side Diff: base/logging.cc

Issue 119289: Enable zygote manager by default. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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/file_util_posix.cc ('k') | base/process_util.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/logging.h" 5 #include "base/logging.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 typedef HANDLE FileHandle; 9 typedef HANDLE FileHandle;
10 typedef HANDLE MutexHandle; 10 typedef HANDLE MutexHandle;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // try the current directory 201 // try the current directory
202 log_file = CreateFile(L".\\debug.log", GENERIC_WRITE, 202 log_file = CreateFile(L".\\debug.log", GENERIC_WRITE,
203 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, 203 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
204 OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 204 OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
205 if (log_file == INVALID_HANDLE_VALUE || log_file == NULL) { 205 if (log_file == INVALID_HANDLE_VALUE || log_file == NULL) {
206 log_file = NULL; 206 log_file = NULL;
207 return false; 207 return false;
208 } 208 }
209 } 209 }
210 SetFilePointer(log_file, 0, 0, FILE_END); 210 SetFilePointer(log_file, 0, 0, FILE_END);
211 #elif defined(OS_POSIX) 211 #elif defined(OS_LINUX)
212 // Reserve global fd slots. 212 // Reserve global fd slots.
213 int reserved_fds[kReservedFds]; 213 int reserved_fds[kReservedFds];
214 for (int i=0; i < kReservedFds; i++) 214 for (int i=0; i < kReservedFds; i++)
215 reserved_fds[i] = open("/dev/null", O_RDONLY, 0); 215 reserved_fds[i] = open("/dev/null", O_RDONLY, 0);
216 216
217 log_file = fopen(log_file_name->c_str(), "a"); 217 log_file = fopen(log_file_name->c_str(), "a");
218 218
219 // Release the reserved fds. 219 // Release the reserved fds.
220 for (int i=0; i < kReservedFds; i++) 220 for (int i=0; i < kReservedFds; i++)
221 close(reserved_fds[i]); 221 close(reserved_fds[i]);
222 222
223 if (log_file == NULL) 223 if (log_file == NULL)
224 return false; 224 return false;
225 #elif defined(OS_POSIX)
226 log_file = fopen(log_file_name->c_str(), "a");
227 if (log_file == NULL)
228 return false;
225 #endif 229 #endif
226 } 230 }
227 231
228 return true; 232 return true;
229 } 233 }
230 234
231 #if defined(OS_LINUX) 235 #if defined(OS_LINUX)
232 int GetLoggingFileDescriptor() { 236 int GetLoggingFileDescriptor() {
233 // No locking needed, since this is only called by the zygote server, 237 // No locking needed, since this is only called by the zygote server,
234 // which is single-threaded. 238 // which is single-threaded.
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 587
584 CloseFile(log_file); 588 CloseFile(log_file);
585 log_file = NULL; 589 log_file = NULL;
586 } 590 }
587 591
588 } // namespace logging 592 } // namespace logging
589 593
590 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { 594 std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) {
591 return out << base::SysWideToUTF8(std::wstring(wstr)); 595 return out << base::SysWideToUTF8(std::wstring(wstr));
592 } 596 }
OLDNEW
« no previous file with comments | « base/file_util_posix.cc ('k') | base/process_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698