qt5: remove launchpad-based 'QProcess' implementation

Fixes #1631
This commit is contained in:
Christian Prochaska 2016-11-07 14:26:39 +01:00 committed by Christian Helmuth
parent d477a3e76d
commit c0e0f2874a
9 changed files with 69 additions and 1770 deletions

View File

@ -8,8 +8,7 @@ CC_WARN = -Wno-unused-but-set-variable -Wno-deprecated-declarations
include $(REP_DIR)/lib/mk/qt5_core_generated.inc
# add Genode-specific sources
QT_SOURCES += qprocess_genode.cpp \
qthread_genode.cpp
QT_SOURCES += qthread_genode.cpp
# remove unsupported UNIX-specific files
QT_SOURCES_FILTER_OUT = \
@ -35,4 +34,4 @@ INC_DIR += $(REP_DIR)/include/qt5/qtbase/QtCore/private \
$(QT5_CONTRIB_DIR)/qtbase/include/QtCore/$(QT_VERSION)/QtCore \
$(QT5_CONTRIB_DIR)/qtbase/include/QtCore/$(QT_VERSION)/QtCore/private
LIBS += qt5_host_tools launchpad zlib icu libc libm alarm libc_pipe pthread
LIBS += qt5_host_tools zlib icu libc libm alarm libc_pipe pthread

View File

@ -1 +1 @@
8c8f232dcaa82e015b4f25f4fa99e7c7eeecc128
ad39740935637ba07e227c2faf8f69891233a5ae

View File

@ -5,3 +5,5 @@ QT5_REP_DIR := $(realpath $(dir $(QT5_REP_DIR))../..)
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
LIBS += launchpad

View File

@ -262,7 +262,7 @@ index 0000000..4d2c580
+#endif // QPLATFORMDEFS_H
diff --git a/qtbase/src/corelib/global/qconfig-genode.h b/qtbase/src/corelib/global/qconfig-genode.h
new file mode 100644
index 0000000..6227a0c
index 0000000..681af14
--- /dev/null
+++ b/qtbase/src/corelib/global/qconfig-genode.h
@@ -0,0 +1,546 @@
@ -322,9 +322,9 @@ index 0000000..6227a0c
+//#ifndef QT_NO_FILESYSTEMMODEL
+//# define QT_NO_FILESYSTEMMODEL
+//#endif
+//#ifndef QT_NO_PROCESS
+//# define QT_NO_PROCESS
+//#endif
+#ifndef QT_NO_PROCESS
+# define QT_NO_PROCESS
+#endif
+//#ifndef QT_NO_TEMPORARYFILE
+//# define QT_NO_TEMPORARYFILE
+//#endif

View File

@ -7,22 +7,20 @@ Genode-specific adaptations
qtbase/src/corelib/codecs/qtextcodec.cpp | 4 +
qtbase/src/corelib/global/qlogging.cpp | 6 ++
qtbase/src/corelib/global/qsystemdetection.h | 5 +-
qtbase/src/corelib/io/qprocess.cpp | 64 ++++++++++++++++++++
qtbase/src/corelib/io/qprocess_p.h | 45 ++++++++++++++
qtbase/src/corelib/io/qresource.cpp | 2 -
qtbase/src/corelib/kernel/qcoreapplication.cpp | 2 -
.../src/corelib/kernel/qeventdispatcher_unix.cpp | 14 ++++
.../src/corelib/kernel/qeventdispatcher_unix.cpp | 14 +++++
qtbase/src/corelib/kernel/qtranslator.cpp | 2 -
qtbase/src/corelib/thread/qthread.cpp | 5 +-
qtbase/src/corelib/thread/qthread_p.h | 55 +++++++++++++++++
qtbase/src/corelib/thread/qthread_p.h | 55 ++++++++++++++++++++
qtbase/src/corelib/tools/qdatetime.cpp | 15 +++++
qtbase/src/gui/image/qxpmhandler.cpp | 8 +++
.../network/access/qnetworkaccessfilebackend.cpp | 5 ++
qtbase/src/network/kernel/qhostinfo.cpp | 5 ++
qtbase/src/network/kernel/qhostinfo_unix.cpp | 7 ++
qtbase/src/network/kernel/qhostinfo_unix.cpp | 7 ++-
qtbase/src/widgets/dialogs/qfiledialog.cpp | 2 -
qtbase/src/widgets/styles/qstylefactory.cpp | 7 ++
18 files changed, 245 insertions(+), 8 deletions(-)
qtbase/src/widgets/styles/qstylefactory.cpp | 7 +++
16 files changed, 137 insertions(+), 7 deletions(-)
diff --git a/qtbase/src/corelib/codecs/qtextcodec.cpp b/qtbase/src/corelib/codecs/qtextcodec.cpp
index 1cedd3a..646be07 100644
@ -87,165 +85,6 @@ index cb55fa8..7d5c507 100644
# define Q_OS_DARWIN
# define Q_OS_BSD4
# ifdef __LP64__
diff --git a/qtbase/src/corelib/io/qprocess.cpp b/qtbase/src/corelib/io/qprocess.cpp
index b1861d8..b1cbf57 100644
--- a/qtbase/src/corelib/io/qprocess.cpp
+++ b/qtbase/src/corelib/io/qprocess.cpp
@@ -98,6 +98,11 @@ QT_END_NAMESPACE
#include <qwineventnotifier.h>
#endif
+#ifdef Q_OS_GENODE
+#include <rom_session/connection.h>
+#include <util/xml_node.h>
+#endif
+
#ifndef QT_NO_PROCESS
QT_BEGIN_NAMESPACE
@@ -789,6 +794,65 @@ QProcessPrivate::QProcessPrivate()
#ifdef Q_OS_UNIX
serial = 0;
#endif
+#ifdef Q_OS_GENODE
+ launchpad_child = 0;
+
+ /* request config file from ROM service */
+ Genode::Rom_connection rom("config");
+ rom.on_destruction(Genode::Rom_connection::KEEP_OPEN);
+ void *addr;
+ try {
+ addr = Genode::env()->rm_session()->attach(rom.dataspace());
+ } catch(Genode::Parent::Service_denied) {
+ qWarning("Error: Couldn't open config file.");
+ return;
+ }
+
+ /*
+ * The XML data of a valid config file starts with
+ * a <config> tag.
+ */
+ Genode::Xml_node config_node((const char *)addr);
+
+ if (!config_node.has_type("config")) {
+ qWarning("Error: Root node of config file is not a <config> tag.");
+ return;
+ }
+
+ /*
+ * Iterate through all entries of the config file and start
+ * children as specified.
+ */
+ for (int i = 0; i < config_node.num_sub_nodes(); i++) {
+ Genode::Xml_node program_node = config_node.sub_node(i);
+ if (program_node.has_type("program")) {
+
+ /* add filename and ram_quota to ram_quota_hash */
+ char filename[32];
+ try {
+ program_node.sub_node("filename").value(filename, sizeof(filename));
+ } catch (Genode::Xml_node::Nonexistent_sub_node) {
+ qWarning("Warning: Missing valid <filename> in config-file entry.");
+ return;
+ }
+
+ size_t ram_quota = 0;
+ try {
+ program_node.sub_node("ram_quota").value(&ram_quota);
+ } catch (Genode::Xml_node::Nonexistent_sub_node) {
+ qWarning("Warning: Missing valid <ram_quota> in config-file entry.");
+ return;
+ }
+
+ ram_quota_hash()->insert(QString(filename), ram_quota);
+ } else {
+ char buf[32];
+ program_node.type_name(buf, sizeof(buf));
+ qWarning("Warning: Ignoring unsupported tag <%s>.", buf);
+ }
+ }
+
+#endif
}
/*!
diff --git a/qtbase/src/corelib/io/qprocess_p.h b/qtbase/src/corelib/io/qprocess_p.h
index 2a2cc9f..2173aa0 100644
--- a/qtbase/src/corelib/io/qprocess_p.h
+++ b/qtbase/src/corelib/io/qprocess_p.h
@@ -74,6 +74,11 @@ typedef int Q_PIPE;
#ifndef QT_NO_PROCESS
+#ifdef Q_OS_GENODE
+#include <base/env.h>
+#include <launchpad/launchpad.h>
+#endif
+
QT_BEGIN_NAMESPACE
class QSocketNotifier;
@@ -235,6 +240,28 @@ template<> Q_INLINE_TEMPLATE void QSharedDataPointer<QProcessEnvironmentPrivate>
d = x;
}
+#ifdef Q_OS_GENODE
+
+class QProcess_launchpad : public Launchpad
+{
+public:
+ QProcess_launchpad(unsigned long initial_quota) : Launchpad(initial_quota) {}
+
+ virtual void quota(unsigned long quota) {}
+
+ virtual void add_launcher(const char *filename,
+ unsigned long default_quota) {}
+
+ virtual void add_child(const char *unique_name,
+ unsigned long quota,
+ Launchpad_child *launchpad_child,
+ Genode::Allocator *alloc) {}
+
+ virtual void remove_child(const char *name, Genode::Allocator *alloc) {}
+};
+
+#endif
+
class QProcessPrivate : public QIODevicePrivate
{
public:
@@ -347,7 +374,7 @@ public:
#endif
void startProcess();
-#if defined(Q_OS_UNIX) && !defined(Q_OS_QNX)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_GENODE)
void execChild(const char *workingDirectory, char **path, char **argv, char **envp);
#elif defined(Q_OS_QNX)
pid_t spawnChild(const char *workingDirectory, char **argv, char **envp);
@@ -375,6 +402,22 @@ public:
int serial;
#endif
+#ifdef Q_OS_GENODE
+ static QProcess_launchpad *launchpad()
+ {
+ static QProcess_launchpad _launchpad(Genode::env()->ram_session()->quota());
+ return &_launchpad;
+ }
+
+ static QHash<QString, size_t> *ram_quota_hash()
+ {
+ static QHash<QString, size_t> _ram_quota_hash;
+ return &_ram_quota_hash;
+ }
+
+ Launchpad_child *launchpad_child;
+#endif
+
bool waitForStarted(int msecs = 30000);
bool waitForReadyRead(int msecs = 30000);
bool waitForBytesWritten(int msecs = 30000);
diff --git a/qtbase/src/corelib/io/qresource.cpp b/qtbase/src/corelib/io/qresource.cpp
index 04ec81e..2211125 100644
--- a/qtbase/src/corelib/io/qresource.cpp

View File

@ -1 +1 @@
031d110045f9db5f0bf9970c503b680f30fff6c5
8537dffb154dacd9efbcfdd99464866a8e4ef0ef

View File

@ -0,0 +1,53 @@
arora_disable_qprocess.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
src/bookmarks/bookmarksmanager.cpp | 3 +++
src/downloadmanager.cpp | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index d3a21e2..3ddaa4a 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -286,6 +286,8 @@ BookmarksModel *BookmarksManager::bookmarksModel()
void BookmarksManager::importBookmarks()
{
+ /* QProcess is not available on Genode */
+#if 0
QStringList supportedFormats;
supportedFormats << tr("XBEL bookmarks").append(QLatin1String("(*.xbel *.xml)"));
supportedFormats << tr("HTML Netscape bookmarks").append(QLatin1String("(*.html)"));
@@ -330,6 +332,7 @@ void BookmarksManager::importBookmarks()
importRootNode->setType(BookmarkNode::Folder);
importRootNode->title = (tr("Imported %1").arg(QDate::currentDate().toString(Qt::SystemLocaleShortDate)));
addBookmark(menu(), importRootNode);
+#endif
}
void BookmarksManager::exportBookmarks()
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index b0da144..e7b6000 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -525,6 +525,9 @@ bool DownloadManager::allowQuit()
bool DownloadManager::externalDownload(const QUrl &url)
{
+ /* QProcess is not available on Genode */
+ return false;
+#if 0
QSettings settings;
settings.beginGroup(QLatin1String("downloadmanager"));
if (!settings.value(QLatin1String("external"), false).toBool())
@@ -543,6 +546,7 @@ bool DownloadManager::externalDownload(const QUrl &url)
return false;
return QProcess::startDetached(args.takeFirst(), args << QString::fromUtf8(url.toEncoded()));
+#endif
}
void DownloadManager::download(const QNetworkRequest &request, bool requestFileName)

View File

@ -6,3 +6,4 @@ arora_disable_adblock.patch
arora_bookmarks.patch
arora_startpage.patch
arora_disable_ssl_messageboxes.patch
arora_disable_qprocess.patch