Loading bootstat/bootstat.cpp +40 −42 Original line number Diff line number Diff line Loading @@ -830,7 +830,7 @@ std::string getSubreason(const std::string& content, size_t pos, bool quoted) { return subReason; } bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) { void addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) { // Check for kernel panic types to refine information if ((console.rfind("SysRq : Trigger a crash") != std::string::npos) || (console.rfind("PC is at sysrq_handle_crash+") != std::string::npos)) { Loading @@ -842,21 +842,22 @@ bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) { if (pos != std::string::npos) { ret += "," + getSubreason(console, pos + strlen(sysrqSubreason), /* quoted */ true); } return true; return; } if (console.rfind("Unable to handle kernel NULL pointer dereference at virtual address") != std::string::npos) { ret = "kernel_panic,null"; return true; return; } if (console.rfind("Kernel BUG at ") != std::string::npos) { ret = "kernel_panic,bug"; return true; return; } std::string panic("Kernel panic - not syncing: "); auto pos = console.rfind(panic); if (pos != std::string::npos) { if (pos == std::string::npos) return; static const std::vector<std::pair<const std::string, const std::string>> panicReasons = { {"Out of memory", "oom"}, {"out of memory", "oom"}, Loading Loading @@ -885,20 +886,17 @@ bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) { for (auto& s : panicReasons) { if (console.find(panic + s.first, pos) != std::string::npos) { ret += "," + s.second; return true; return; } } auto reason = getSubreason(console, pos + panic.length(), /* newline */ false); if (reason.length() > 3) { ret += "," + reason; } return true; } return false; } bool addKernelPanicSubReason(const std::string& content, std::string& ret) { return addKernelPanicSubReason(pstoreConsole(content), ret); void addKernelPanicSubReason(const std::string& content, std::string& ret) { addKernelPanicSubReason(pstoreConsole(content), ret); } const char system_reboot_reason_property[] = "sys.boot.reason"; Loading Loading
bootstat/bootstat.cpp +40 −42 Original line number Diff line number Diff line Loading @@ -830,7 +830,7 @@ std::string getSubreason(const std::string& content, size_t pos, bool quoted) { return subReason; } bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) { void addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) { // Check for kernel panic types to refine information if ((console.rfind("SysRq : Trigger a crash") != std::string::npos) || (console.rfind("PC is at sysrq_handle_crash+") != std::string::npos)) { Loading @@ -842,21 +842,22 @@ bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) { if (pos != std::string::npos) { ret += "," + getSubreason(console, pos + strlen(sysrqSubreason), /* quoted */ true); } return true; return; } if (console.rfind("Unable to handle kernel NULL pointer dereference at virtual address") != std::string::npos) { ret = "kernel_panic,null"; return true; return; } if (console.rfind("Kernel BUG at ") != std::string::npos) { ret = "kernel_panic,bug"; return true; return; } std::string panic("Kernel panic - not syncing: "); auto pos = console.rfind(panic); if (pos != std::string::npos) { if (pos == std::string::npos) return; static const std::vector<std::pair<const std::string, const std::string>> panicReasons = { {"Out of memory", "oom"}, {"out of memory", "oom"}, Loading Loading @@ -885,20 +886,17 @@ bool addKernelPanicSubReason(const pstoreConsole& console, std::string& ret) { for (auto& s : panicReasons) { if (console.find(panic + s.first, pos) != std::string::npos) { ret += "," + s.second; return true; return; } } auto reason = getSubreason(console, pos + panic.length(), /* newline */ false); if (reason.length() > 3) { ret += "," + reason; } return true; } return false; } bool addKernelPanicSubReason(const std::string& content, std::string& ret) { return addKernelPanicSubReason(pstoreConsole(content), ret); void addKernelPanicSubReason(const std::string& content, std::string& ret) { addKernelPanicSubReason(pstoreConsole(content), ret); } const char system_reboot_reason_property[] = "sys.boot.reason"; Loading