summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/client/crashreporter_unix_common.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-04-01 13:55:00 -0400
committerMatt A. Tobin <email@mattatobin.com>2019-04-01 13:55:00 -0400
commitce3979c721ba378a448bfbe3671c99d993cbc801 (patch)
treee200d5225bcecef5f974b946a58277fddd24e89c /toolkit/crashreporter/client/crashreporter_unix_common.cpp
parentf6c16cff36048c583ca0e1d019b622336ca861a0 (diff)
parentff2f287f82630ab3887d7d5c1e64e5b888ea0beb (diff)
downloadUXP-ce3979c721ba378a448bfbe3671c99d993cbc801.tar
UXP-ce3979c721ba378a448bfbe3671c99d993cbc801.tar.gz
UXP-ce3979c721ba378a448bfbe3671c99d993cbc801.tar.lz
UXP-ce3979c721ba378a448bfbe3671c99d993cbc801.tar.xz
UXP-ce3979c721ba378a448bfbe3671c99d993cbc801.zip
Merge branch 'master' into Sync-weave
Diffstat (limited to 'toolkit/crashreporter/client/crashreporter_unix_common.cpp')
-rw-r--r--toolkit/crashreporter/client/crashreporter_unix_common.cpp85
1 files changed, 0 insertions, 85 deletions
diff --git a/toolkit/crashreporter/client/crashreporter_unix_common.cpp b/toolkit/crashreporter/client/crashreporter_unix_common.cpp
deleted file mode 100644
index f42a35616..000000000
--- a/toolkit/crashreporter/client/crashreporter_unix_common.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "crashreporter.h"
-
-#include <algorithm>
-
-#include <dirent.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-using namespace CrashReporter;
-using std::string;
-using std::vector;
-using std::sort;
-
-struct FileData
-{
- time_t timestamp;
- string path;
-};
-
-static bool CompareFDTime(const FileData& fd1, const FileData& fd2)
-{
- return fd1.timestamp > fd2.timestamp;
-}
-
-void UIPruneSavedDumps(const std::string& directory)
-{
- DIR *dirfd = opendir(directory.c_str());
- if (!dirfd)
- return;
-
- vector<FileData> dumpfiles;
-
- while (dirent *dir = readdir(dirfd)) {
- FileData fd;
- fd.path = directory + '/' + dir->d_name;
- if (fd.path.size() < 5)
- continue;
-
- if (fd.path.compare(fd.path.size() - 4, 4, ".dmp") != 0)
- continue;
-
- struct stat st;
- if (stat(fd.path.c_str(), &st)) {
- closedir(dirfd);
- return;
- }
-
- fd.timestamp = st.st_mtime;
-
- dumpfiles.push_back(fd);
- }
-
- sort(dumpfiles.begin(), dumpfiles.end(), CompareFDTime);
-
- while (dumpfiles.size() > kSaveCount) {
- // get the path of the oldest file
- string path = dumpfiles[dumpfiles.size() - 1].path;
- UIDeleteFile(path.c_str());
-
- // s/.dmp/.extra/
- path.replace(path.size() - 4, 4, ".extra");
- UIDeleteFile(path.c_str());
-
- dumpfiles.pop_back();
- }
-}
-
-void UIRunMinidumpAnalyzer(const string& exename, const string& filename)
-{
- // Run the minidump analyzer and wait for it to finish
- pid_t pid = fork();
-
- if (pid == -1) {
- return; // Nothing to do upon failure
- } else if (pid == 0) {
- execl(exename.c_str(), exename.c_str(), filename.c_str(), nullptr);
- } else {
- waitpid(pid, nullptr, 0);
- }
-}