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

Unified Diff: crash_collector.h

Issue 3179006: Collect and send kernel crash diagnostics (Closed) Base URL: ssh://git@chromiumos-git//crash-reporter.git
Patch Set: Respond to reviews Created 10 years, 4 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 | « Makefile ('k') | crash_collector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crash_collector.h
diff --git a/crash_collector.h b/crash_collector.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef0d2a7b106f057d0e55fe531217906538764eb0
--- /dev/null
+++ b/crash_collector.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef _CRASH_REPORTER_CRASH_COLLECTOR_H_
+#define _CRASH_REPORTER_CRASH_COLLECTOR_H_
+
+#include <string>
+#include <sys/stat.h>
+
+#include "gtest/gtest_prod.h" // for FRIEND_TEST
+
+class FilePath;
+class SystemLogging;
+
+// User crash collector.
+class CrashCollector {
+ public:
+ typedef void (*CountCrashFunction)();
+ typedef bool (*IsFeedbackAllowedFunction)();
+
+ CrashCollector();
+
+ virtual ~CrashCollector();
+
+ // Initialize the crash collector for detection of crashes, given a
+ // crash counting function, metrics collection enabled oracle, and
+ // system logger facility.
+ void Initialize(CountCrashFunction count_crash,
+ IsFeedbackAllowedFunction is_metrics_allowed,
+ SystemLogging *logger);
+
+ protected:
+ friend class CrashCollectorTest;
+ FRIEND_TEST(CrashCollectorTest, GetCrashDirectoryInfo);
+ FRIEND_TEST(CrashCollectorTest, FormatDumpBasename);
+ FRIEND_TEST(CrashCollectorTest, Initialize);
+
+ // For testing, set the directory always returned by
+ // GetCreatedCrashDirectoryByEuid.
+ void ForceCrashDirectory(const char *forced_directory) {
+ forced_crash_directory_ = forced_directory;
+ }
+
+ FilePath GetCrashDirectoryInfo(uid_t process_euid,
+ uid_t default_user_id,
+ gid_t default_user_group,
+ mode_t *mode,
+ uid_t *directory_owner,
+ gid_t *directory_group);
+ bool GetUserInfoFromName(const std::string &name,
+ uid_t *uid,
+ gid_t *gid);
+ // Determines the crash directory for given eud, and creates the
+ // directory if necessary with appropriate permissions. Returns
+ // true whether or not directory needed to be created, false on any
+ // failure.
+ bool GetCreatedCrashDirectoryByEuid(uid_t euid,
+ FilePath *crash_file_path);
+ std::string FormatDumpBasename(const std::string &exec_name,
+ time_t timestamp,
+ pid_t pid);
+
+ CountCrashFunction count_crash_function_;
+ IsFeedbackAllowedFunction is_feedback_allowed_function_;
+ SystemLogging *logger_;
+ const char *forced_crash_directory_;
+};
+
+#endif // _CRASH_REPORTER_CRASH_COLLECTOR_H_
« no previous file with comments | « Makefile ('k') | crash_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698