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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Makefile ('k') | crash_collector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef _CRASH_REPORTER_CRASH_COLLECTOR_H_
6 #define _CRASH_REPORTER_CRASH_COLLECTOR_H_
7
8 #include <string>
9 #include <sys/stat.h>
10
11 #include "gtest/gtest_prod.h" // for FRIEND_TEST
12
13 class FilePath;
14 class SystemLogging;
15
16 // User crash collector.
17 class CrashCollector {
18 public:
19 typedef void (*CountCrashFunction)();
20 typedef bool (*IsFeedbackAllowedFunction)();
21
22 CrashCollector();
23
24 virtual ~CrashCollector();
25
26 // Initialize the crash collector for detection of crashes, given a
27 // crash counting function, metrics collection enabled oracle, and
28 // system logger facility.
29 void Initialize(CountCrashFunction count_crash,
30 IsFeedbackAllowedFunction is_metrics_allowed,
31 SystemLogging *logger);
32
33 protected:
34 friend class CrashCollectorTest;
35 FRIEND_TEST(CrashCollectorTest, GetCrashDirectoryInfo);
36 FRIEND_TEST(CrashCollectorTest, FormatDumpBasename);
37 FRIEND_TEST(CrashCollectorTest, Initialize);
38
39 // For testing, set the directory always returned by
40 // GetCreatedCrashDirectoryByEuid.
41 void ForceCrashDirectory(const char *forced_directory) {
42 forced_crash_directory_ = forced_directory;
43 }
44
45 FilePath GetCrashDirectoryInfo(uid_t process_euid,
46 uid_t default_user_id,
47 gid_t default_user_group,
48 mode_t *mode,
49 uid_t *directory_owner,
50 gid_t *directory_group);
51 bool GetUserInfoFromName(const std::string &name,
52 uid_t *uid,
53 gid_t *gid);
54 // Determines the crash directory for given eud, and creates the
55 // directory if necessary with appropriate permissions. Returns
56 // true whether or not directory needed to be created, false on any
57 // failure.
58 bool GetCreatedCrashDirectoryByEuid(uid_t euid,
59 FilePath *crash_file_path);
60 std::string FormatDumpBasename(const std::string &exec_name,
61 time_t timestamp,
62 pid_t pid);
63
64 CountCrashFunction count_crash_function_;
65 IsFeedbackAllowedFunction is_feedback_allowed_function_;
66 SystemLogging *logger_;
67 const char *forced_crash_directory_;
68 };
69
70 #endif // _CRASH_REPORTER_CRASH_COLLECTOR_H_
OLDNEW
« 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