Chromium Code Reviews| Index: user_collector.cc |
| diff --git a/user_collector.cc b/user_collector.cc |
| index f15c5783d130e040fd6d7b030195ef7b015b37d9..7550ef38c86e3f647baa815249b0258b6e1d2dd7 100644 |
| --- a/user_collector.cc |
| +++ b/user_collector.cc |
| @@ -30,15 +30,22 @@ static const char kCollectionErrorSignature[] = |
| // instead pipe the core file into a user space process. See |
| // core(5) man page. |
| static const char kCorePatternFile[] = "/proc/sys/kernel/core_pattern"; |
| +static const char kCorePipeLimitFile[] = "/proc/sys/kernel/core_pipe_limit"; |
| +// Set core_pipe_limit to 1 so that any crashes occurring while crash_reporter is |
|
petkov
2010/12/13 19:27:57
80 chars
kmixter1
2010/12/14 03:39:49
Done.
|
| +// handling a crash are discarded. |
| +static const char kCorePipeLimit[] = "1"; |
| static const char kCoreToMinidumpConverterPath[] = "/usr/bin/core2md"; |
| static const char kLeaveCoreFile[] = "/root/.leave_core"; |
| +static const char kDefaultLogConfig[] = "/etc/crash_reporter_logs.conf"; |
| + |
| const char *UserCollector::kUserId = "Uid:\t"; |
| const char *UserCollector::kGroupId = "Gid:\t"; |
| UserCollector::UserCollector() |
| : generate_diagnostics_(false), |
| core_pattern_file_(kCorePatternFile), |
| + core_pipe_limit_file_(kCorePipeLimitFile), |
| initialized_(false) { |
| } |
| @@ -71,6 +78,13 @@ bool UserCollector::SetUpInternal(bool enabled) { |
| CHECK(initialized_); |
| logger_->LogInfo("%s user crash handling", |
| enabled ? "Enabling" : "Disabling"); |
| + if (file_util::WriteFile(FilePath(core_pipe_limit_file_), |
| + kCorePipeLimit, |
| + strlen(kCorePipeLimit)) != |
| + static_cast<int>(strlen(kCorePipeLimit))) { |
| + logger_->LogError("Unable to write %s", core_pipe_limit_file_.c_str()); |
| + return false; |
| + } |
| std::string pattern = GetPattern(enabled); |
| if (file_util::WriteFile(FilePath(core_pattern_file_), |
| pattern.c_str(), |
| @@ -332,6 +346,12 @@ bool UserCollector::ConvertAndEnqueueCrash(int pid, |
| FilePath core_path = GetCrashPath(crash_path, dump_basename, "core"); |
| FilePath meta_path = GetCrashPath(crash_path, dump_basename, "meta"); |
| FilePath minidump_path = GetCrashPath(crash_path, dump_basename, "dmp"); |
| + FilePath log_path = GetCrashPath(crash_path, dump_basename, "log"); |
| + |
| + std::string log_contents; |
|
petkov
2010/12/13 19:27:57
unused? why are you not compiling with -Wall -Werr
kmixter1
2010/12/14 03:39:49
I am compiling with them. Guessing they don't cat
|
| + |
| + if (GetLogContents(FilePath(kDefaultLogConfig), exec, log_path)) |
| + AddCrashMetaData("log", log_path.value()); |
| if (!ConvertCoreToMinidump(pid, container_dir, core_path, |
| minidump_path)) { |