diff options
author | Jesper Schmitz Mouridsen <jsm@FreeBSD.org> | 2019-03-28 17:59:33 +0000 |
---|---|---|
committer | Jesper Schmitz Mouridsen <jsm@FreeBSD.org> | 2019-03-28 17:59:33 +0000 |
commit | 0f8e28c12e469870992158896963ee2faa40c239 (patch) | |
tree | 2e9eaf3c10f8a452ca373d484cab9d6c2788cc79 /sysutils/libsysstat | |
parent | 2a6023aa50c64a03f931db8832a268dabbef10ac (diff) | |
download | ports-0f8e28c12e469870992158896963ee2faa40c239.tar.gz ports-0f8e28c12e469870992158896963ee2faa40c239.zip |
Upgrade the LXQt desktop environment to 0.14.0
Upstream announcement https://forum.lxqt.org/t/release-lxqt-0-14-0/572
Approved by: miwi (mentor)
Differential Revision: https://reviews.freebsd.org/D19056
Notes
Notes:
svn path=/head/; revision=497047
Diffstat (limited to 'sysutils/libsysstat')
-rw-r--r-- | sysutils/libsysstat/Makefile | 4 | ||||
-rw-r--r-- | sysutils/libsysstat/distinfo | 6 | ||||
-rw-r--r-- | sysutils/libsysstat/files/patch-CMakeLists.txt | 15 | ||||
-rw-r--r-- | sysutils/libsysstat/files/patch-cpustat.cpp | 243 | ||||
-rw-r--r-- | sysutils/libsysstat/files/patch-cpustat.h | 9 | ||||
-rw-r--r-- | sysutils/libsysstat/files/patch-cpustat__p.h | 8 | ||||
-rw-r--r-- | sysutils/libsysstat/files/patch-memstat.cpp | 30 | ||||
-rw-r--r-- | sysutils/libsysstat/files/patch-memstat.h | 17 | ||||
-rw-r--r-- | sysutils/libsysstat/files/patch-netstat.cpp | 52 |
9 files changed, 189 insertions, 195 deletions
diff --git a/sysutils/libsysstat/Makefile b/sysutils/libsysstat/Makefile index 9dfc65581d1e..2dc54f59d911 100644 --- a/sysutils/libsysstat/Makefile +++ b/sysutils/libsysstat/Makefile @@ -2,8 +2,7 @@ # $FreeBSD$ PORTNAME= libsysstat -PORTVERSION= 0.4.1 -PORTREVISION= 2 +PORTVERSION= 0.4.2 CATEGORIES= sysutils MASTER_SITES= LXQT/${PORTNAME} @@ -15,6 +14,7 @@ LICENSE= LGPL21 USES= cmake compiler:c++11-lang lxqt pkgconfig tar:xz qt:5 USE_QT= qmake_build buildtools_build core USE_LXQT= buildtools +USE_LDCONFIG= yes post-extract: @${CP} ${FILESDIR}/config.h.in ${WRKSRC}; diff --git a/sysutils/libsysstat/distinfo b/sysutils/libsysstat/distinfo index 07f367046631..a0ac366a95ef 100644 --- a/sysutils/libsysstat/distinfo +++ b/sysutils/libsysstat/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1532774948 -SHA256 (lxqt/libsysstat-0.4.1.tar.xz) = c376e5c3a650d56873f2bd757292282f6b6b5af7ecc6d24c7a4df7b8c646ff59 -SIZE (lxqt/libsysstat-0.4.1.tar.xz) = 17304 +TIMESTAMP = 1548874003 +SHA256 (lxqt/libsysstat-0.4.2.tar.xz) = fca482b60fab63bd1eddb594631c76c1373a3b1fcdba19129d49653813e1e967 +SIZE (lxqt/libsysstat-0.4.2.tar.xz) = 17508 diff --git a/sysutils/libsysstat/files/patch-CMakeLists.txt b/sysutils/libsysstat/files/patch-CMakeLists.txt index e30d36bc414b..85026ffd9e74 100644 --- a/sysutils/libsysstat/files/patch-CMakeLists.txt +++ b/sysutils/libsysstat/files/patch-CMakeLists.txt @@ -1,26 +1,25 @@ ---- CMakeLists.txt.orig 2018-05-21 17:16:59 UTC +--- CMakeLists.txt.orig 2019-01-24 21:43:32 UTC +++ CMakeLists.txt -@@ -24,6 +24,16 @@ include(LXQtCreatePkgConfigFile) +@@ -27,7 +27,14 @@ include(LXQtPreventInSourceBuilds) + include(LXQtCreatePkgConfigFile) include(LXQtCreatePortableHeaders) include(LXQtCompilerSettings NO_POLICY_SCOPE) - +include(CheckIncludeFiles) +include(CheckLibraryExists) -+ +check_include_files("sys/socket.h;net/if.h;net/if_mib.h;net/if_types.h" HAVE_IF_H) +check_library_exists(kvm kvm_getswapinfo "kvm.h" HAVE_KVM_H) +check_library_exists(c sysctlbyname "sys/sysctl.h" HAVE_SYSCTL_H) -+ + +configure_file(config.h.in config.h) +add_definitions("-DHAVE_CONFIG_H=1") -+ set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -@@ -81,7 +91,11 @@ add_library(${SYSSTAT_LIBRARY_NAME} +@@ -79,8 +86,11 @@ add_library(${SYSSTAT_LIBRARY_NAME} + ${SYSSTAT_SRCS} ${SYSSTAT_QM_FILES} ) - +- -target_link_libraries(${SYSSTAT_LIBRARY_NAME} Qt5::Core) +if(HAVE_SYSCTL_H AND HAVE_KVM_H) + target_link_libraries(${SYSSTAT_LIBRARY_NAME} c kvm Qt5::Core) diff --git a/sysutils/libsysstat/files/patch-cpustat.cpp b/sysutils/libsysstat/files/patch-cpustat.cpp index 39b971899d44..3775a00793eb 100644 --- a/sysutils/libsysstat/files/patch-cpustat.cpp +++ b/sysutils/libsysstat/files/patch-cpustat.cpp @@ -1,10 +1,8 @@ ---- cpustat.cpp.orig 2018-05-21 17:16:59 UTC +--- cpustat.cpp.orig 2019-01-24 21:43:32 UTC +++ cpustat.cpp -@@ -25,13 +25,64 @@ - - +@@ -27,11 +27,62 @@ #include <unistd.h> -- + #include "cpustat.h" +#ifdef HAVE_SYSCTL_H +extern "C" @@ -18,7 +16,6 @@ + #include <sys/sysctl.h> +} +#endif -+ #include "cpustat_p.h" @@ -27,7 +24,7 @@ +char *GetFirstFragment(char *string, const char *delim) +{ + char *token = NULL; -+ + + token = strsep(&string, delim); + if (token != NULL) + { @@ -60,13 +57,13 @@ + return 0; + else + return freq; - ++ +} +#endif CpuStatPrivate::CpuStatPrivate(CpuStat *parent) : BaseStatPrivate(parent) , mMonitoring(CpuStat::LoadAndFrequency) -@@ -39,7 +90,11 @@ CpuStatPrivate::CpuStatPrivate(CpuStat * +@@ -39,7 +90,11 @@ CpuStatPrivate::CpuStatPrivate(CpuStat *parent) mSource = defaultSource(); connect(mTimer, SIGNAL(timeout()), SLOT(timeout())); @@ -79,57 +76,57 @@ mUserHz = sysconf(_SC_CLK_TCK); updateSources(); -@@ -47,6 +102,49 @@ CpuStatPrivate::CpuStatPrivate(CpuStat * +@@ -47,6 +102,49 @@ CpuStatPrivate::CpuStatPrivate(CpuStat *parent) void CpuStatPrivate::addSource(const QString &source) { +#ifdef HAVE_SYSCTL_H -+ char buf[1024]; -+ char *tokens, *t; -+ ulong min = 0, max = 0; -+ size_t len = sizeof(buf); -+ -+ /* The string returned by the dev.cpu.0.freq_levels sysctl -+ * is a space separated list of MHz/milliwatts. -+ */ -+ if (sysctlbyname("dev.cpu.0.freq_levels", buf, &len, NULL, 0) < 0) -+ return; -+ -+ t = strndup(buf, len); -+ if (t == NULL) -+ { -+ free(t); -+ return; -+ } ++ char buf[1024]; ++ char *tokens, *t; ++ ulong min = 0, max = 0; ++ size_t len = sizeof(buf); + -+ while ((tokens = strsep(&t, " ")) != NULL) -+ { -+ char *freq; -+ ulong res; ++ /* The string returned by the dev.cpu.0.freq_levels sysctl ++ * is a space separated list of MHz/milliwatts. ++ */ ++ if (sysctlbyname("dev.cpu.0.freq_levels", buf, &len, NULL, 0) < 0) ++ return; + -+ freq = GetFirstFragment(tokens, "/"); -+ if (freq != NULL) -+ { -+ res = strtoul(freq, &freq, 10); -+ if (res > max) ++ t = strndup(buf, len); ++ if (t == NULL) + { -+ max = res; ++ free(t); ++ return; + } -+ else ++ ++ while ((tokens = strsep(&t, " ")) != NULL) + { -+ if ((min == 0) || (res < min)) -+ min = res; ++ char *freq; ++ ulong res; ++ ++ freq = GetFirstFragment(tokens, "/"); ++ if (freq != NULL) ++ { ++ res = strtoul(freq, &freq, 10); ++ if (res > max) ++ { ++ max = res; ++ } ++ else ++ { ++ if ((min == 0) || (res < min)) ++ min = res; ++ } ++ } + } -+ } -+ } + -+ free(t); -+ mBounds[source] = qMakePair(min, max); -+#else ++ free(t); ++ mBounds[source] = qMakePair(min, max); ++ #else bool ok; - uint min = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_min_freq").arg(source))).toUInt(&ok); -@@ -56,12 +154,27 @@ void CpuStatPrivate::addSource(const QSt + uint min = readAllFile(qPrintable(QString::fromLatin1("/sys/devices/system/cpu/%1/cpufreq/scaling_min_freq").arg(source))).toUInt(&ok); +@@ -56,12 +154,27 @@ void CpuStatPrivate::addSource(const QString &source) if (ok) mBounds[source] = qMakePair(min, max); } @@ -142,23 +139,23 @@ +#ifdef HAVE_SYSCTL_H + mBounds.clear(); + int cpu; -+ + + cpu = GetCpu(); -+ mSources.append("cpu"); // Linux has cpu in /proc/stat ++ mSources.append(QStringLiteral("cpu")); // Linux has cpu in /proc/stat + for (int i =0;i<cpu;i++) + { -+ mSources.append(QString("cpu%1").arg(i)); ++ mSources.append(QString::fromLatin1("cpu%1").arg(i)); + + - -+ addSource(QString("cpu%1").arg(i)); ++ ++ addSource(QString::fromLatin1("cpu%1").arg(i)); + } +#else - const QStringList rows = readAllFile("/proc/stat").split(QChar('\n'), QString::SkipEmptyParts); + const QStringList rows = readAllFile("/proc/stat").split(QLatin1Char('\n'), QString::SkipEmptyParts); for (const QString &row : rows) { @@ -99,6 +212,7 @@ void CpuStatPrivate::updateSources() - addSource(QString("cpu%1").arg(number)); + addSource(QString::fromLatin1("cpu%1").arg(number)); } } +#endif @@ -170,86 +167,86 @@ void CpuStatPrivate::timeout() { +#ifdef HAVE_SYSCTL_H -+ if ( (mMonitoring == CpuStat::LoadOnly) -+ || (mMonitoring == CpuStat::LoadAndFrequency) ) -+ { -+ int cpuNumber=0; -+ long *cp_times=0; -+ if(mSource!="cpu") { -+ size_t cp_size = sizeof(long) * CPUSTATES * GetCpu(); -+ cp_times = (long *)malloc(cp_size); -+ cpuNumber = mSource.midRef(3).toInt(); -+ if (sysctl(mib0,2, cp_times, &cp_size, NULL, 0) < 0) -+ free(cp_times); -+ } else { -+ size_t cp_size = sizeof(long)*CPUSTATES; -+ cp_times = (long *)malloc(cp_size); -+ if(sysctl(mib1,2,cp_times,&cp_size,NULL,0) < 0) -+ free(cp_times); -+ } -+ Values current; -+ current.user = static_cast<ulong>(cp_times[CP_USER+cpuNumber*CPUSTATES]); -+ current.nice = static_cast<ulong>(cp_times[CP_NICE+cpuNumber*CPUSTATES]); -+ current.system = static_cast<ulong>(cp_times[CP_SYS+cpuNumber*CPUSTATES]); -+ current.idle = static_cast<ulong>(cp_times[CP_IDLE+cpuNumber*CPUSTATES]); -+ current.other = static_cast<ulong>(cp_times[CP_INTR+cpuNumber*CPUSTATES]); -+ current.total = current.user + current.nice + current.system+current.idle+current.other; -+ -+ float sumDelta = static_cast<float>(current.total - mPrevious.total); ++ if ( (mMonitoring == CpuStat::LoadOnly) ++ || (mMonitoring == CpuStat::LoadAndFrequency) ) ++ { ++ int cpuNumber=0; ++ long *cp_times=0; ++ if(mSource!=QLatin1String("cpu")) { ++ size_t cp_size = sizeof(long) * CPUSTATES * GetCpu(); ++ cp_times = (long *)malloc(cp_size); ++ cpuNumber = mSource.midRef(3).toInt(); ++ if (sysctl(mib0,2, cp_times, &cp_size, NULL, 0) < 0) ++ free(cp_times); ++ } else { ++ size_t cp_size = sizeof(long)*CPUSTATES; ++ cp_times = (long *)malloc(cp_size); ++ if(sysctl(mib1,2,cp_times,&cp_size,NULL,0) < 0) ++ free(cp_times); ++ } ++ Values current; ++ current.user = static_cast<ulong>(cp_times[CP_USER+cpuNumber*CPUSTATES]); ++ current.nice = static_cast<ulong>(cp_times[CP_NICE+cpuNumber*CPUSTATES]); ++ current.system = static_cast<ulong>(cp_times[CP_SYS+cpuNumber*CPUSTATES]); ++ current.idle = static_cast<ulong>(cp_times[CP_IDLE+cpuNumber*CPUSTATES]); ++ current.other = static_cast<ulong>(cp_times[CP_INTR+cpuNumber*CPUSTATES]); ++ current.total = current.user + current.nice + current.system+current.idle+current.other; + -+ if ((mPrevious.total != 0) && ((sumDelta < mIntervalMin) || (sumDelta > mIntervalMax))) -+ { -+ if (mMonitoring == CpuStat::LoadAndFrequency) -+ emit update(0.0, 0.0, 0.0, 0.0, 0.0, 0); -+ else -+ emit update(0.0, 0.0, 0.0, 0.0); ++ float sumDelta = static_cast<float>(current.total - mPrevious.total); + -+ mPrevious.clear(); -+ } -+ else -+ { -+ if (mMonitoring == CpuStat::LoadAndFrequency) -+ { -+ float freqRate = 1.0; -+ ulong freq = CurrentFreq(); -+ if (freq > 0) ++ if ((mPrevious.total != 0) && ((sumDelta < mIntervalMin) || (sumDelta > mIntervalMax))) + { -+ if(mSource=="cpu") -+ freqRate = static_cast<float>(freq) / static_cast<float>(mBounds[QStringLiteral("cpu0")].second);// use max cpu0 for this case ++ if (mMonitoring == CpuStat::LoadAndFrequency) ++ emit update(0.0, 0.0, 0.0, 0.0, 0.0, 0); + else -+ freqRate = static_cast<float>(freq) / static_cast<float>(mBounds[mSource].second); -+ emit update( -+ static_cast<float>(current.user - mPrevious.user ) / sumDelta, -+ static_cast<float>(current.nice - mPrevious.nice ) / sumDelta, -+ static_cast<float>(current.system - mPrevious.system) / sumDelta, -+ static_cast<float>(current.other - mPrevious.other ) / sumDelta, -+ static_cast<float>(freqRate), -+ freq); -+ } ++ emit update(0.0, 0.0, 0.0, 0.0); ++ ++ mPrevious.clear(); + } + else + { -+ emit update( -+ static_cast<float>(current.user - mPrevious.user ) / sumDelta, -+ static_cast<float>(current.nice - mPrevious.nice ) / sumDelta, -+ static_cast<float>(current.system - mPrevious.system) / sumDelta, -+ static_cast<float>(current.other - mPrevious.other ) / sumDelta); -+ } ++ if (mMonitoring == CpuStat::LoadAndFrequency) ++ { ++ float freqRate = 1.0; ++ ulong freq = CurrentFreq(); ++ if (freq > 0) ++ { ++ if(mSource==QLatin1String("cpu")) ++ freqRate = static_cast<float>(freq) / static_cast<float>(mBounds[QStringLiteral("cpu0")].second);// use max cpu0 for this case ++ else ++ freqRate = static_cast<float>(freq) / static_cast<float>(mBounds[mSource].second); ++ emit update( ++ static_cast<float>(current.user - mPrevious.user ) / sumDelta, ++ static_cast<float>(current.nice - mPrevious.nice ) / sumDelta, ++ static_cast<float>(current.system - mPrevious.system) / sumDelta, ++ static_cast<float>(current.other - mPrevious.other ) / sumDelta, ++ static_cast<float>(freqRate), ++ freq); ++ } ++ } ++ else ++ { ++ emit update( ++ static_cast<float>(current.user - mPrevious.user ) / sumDelta, ++ static_cast<float>(current.nice - mPrevious.nice ) / sumDelta, ++ static_cast<float>(current.system - mPrevious.system) / sumDelta, ++ static_cast<float>(current.other - mPrevious.other ) / sumDelta); ++ } + + -+ mPrevious = current; -+ } ++ mPrevious = current; ++ } + -+ free(cp_times); -+ } -+ else -+ { -+ ulong freq = 0; ++ free(cp_times); ++ } ++ else ++ { ++ ulong freq = 0; + -+ freq = CurrentFreq(); -+ if (freq > 0) -+ emit update(freq); -+ } ++ freq = CurrentFreq(); ++ if (freq > 0) ++ emit update(freq); ++ } +#else if ( (mMonitoring == CpuStat::LoadOnly) || (mMonitoring == CpuStat::LoadAndFrequency) ) diff --git a/sysutils/libsysstat/files/patch-cpustat.h b/sysutils/libsysstat/files/patch-cpustat.h index cca9c5ce905d..f0a117d36f02 100644 --- a/sysutils/libsysstat/files/patch-cpustat.h +++ b/sysutils/libsysstat/files/patch-cpustat.h @@ -1,6 +1,6 @@ ---- cpustat.h.orig 2018-07-28 14:34:23 UTC +--- cpustat.h.orig 2019-01-30 19:27:42 UTC +++ cpustat.h -@@ -27,7 +27,9 @@ +@@ -27,14 +27,20 @@ #ifndef LIBSYSSTAT__CPU_STAT__INCLUDED #define LIBSYSSTAT__CPU_STAT__INCLUDED @@ -11,16 +11,15 @@ #include <QtCore/QObject> #include "basestat.h" -@@ -35,6 +37,12 @@ - namespace SysStat { + namespace SysStat { +- +#ifdef HAVE_SYSCTL_H + char *GetFirstFragment(char *string, const char *delim); + int GetCpu(void); + ulong CurrentFreq(void); +#endif -+ class CpuStatPrivate; class SYSSTATSHARED_EXPORT CpuStat : public BaseStat diff --git a/sysutils/libsysstat/files/patch-cpustat__p.h b/sysutils/libsysstat/files/patch-cpustat__p.h index 3b7d44490d46..74f5c82c9ad0 100644 --- a/sysutils/libsysstat/files/patch-cpustat__p.h +++ b/sysutils/libsysstat/files/patch-cpustat__p.h @@ -1,4 +1,4 @@ ---- cpustat_p.h.orig 2018-07-28 14:34:10 UTC +--- cpustat_p.h.orig 2019-01-30 19:24:29 UTC +++ cpustat_p.h @@ -27,6 +27,9 @@ #ifndef LIBSYSSTAT__CPU_STAT__PRIVATE__INCLUDED @@ -10,7 +10,7 @@ #include <QtCore/QObject> #include <QtCore/QtGlobal> -@@ -52,8 +55,13 @@ public: +@@ -52,8 +55,13 @@ class CpuStatPrivate : public BaseStatPrivate (public) CpuStat::Monitoring monitoring() const; void setMonitoring(CpuStat::Monitoring value); @@ -24,7 +24,7 @@ signals: void update(float user, float nice, float system, float other); -@@ -74,12 +82,21 @@ private: +@@ -74,12 +82,21 @@ private slots: (private) { Values(); @@ -46,7 +46,7 @@ void sum(); -@@ -89,7 +106,13 @@ private: +@@ -89,7 +106,13 @@ private slots: (private) CpuStat::Monitoring mMonitoring; diff --git a/sysutils/libsysstat/files/patch-memstat.cpp b/sysutils/libsysstat/files/patch-memstat.cpp index 938f8ac5af6e..90fde0fa79d4 100644 --- a/sysutils/libsysstat/files/patch-memstat.cpp +++ b/sysutils/libsysstat/files/patch-memstat.cpp @@ -1,12 +1,9 @@ ---- memstat.cpp.orig 2018-07-28 14:33:22 UTC +--- memstat.cpp.orig 2019-01-24 21:43:32 UTC +++ memstat.cpp -@@ -26,10 +26,61 @@ +@@ -26,10 +26,58 @@ #include "memstat.h" #include "memstat_p.h" -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif +#if defined(HAVE_KVM_H) && defined(HAVE_SYSCTL_H) +extern "C" +{ @@ -62,21 +59,21 @@ MemStatPrivate::MemStatPrivate(MemStat *parent) : BaseStatPrivate(parent) { -@@ -52,7 +103,38 @@ void MemStatPrivate::timeout() +@@ -52,7 +100,37 @@ void MemStatPrivate::timeout() qulonglong memCached = 0; qulonglong swapTotal = 0; qulonglong swapFree = 0; +#ifdef HAVE_SYSCTL_H -+ memTotal = MemGetByBytes("hw.physmem"); -+ memFree = MemGetByPages("vm.stats.vm.v_free_count"); -+ memBuffers = MemGetByBytes("vfs.bufspace"); -+ memCached = MemGetByPages("vm.stats.vm.v_inactive_count"); ++ memTotal = MemGetByBytes(QLatin1String("hw.physmem")); ++ memFree = MemGetByPages(QLatin1String("vm.stats.vm.v_free_count")); ++ memBuffers = MemGetByBytes(QLatin1String("vfs.bufspace")); ++ memCached = MemGetByPages(QLatin1String("vm.stats.vm.v_inactive_count")); +#endif +#ifdef HAVE_KVM_H + qulonglong swapUsed = 0; + kvm_t *kd; + struct kvm_swap kswap[16]; /* size taken from pstat/pstat.c */ -+ + + kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open"); + if (kd == NULL) + kvm_close(kd); @@ -96,21 +93,20 @@ + else + kvm_close(kd); +#endif - +#ifndef HAVE_SYSCTL_H - const QStringList rows = readAllFile("/proc/meminfo").split(QChar('\n'), QString::SkipEmptyParts); + const QStringList rows = readAllFile("/proc/meminfo").split(QLatin1Char('\n'), QString::SkipEmptyParts); for (const QString &row : rows) { -@@ -73,7 +155,7 @@ void MemStatPrivate::timeout() - else if(tokens[0] == "SwapFree:") +@@ -73,7 +151,7 @@ void MemStatPrivate::timeout() + else if(tokens[0] == QLatin1String("SwapFree:")) swapFree = tokens[1].toULong(); } - +#endif - if (mSource == "memory") + if (mSource == QLatin1String("memory")) { if (memTotal) -@@ -90,8 +172,11 @@ void MemStatPrivate::timeout() +@@ -90,8 +168,11 @@ void MemStatPrivate::timeout() { if (swapTotal) { diff --git a/sysutils/libsysstat/files/patch-memstat.h b/sysutils/libsysstat/files/patch-memstat.h index 1f8b2abee853..399764f046fb 100644 --- a/sysutils/libsysstat/files/patch-memstat.h +++ b/sysutils/libsysstat/files/patch-memstat.h @@ -1,25 +1,26 @@ ---- memstat.h.orig 2018-07-28 14:33:10 UTC +--- memstat.h.orig 2019-01-30 19:24:29 UTC +++ memstat.h -@@ -27,6 +27,9 @@ +@@ -27,7 +27,9 @@ #ifndef LIBSYSSTAT__MEM_STAT__INCLUDED #define LIBSYSSTAT__MEM_STAT__INCLUDED +- +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif - #include <QtCore/QObject> -@@ -35,6 +38,12 @@ - + #include "basestat.h" +@@ -36,7 +38,11 @@ namespace SysStat { + class MemStatPrivate; +- +#if defined(HAVE_SYSCTL_H) && defined(HAVE_KVM_H) + int SwapDevices(); + qulonglong MemGetByBytes(const QString property); + qulonglong MemGetByPages(const QString property); +#endif -+ - class MemStatPrivate; - class SYSSTATSHARED_EXPORT MemStat : public BaseStat + { + Q_OBJECT diff --git a/sysutils/libsysstat/files/patch-netstat.cpp b/sysutils/libsysstat/files/patch-netstat.cpp index 5dae935a35ae..c3a95336d6f9 100644 --- a/sysutils/libsysstat/files/patch-netstat.cpp +++ b/sysutils/libsysstat/files/patch-netstat.cpp @@ -1,6 +1,6 @@ ---- netstat.cpp.orig 2018-07-28 14:38:10 UTC +--- netstat.cpp.orig 2019-01-30 19:24:29 UTC +++ netstat.cpp -@@ -26,7 +26,21 @@ +@@ -26,8 +26,23 @@ #include "netstat.h" #include "netstat_p.h" @@ -20,48 +20,50 @@ +} +#endif ++ namespace SysStat { -@@ -37,7 +51,7 @@ NetStatPrivate::NetStatPrivate(NetStat * + NetStatPrivate::NetStatPrivate(NetStat *parent) +@@ -37,7 +52,7 @@ NetStatPrivate::NetStatPrivate(NetStat *parent) connect(mTimer, SIGNAL(timeout()), SLOT(timeout())); - +#ifndef HAVE_SYSCTL_H - QStringList rows(readAllFile("/proc/net/dev").split(QChar('\n'), QString::SkipEmptyParts)); + QStringList rows(readAllFile("/proc/net/dev").split(QLatin1Char('\n'), QString::SkipEmptyParts)); rows.erase(rows.begin(), rows.begin() + 2); -@@ -50,6 +64,29 @@ NetStatPrivate::NetStatPrivate(NetStat * +@@ -50,6 +65,29 @@ NetStatPrivate::NetStatPrivate(NetStat *parent) mSources.append(tokens[0].trimmed()); } +#else -+ int count; -+ size_t len; -+ int cntifmib[] = { CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_SYSTEM, IFMIB_IFCOUNT };// net.link.generic.system.ifcount; -+ len = sizeof(int); -+ if (sysctl(cntifmib, 5, &count, &len, NULL, 0) < 0) -+ perror("sysctl"); ++ int count; ++ size_t len; ++ int cntifmib[] = { CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_SYSTEM, IFMIB_IFCOUNT };// net.link.generic.system.ifcount; ++ len = sizeof(int); ++ if (sysctl(cntifmib, 5, &count, &len, NULL, 0) < 0) ++ perror("sysctl"); + + -+ struct ifmibdata ifmd; -+ size_t len1 = sizeof(ifmd); -+ for (int i=1; i<=count;i++) { -+ int name[] = { CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_IFDATA, i, IFDATA_GENERAL }; ++ struct ifmibdata ifmd; ++ size_t len1 = sizeof(ifmd); ++ for (int i=1; i<=count;i++) { ++ int name[] = { CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_IFDATA, i, IFDATA_GENERAL }; + -+ if (sysctl(name, 6, &ifmd, &len1, NULL, 0) < 0) { -+ perror("sysctl"); -+ } -+ if ((ifmd.ifmd_data.ifi_type == IFT_ETHER) || (ifmd.ifmd_data.ifi_type == IFT_IEEE80211)) { -+ const char *iface = ifmd.ifmd_name; -+ mSources.append(QString::fromLatin1(iface)); ++ if (sysctl(name, 6, &ifmd, &len1, NULL, 0) < 0) { ++ perror("sysctl"); ++ } ++ if ((ifmd.ifmd_data.ifi_type == IFT_ETHER) || (ifmd.ifmd_data.ifi_type == IFT_IEEE80211)) { ++ const char *iface = ifmd.ifmd_name; ++ mSources.append(QString::fromLatin1(iface)); ++ } + } -+ } +#endif } NetStatPrivate::~NetStatPrivate() -@@ -58,6 +95,50 @@ NetStatPrivate::~NetStatPrivate() +@@ -58,6 +96,50 @@ NetStatPrivate::~NetStatPrivate() void NetStatPrivate::timeout() { @@ -109,10 +111,10 @@ + } + } +#else - QStringList rows(readAllFile("/proc/net/dev").split(QChar('\n'), QString::SkipEmptyParts)); + QStringList rows(readAllFile("/proc/net/dev").split(QLatin1Char('\n'), QString::SkipEmptyParts)); -@@ -99,6 +180,7 @@ void NetStatPrivate::timeout() +@@ -99,6 +181,7 @@ void NetStatPrivate::timeout() mPrevious[interfaceName] = current; } |