OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 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 #ifndef _CRASH_REPORTER_USER_COLLECTOR_H_ | 5 #ifndef _CRASH_REPORTER_USER_COLLECTOR_H_ |
6 #define _CRASH_REPORTER_USER_COLLECTOR_H_ | 6 #define _CRASH_REPORTER_USER_COLLECTOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 virtual ~UserCollector(); | 34 virtual ~UserCollector(); |
35 | 35 |
36 // Enable collection. | 36 // Enable collection. |
37 bool Enable() { return SetUpInternal(true); } | 37 bool Enable() { return SetUpInternal(true); } |
38 | 38 |
39 // Disable collection. | 39 // Disable collection. |
40 bool Disable() { return SetUpInternal(false); } | 40 bool Disable() { return SetUpInternal(false); } |
41 | 41 |
42 // Handle a specific user crash. Returns true on success. | 42 // Handle a specific user crash. Returns true on success. |
43 bool HandleCrash(int signal, int pid, const char *force_exec); | 43 bool HandleCrash(const std::string &crash_attributes, |
| 44 const char *force_exec); |
44 | 45 |
45 // Set (override the default) core file pattern. | 46 // Set (override the default) core file pattern. |
46 void set_core_pattern_file(const std::string &pattern) { | 47 void set_core_pattern_file(const std::string &pattern) { |
47 core_pattern_file_ = pattern; | 48 core_pattern_file_ = pattern; |
48 } | 49 } |
49 | 50 |
50 // Set (override the default) core pipe limit file. | 51 // Set (override the default) core pipe limit file. |
51 void set_core_pipe_limit_file(const std::string &path) { | 52 void set_core_pipe_limit_file(const std::string &path) { |
52 core_pipe_limit_file_ = path; | 53 core_pipe_limit_file_ = path; |
53 } | 54 } |
54 | 55 |
55 private: | 56 private: |
56 friend class UserCollectorTest; | 57 friend class UserCollectorTest; |
57 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesBadPath); | 58 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesBadPath); |
58 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesBadPid); | 59 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesBadPid); |
59 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesOK); | 60 FRIEND_TEST(UserCollectorTest, CopyOffProcFilesOK); |
60 FRIEND_TEST(UserCollectorTest, GetIdFromStatus); | 61 FRIEND_TEST(UserCollectorTest, GetIdFromStatus); |
61 FRIEND_TEST(UserCollectorTest, GetProcessPath); | 62 FRIEND_TEST(UserCollectorTest, GetProcessPath); |
62 FRIEND_TEST(UserCollectorTest, GetSymlinkTarget); | 63 FRIEND_TEST(UserCollectorTest, GetSymlinkTarget); |
63 FRIEND_TEST(UserCollectorTest, GetUserInfoFromName); | 64 FRIEND_TEST(UserCollectorTest, GetUserInfoFromName); |
| 65 FRIEND_TEST(UserCollectorTest, ParseCrashAttributes); |
64 | 66 |
65 // Enumeration to pass to GetIdFromStatus. Must match the order | 67 // Enumeration to pass to GetIdFromStatus. Must match the order |
66 // that the kernel lists IDs in the status file. | 68 // that the kernel lists IDs in the status file. |
67 enum IdKind { | 69 enum IdKind { |
68 kIdReal = 0, // uid and gid | 70 kIdReal = 0, // uid and gid |
69 kIdEffective = 1, // euid and egid | 71 kIdEffective = 1, // euid and egid |
70 kIdSet = 2, // suid and sgid | 72 kIdSet = 2, // suid and sgid |
71 kIdFileSystem = 3, // fsuid and fsgid | 73 kIdFileSystem = 3, // fsuid and fsgid |
72 kIdMax | 74 kIdMax |
73 }; | 75 }; |
(...skipping 28 matching lines...) Expand all Loading... |
102 bool RunCoreToMinidump(const FilePath &core_path, | 104 bool RunCoreToMinidump(const FilePath &core_path, |
103 const FilePath &procfs_directory, | 105 const FilePath &procfs_directory, |
104 const FilePath &minidump_path, | 106 const FilePath &minidump_path, |
105 const FilePath &temp_directory); | 107 const FilePath &temp_directory); |
106 bool ConvertCoreToMinidump(pid_t pid, | 108 bool ConvertCoreToMinidump(pid_t pid, |
107 const FilePath &container_dir, | 109 const FilePath &container_dir, |
108 const FilePath &core_path, | 110 const FilePath &core_path, |
109 const FilePath &minidump_path); | 111 const FilePath &minidump_path); |
110 bool ConvertAndEnqueueCrash(int pid, const std::string &exec_name, | 112 bool ConvertAndEnqueueCrash(int pid, const std::string &exec_name, |
111 bool *out_of_capacity); | 113 bool *out_of_capacity); |
| 114 bool ParseCrashAttributes(const std::string &crash_attributes, |
| 115 pid_t *pid, int *signal, |
| 116 std::string *kernel_supplied_name); |
112 | 117 |
113 bool generate_diagnostics_; | 118 bool generate_diagnostics_; |
114 std::string core_pattern_file_; | 119 std::string core_pattern_file_; |
115 std::string core_pipe_limit_file_; | 120 std::string core_pipe_limit_file_; |
116 std::string our_path_; | 121 std::string our_path_; |
117 bool initialized_; | 122 bool initialized_; |
118 | 123 |
119 // String containing the current log of crash handling errors. | |
120 std::string error_log_; | |
121 | |
122 static const char *kUserId; | 124 static const char *kUserId; |
123 static const char *kGroupId; | 125 static const char *kGroupId; |
124 }; | 126 }; |
125 | 127 |
126 #endif // _CRASH_REPORTER_USER_COLLECTOR_H_ | 128 #endif // _CRASH_REPORTER_USER_COLLECTOR_H_ |
OLD | NEW |