File indexing completed on 2024-07-21 04:54:44

0001 /*
0002     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0003     SPDX-FileCopyrightText: 2019-2022 Harald Sitter <sitter@kde.org>
0004 */
0005 
0006 #pragma once
0007 
0008 #include <QByteArray>
0009 #include <QHash>
0010 #include <QJsonDocument>
0011 #include <QString>
0012 
0013 #include "memory.h"
0014 
0015 class Coredump
0016 {
0017 public:
0018     using EntriesHash = QHash<QByteArray, QByteArray>;
0019 
0020     Coredump(QByteArray cursor, EntriesHash data);
0021     explicit Coredump(const QJsonDocument &document);
0022 
0023     ~Coredump() = default;
0024 
0025     // In a function cause it is used in more than one location.
0026     static QByteArray keyFilename();
0027     static QByteArray keyPickup();
0028     static QByteArray keyCursor();
0029 
0030     // Other bits and bobs
0031     QByteArray m_cursor;
0032     EntriesHash m_rawData;
0033 
0034     // Journal Entry values
0035     uid_t uid = 0;
0036     pid_t pid = -1;
0037     QString exe;
0038     QString filename; // core dump file if available (may be /dev/null if the core is stored in journal directly - only in older systemds)
0039     QString systemd_unit;
0040     QString bootId;
0041     QString timestamp;
0042 
0043 private:
0044     static EntriesHash documentToHash(const QJsonDocument &document);
0045     Q_DISABLE_COPY_MOVE(Coredump)
0046 };