pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

qt5-qtbase-git: Cherry-pick from upstream review



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Thu May 26 23:08:33 2016 +0200
Changeset:	fe886228eda0de26434e841591e1c26dd054e9d7

Modified Files:
	qt5-qtbase-git/distinfo
Added Files:
	qt5-qtbase-git/patches/patch-src_corelib_io_io.pri
	qt5-qtbase-git/patches/patch-src_corelib_io_qlockfile__unix.cpp

Log Message:
qt5-qtbase-git: Cherry-pick from upstream review

From: Ralf Nolden <nolden%kde.org@localhost>
Date: Mon, 23 May 2016 20:00:05 +0000 (+0200)
Subject: WIP: Merge BSD implementations of QLockFilePrivate::processNameByPid()
X-Git-Url: https://codereview.qt-project.org/gitweb?p=qt%2Fqtbase.git;a=commitdiff_plain;h=25c36765cc3f1dcd953504d586f79c453f43eb21;hp=c18b802e337c1a58a687a0e9f1b23465c9036b0a

WIP: Merge BSD implementations of QLockFilePrivate::processNameByPid()

Until now, several solutions for the implementations of
processNameByPid() exist:
- one for FreeBSD using libutil through kinfo_getproc()
- one for GNU/kFreeBSD in commit
a8f4fa217daa1b6f7b13cc48c1e5ee8d2d76b008
  was added where kinfo_getproc() is not present using sysctl().

OpenBSD and NetBSD also had different approaches in their ports patches
using kvm() and sysctl(). To find the least common denominator, merge
all versions to the one usable for everyone.

Change-Id: Iced9ef01e5966d8688f464f51024a7ed562e26a3

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=fe886228eda0de26434e841591e1c26dd054e9d7

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 qt5-qtbase-git/distinfo                            |  2 +
 qt5-qtbase-git/patches/patch-src_corelib_io_io.pri | 12 ++++
 .../patch-src_corelib_io_qlockfile__unix.cpp       | 81 ++++++++++++++++++++++
 3 files changed, 95 insertions(+)

diffs:
diff --git a/qt5-qtbase-git/distinfo b/qt5-qtbase-git/distinfo
index aa4d875..65cbaaf 100644
--- a/qt5-qtbase-git/distinfo
+++ b/qt5-qtbase-git/distinfo
@@ -4,3 +4,5 @@ SHA1 (qtbase-opensource-src-5.5.1.tar.xz) = 0b651543fa013ae151b7a11f0d0dee092050
 RMD160 (qtbase-opensource-src-5.5.1.tar.xz) = ce4bccd0703aaf8d904fbecd1f334ef13d698a44
 SHA512 (qtbase-opensource-src-5.5.1.tar.xz) = 4d31de136870025dfb7544f255798884af1ad4f3060b0c00a0467c98af1f7de368eb298d4c52ba6d1ad27e36060b30c0314ce7ba0744b15642420ec89587a575
 Size (qtbase-opensource-src-5.5.1.tar.xz) = 46389212 bytes
+SHA1 (patch-src_corelib_io_io.pri) = 922eb2606a627a6f0da23860a090b34ae259af29
+SHA1 (patch-src_corelib_io_qlockfile__unix.cpp) = e2a1dadfe7422a1c5f3cf4f11385e5bc9c2fc83c
diff --git a/qt5-qtbase-git/patches/patch-src_corelib_io_io.pri b/qt5-qtbase-git/patches/patch-src_corelib_io_io.pri
new file mode 100644
index 0000000..c19b0a2
--- /dev/null
+++ b/qt5-qtbase-git/patches/patch-src_corelib_io_io.pri
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- src/corelib/io/io.pri.orig	2016-05-20 00:28:32.000000000 +0000
++++ src/corelib/io/io.pri
+@@ -147,7 +147,6 @@ win32 {
+             SOURCES += io/qsettings_mac.cpp
+             OBJECTIVE_SOURCES += io/qurl_mac.mm
+         }
+-        freebsd: LIBS_PRIVATE += -lutil         # qlockfile_unix.cpp requires this
+         mac {
+             osx {
+                 OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm
diff --git a/qt5-qtbase-git/patches/patch-src_corelib_io_qlockfile__unix.cpp b/qt5-qtbase-git/patches/patch-src_corelib_io_qlockfile__unix.cpp
new file mode 100644
index 0000000..63f696f
--- /dev/null
+++ b/qt5-qtbase-git/patches/patch-src_corelib_io_qlockfile__unix.cpp
@@ -0,0 +1,81 @@
+$NetBSD$
+
+--- src/corelib/io/qlockfile_unix.cpp.orig	2016-05-20 00:28:32.000000000 +0000
++++ src/corelib/io/qlockfile_unix.cpp
+@@ -59,14 +59,12 @@
+ #   include <unistd.h>
+ #   include <cstdio>
+ #elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS)
++# if !defined(Q_OS_NETBSD)
+ #   include <sys/user.h>
+-# if defined(__GLIBC__) && defined(__FreeBSD_kernel__)
++# endif
+ #   include <sys/cdefs.h>
+ #   include <sys/param.h>
+ #   include <sys/sysctl.h>
+-# else
+-#   include <libutil.h>
+-# endif
+ #endif
+ 
+ QT_BEGIN_NAMESPACE
+@@ -269,30 +267,45 @@ QString QLockFilePrivate::processNameByP
+     buf[len] = 0;
+     return QFileInfo(QFile::decodeName(buf)).fileName();
+ #elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS)
+-# if defined(__GLIBC__) && defined(__FreeBSD_kernel__)
+-    int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid };
++# if defined(Q_OS_NETBSD)
++    struct kinfo_proc2 kp, *proc = &kp;
++    int mib[6] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc2), 1 };
+     size_t len = 0;
+-    if (sysctl(mib, 4, NULL, &len, NULL, 0) < 0)
++    if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0)
++        return QString();
++# elif defined(Q_OS_OPENBSD)
++    struct kinfo_proc kp, *proc = &kp;
++    int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc), 1 };
++    size_t len = 0;
++    if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0)
+         return QString();
+-    kinfo_proc *proc = static_cast<kinfo_proc *>(malloc(len));
+ # else
+-    kinfo_proc *proc = kinfo_getproc(pid);
++    struct kinfo_proc kp, *proc = &kp;
++    int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid };
++    size_t len = 0;
++    if (sysctl(mib, 4, NULL, &len, NULL, 0) < 0)
++        return QString();
+ # endif
++
+     if (!proc)
+         return QString();
+-# if defined(__GLIBC__) && defined(__FreeBSD_kernel__)
+-    if (sysctl(mib, 4, proc, &len, NULL, 0) < 0) {
+-        free(proc);
++
++# if defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD)
++    if (sysctl(mib, 6, proc, &len, NULL, 0) < 0)
+         return QString();
+-    }
+-    if (proc->ki_pid != pid) {
+-        free(proc);
++    if (proc->p_pid != pid)
++        return QString();
++    QString name = QFile::decodeName(proc->p_comm);
++    return name;
++# else
++    if (sysctl(mib, 4, proc, &len, NULL, 0) < 0)
++        return QString();
++    if (proc->ki_pid != pid)
+         return QString();
+-    }
+-# endif
+     QString name = QFile::decodeName(proc->ki_comm);
+-    free(proc);
+     return name;
++# endif
++
+ #else
+     Q_UNUSED(pid);
+     return QString();


Home | Main Index | Thread Index | Old Index