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

Unified Diff: crash_reporter.cc

Issue 2847017: Notify metrics daemon of kernel crashes. (Closed) Base URL: ssh://git@chromiumos-git/crash.git
Patch Set: Fix FEATURES=test. Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | system_logging_mock.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crash_reporter.cc
diff --git a/crash_reporter.cc b/crash_reporter.cc
index 87d4facf56897906ef9fc869a0d0ce680f504900..80494cc6ced7c9dd4f2ae294be2429f71c935b5b 100644
--- a/crash_reporter.cc
+++ b/crash_reporter.cc
@@ -25,6 +25,7 @@ DEFINE_bool(unclean_check, true, "Check for unclean shutdown");
static const char kCrashCounterHistogram[] = "Logging.CrashCounter";
static const char kUncleanShutdownFile[] =
"/var/lib/crash_reporter/pending_clean_shutdown";
+static const char kEmpty[] = "";
// Enumeration of kinds of crashes to be used in the CrashCounter histogram.
enum CrashKinds {
@@ -58,13 +59,19 @@ static void CheckUncleanShutdown() {
s_system_log.LogError("Failed to delete unclean shutdown file %s",
kUncleanShutdownFile);
}
+
+ // Touch a file to notify the metrics daemon that a kernel crash has
+ // been detected so that it can log the time since the last kernel
+ // crash.
+ static const char kKernelCrashDetectedFile[] = "/tmp/kernel-crash-detected";
+ FilePath crash_detected(kKernelCrashDetectedFile);
+ file_util::WriteFile(crash_detected, kEmpty, 0);
}
static bool PrepareUncleanShutdownCheck() {
- static const char empty[] = "";
FilePath file_path(kUncleanShutdownFile);
file_util::CreateDirectory(file_path.DirName());
- return file_util::WriteFile(file_path, empty, 0) == 0;
+ return file_util::WriteFile(file_path, kEmpty, 0) == 0;
}
static void SignalCleanShutdown() {
« no previous file with comments | « no previous file | system_logging_mock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698