]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
refactor: remove childproc
authortobtoht <tob@featherwallet.org>
Tue, 28 Mar 2023 20:50:56 +0000 (22:50 +0200)
committertobtoht <tob@featherwallet.org>
Tue, 28 Mar 2023 21:04:25 +0000 (23:04 +0200)
CMakeLists.txt
src/CMakeLists.txt
src/plugins/xmrig/xmrig.cpp
src/plugins/xmrig/xmrig.h
src/utils/TorManager.cpp
src/utils/TorManager.h
src/utils/childproc.cpp [deleted file]
src/utils/childproc.h [deleted file]

index 0d53a57a6dde864c212bfcbe0e30a744249dff26..ac79d6a53358221dffa823ffa897206b8f3b3c16 100644 (file)
@@ -39,9 +39,6 @@ if(DEBUG)
     set(CMAKE_VERBOSE_MAKEFILE ON)
 endif()
 
-check_include_file(sys/prctl.h HAVE_SYS_PRCTL_H)
-check_symbol_exists(prctl "sys/prctl.h" HAVE_PRCTL)
-
 # Monero configuration
 set(BUILD_GUI_DEPS ON)
 set(BUILD_64 ON)
index 63a196e1d13bb010f5f6d58e91275effd3a56d12..e9c3da3c82db302b7d0c31a2973d7911a6b7bc9a 100644 (file)
@@ -195,10 +195,6 @@ if(STACK_TRACE)
     target_compile_definitions(feather PRIVATE STACK_TRACE=1)
 endif()
 
-if(HAVE_SYS_PRCTL_H)
-    target_compile_definitions(feather PRIVATE HAVE_SYS_PRCTL_H=1)
-endif()
-
 if(STATIC)
     target_compile_definitions(feather PRIVATE STATIC=1)
 endif()
index 403a2e3b5ea3e10133006072802bb5a8758d5c4d..aa19945b0c53b3ddbd76908c6afa5d2993ce4d80 100644 (file)
@@ -11,7 +11,7 @@
 
 XmRig::XmRig(const QString &configDir, QObject *parent)
     : QObject(parent)
-    , m_process(new ChildProcess(this))
+    , m_process(new QProcess(this))
 {
     m_process->setProcessChannelMode(QProcess::MergedChannels);
     connect(m_process, &QProcess::readyReadStandardOutput, this, &XmRig::handleProcessOutput);
index 9f7b54bebacaeeecaf79af063f2d3751f5eecdd5..03f182ef2a807c67e05e9c5ef973cd33bbc176b2 100644 (file)
@@ -4,15 +4,7 @@
 #ifndef FEATHER_XMRIG_H
 #define FEATHER_XMRIG_H
 
-#include <cstdio>
-#include <cstdlib>
-#include <iostream>
-#include <QRegularExpression>
-#include <QtNetwork>
-#include <QApplication>
-#include <QMainWindow>
-
-#include "utils/childproc.h"
+#include <QProcess>
 
 class XmRig : public QObject
 {
@@ -36,7 +28,7 @@ private slots:
     void handleProcessError(QProcess::ProcessError error);
 
 private:
-    ChildProcess *m_process;
+    QProcess *m_process;
     QProcess m_killProcess;
     bool m_elevated;
 };
index 75de7ea39cfb3b320b7da9ff4fd00e8ce8327c9a..f8b3def1b9e58bbaba5e5e05bc2806d233542699 100644 (file)
@@ -16,7 +16,7 @@
 TorManager::TorManager(QObject *parent)
     : QObject(parent)
     , m_checkConnectionTimer(new QTimer(this))
-    , m_process(new ChildProcess(this))
+    , m_process(new QProcess(this))
 {
     connect(m_checkConnectionTimer, &QTimer::timeout, this, &TorManager::checkConnection);
 
index c0d4e3039aafe020423d60d2cda88efa28f61516..6afb4bea6a76f6679e1d362d9085d65bd5dd69db 100644 (file)
@@ -9,7 +9,6 @@
 #include <iostream>
 #include <QRegularExpression>
 #include <QtNetwork>
-#include "utils/childproc.h"
 #include "utils/SemanticVersion.h"
 
 class TorManager : public QObject
@@ -60,7 +59,7 @@ private:
 
     static QPointer<TorManager> m_instance;
 
-    ChildProcess *m_process;
+    QProcess *m_process;
     int m_restarts = 0;
     bool m_stopRetries = false;
     bool m_localTor;
diff --git a/src/utils/childproc.cpp b/src/utils/childproc.cpp
deleted file mode 100644 (file)
index 786c190..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// SPDX-License-Identifier: BSD-3-Clause
-// SPDX-FileCopyrightText: 2020-2023 The Monero Project
-
-#include "utils/childproc.h"
-
-ChildProcess::ChildProcess(QObject* parent) {}
-ChildProcess::~ChildProcess() {}
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-void ChildProcess::setupChildProcess() {
-#if defined(HAVE_SYS_PRCTL_H) && defined(Q_OS_UNIX)
-    // https://smackerelofopinion.blogspot.com/2015/11/using-prsetpdeathsig-to-reap-child.html
-    ::prctl(PR_SET_PDEATHSIG, SIGKILL);
-#endif
-}
-#endif
\ No newline at end of file
diff --git a/src/utils/childproc.h b/src/utils/childproc.h
deleted file mode 100644 (file)
index 5c63587..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: BSD-3-Clause
-// SPDX-FileCopyrightText: 2020-2023 The Monero Project
-
-#ifndef FEATHER_FPROCESS_H
-#define FEATHER_FPROCESS_H
-
-#include <QProcess>
-
-#if defined(HAVE_SYS_PRCTL_H) && defined(Q_OS_UNIX)
-#include <signal.h>
-#include <sys/prctl.h>
-#endif
-
-class ChildProcess : public QProcess {
-    Q_OBJECT
-public:
-    explicit ChildProcess(QObject *parent);
-    ~ChildProcess() override;
-protected:
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-    void setupChildProcess() override;
-#endif
-};
-
-
-#endif //FEATHER_FPROCESS_H