git: f2874da847b3 - main - sysutils/libsysstat: Update to 0.4.6

From: Jesper Schmitz Mouridsen <jsm_at_FreeBSD.org>
Date: Wed, 10 Nov 2021 18:27:44 UTC
The branch main has been updated by jsm:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f2874da847b3a563776d3b612d04a5a4fd569af6

commit f2874da847b3a563776d3b612d04a5a4fd569af6
Author:     Jesper Schmitz Mouridsen <jsm@FreeBSD.org>
AuthorDate: 2021-11-10 16:25:30 +0000
Commit:     Jesper Schmitz Mouridsen <jsm@FreeBSD.org>
CommitDate: 2021-11-10 18:25:27 +0000

    sysutils/libsysstat: Update to 0.4.6
---
 sysutils/libsysstat/Makefile                   |  2 +-
 sysutils/libsysstat/distinfo                   |  6 ++--
 sysutils/libsysstat/files/patch-CMakeLists.txt | 10 +++---
 sysutils/libsysstat/files/patch-cpustat.cpp    | 42 ++++++++++----------------
 sysutils/libsysstat/files/patch-memstat.cpp    | 22 ++++++++------
 sysutils/libsysstat/files/patch-netstat.cpp    | 13 ++++----
 6 files changed, 45 insertions(+), 50 deletions(-)

diff --git a/sysutils/libsysstat/Makefile b/sysutils/libsysstat/Makefile
index 3a4454f845ed..d9c2f316405c 100644
--- a/sysutils/libsysstat/Makefile
+++ b/sysutils/libsysstat/Makefile
@@ -1,7 +1,7 @@
 # Created by: Olivier Duchateau
 
 PORTNAME=	libsysstat
-PORTVERSION=	0.4.5
+PORTVERSION=	0.4.6
 CATEGORIES=	sysutils
 MASTER_SITES=	LXQT/${PORTNAME}
 
diff --git a/sysutils/libsysstat/distinfo b/sysutils/libsysstat/distinfo
index 8aaec17c51de..bee2a7e3dbd0 100644
--- a/sysutils/libsysstat/distinfo
+++ b/sysutils/libsysstat/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1618772764
-SHA256 (lxqt/libsysstat-0.4.5.tar.xz) = f19b6550d78939cc1ad11c5788e2a7293f7f886d037837cd1cf56ebcdf2b5ed2
-SIZE (lxqt/libsysstat-0.4.5.tar.xz) = 17744
+TIMESTAMP = 1636559490
+SHA256 (lxqt/libsysstat-0.4.6.tar.xz) = e6c6383d6d6e0e67791be812329cb245035eed35e201e01088515e3ffefb13be
+SIZE (lxqt/libsysstat-0.4.6.tar.xz) = 17648
diff --git a/sysutils/libsysstat/files/patch-CMakeLists.txt b/sysutils/libsysstat/files/patch-CMakeLists.txt
index 85026ffd9e74..d621bc554ed1 100644
--- a/sysutils/libsysstat/files/patch-CMakeLists.txt
+++ b/sysutils/libsysstat/files/patch-CMakeLists.txt
@@ -1,21 +1,23 @@
---- CMakeLists.txt.orig	2019-01-24 21:43:32 UTC
+--- CMakeLists.txt.orig	2021-11-05 10:06:40 UTC
 +++ CMakeLists.txt
-@@ -27,7 +27,14 @@ include(LXQtPreventInSourceBuilds)
+@@ -27,7 +27,15 @@ include(LXQtPreventInSourceBuilds)
  include(LXQtCreatePkgConfigFile)
  include(LXQtCreatePortableHeaders)
  include(LXQtCompilerSettings NO_POLICY_SCOPE)
+-
++if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
 +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")
++endif()
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  
-@@ -79,8 +86,11 @@ add_library(${SYSSTAT_LIBRARY_NAME}
+@@ -79,8 +87,11 @@ add_library(${SYSSTAT_LIBRARY_NAME}
          ${SYSSTAT_SRCS}
          ${SYSSTAT_QM_FILES}
  )
diff --git a/sysutils/libsysstat/files/patch-cpustat.cpp b/sysutils/libsysstat/files/patch-cpustat.cpp
index 0ede73fd5524..9ee0613baa92 100644
--- a/sysutils/libsysstat/files/patch-cpustat.cpp
+++ b/sysutils/libsysstat/files/patch-cpustat.cpp
@@ -1,4 +1,4 @@
---- cpustat.cpp.orig	2021-04-07 06:58:34 UTC
+--- cpustat.cpp.orig	2021-11-05 10:06:40 UTC
 +++ cpustat.cpp
 @@ -22,16 +22,65 @@
  **  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -59,7 +59,7 @@
 +    size_t len = sizeof(freq);
 +    int i = mSource.mid(3).toInt();
 +    if (sysctl(mib2[i],4,&freq, &len, NULL, 0) < 0) {
-+    	perror("sysctl");
++        perror("sysctl");
 +        return 0;
 +    }
 +    else
@@ -130,7 +130,7 @@
 +                        if ((min == 0) || (res < min))
 +                            min = res;
 +                    }
-+               	}
++                }
 +
 +            }
 +
@@ -140,7 +140,7 @@
      bool ok = false;
  
      uint min = readAllFile(qPrintable(QString::fromLatin1("/sys/devices/system/cpu/%1/cpufreq/scaling_min_freq").arg(source))).toUInt(&ok);
-@@ -56,11 +160,35 @@ void CpuStatPrivate::addSource(const QString &source)
+@@ -56,11 +160,34 @@ void CpuStatPrivate::addSource(const QString &source)
          if (ok)
              mBounds[source] = qMakePair(min, max);
      }
@@ -172,11 +172,10 @@
 +
 +    mBounds[QStringLiteral("cpu")] = qMakePair(min,max);
 +#else
-+
- #if (QT_VERSION >= QT_VERSION_CHECK(5,15,0))
      const QStringList rows = readAllFile("/proc/stat").split(QLatin1Char('\n'), Qt::SkipEmptyParts);
- #else
-@@ -110,6 +238,7 @@ void CpuStatPrivate::updateSources()
+     for (const QString &row : rows)
+     {
+@@ -98,6 +225,7 @@ void CpuStatPrivate::updateSources()
                  addSource(QString::fromLatin1("cpu%1").arg(number));
          }
      }
@@ -184,7 +183,7 @@
  }
  
  CpuStatPrivate::~CpuStatPrivate() = default;
-@@ -136,6 +265,113 @@ void CpuStatPrivate::recalculateMinMax()
+@@ -124,6 +252,113 @@ void CpuStatPrivate::recalculateMinMax()
  
  void CpuStatPrivate::timeout()
  {
@@ -221,12 +220,12 @@
 +                float sumDelta = static_cast<float>(current.total - mPrevious.total);
 +                if ((mPrevious.total != 0) && ((sumDelta < mIntervalMin) || (sumDelta > mIntervalMax)))
 +                {
-+                    if (mMonitoring == CpuStat::LoadAndFrequency) 
++                    if (mMonitoring == CpuStat::LoadAndFrequency)
 +		            {
 +                        float freqRate = 1.0;
 +                        ulong freq = CurrentFreq(mSource);
-+				
-+                        	if (mSource == QLatin1String("cpu")) {
++
++                        if (mSource == QLatin1String("cpu")) {
 +                                freq=0;
 +                                for (Bounds::ConstIterator I = mBounds.constBegin(); I != mBounds.constEnd(); ++I) {
 +                                    if (I.key() != QStringLiteral("cpu"))
@@ -237,9 +236,9 @@
 +                            }
 +
 +                        if (freq > 0)
-+                       	{
-+                        freqRate = static_cast<float>(freq) / static_cast<float>(mBounds[mSource].second);
-+                        emit update(0.0, 0.0, 0.0, 0.0, static_cast<float>(freqRate), freq);
++                        {
++                            freqRate = static_cast<float>(freq) / static_cast<float>(mBounds[mSource].second);
++                            emit update(0.0, 0.0, 0.0, 0.0, static_cast<float>(freqRate), freq);
 +                        }
 +                    } else {
 +                        emit update(0.0, 0.0, 0.0, 0.0);
@@ -250,7 +249,7 @@
 +                    {
 +                        float freqRate = 1.0;
 +                        ulong freq = CurrentFreq(mSource);
-+				
++
 +                        if (freq > 0)
 +                        {
 +					        if (mSource == QLatin1String("cpu")) {
@@ -298,16 +297,7 @@
      if ( (mMonitoring == CpuStat::LoadOnly)
        || (mMonitoring == CpuStat::LoadAndFrequency) )
      {
-@@ -246,7 +482,7 @@ void CpuStatPrivate::timeout()
-                     mPrevious = current;
-                 }
-             }
--        }
-+        //}
-     }
-     else
-     {
-@@ -278,6 +514,7 @@ void CpuStatPrivate::timeout()
+@@ -258,6 +493,7 @@ void CpuStatPrivate::timeout()
          }
          emit update(freq);
      }
diff --git a/sysutils/libsysstat/files/patch-memstat.cpp b/sysutils/libsysstat/files/patch-memstat.cpp
index 92134a8acf19..78e493983d06 100644
--- a/sysutils/libsysstat/files/patch-memstat.cpp
+++ b/sysutils/libsysstat/files/patch-memstat.cpp
@@ -1,4 +1,4 @@
---- memstat.cpp.orig	2021-04-18 21:03:41 UTC
+--- memstat.cpp.orig	2021-11-05 10:06:40 UTC
 +++ memstat.cpp
 @@ -26,10 +26,58 @@
  
@@ -59,21 +59,23 @@
  MemStatPrivate::MemStatPrivate(MemStat *parent)
      : BaseStatPrivate(parent)
  {
-@@ -50,7 +98,37 @@ void MemStatPrivate::timeout()
+@@ -49,8 +97,39 @@ void MemStatPrivate::timeout()
+     qulonglong memBuffers = 0;
      qulonglong memCached = 0;
      qulonglong swapTotal = 0;
-     qulonglong swapFree = 0;
+-    qulonglong swapFree = 0;
 +#ifdef HAVE_SYSCTL_H
 +    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);
@@ -94,19 +96,19 @@
 +        kvm_close(kd);
 +#endif
 +#ifndef HAVE_SYSCTL_H
- #if (QT_VERSION >= QT_VERSION_CHECK(5,15,0))
++    qulonglong swapFree = 0;
      const QStringList rows = readAllFile("/proc/meminfo").split(QLatin1Char('\n'), Qt::SkipEmptyParts);
- #else
-@@ -79,7 +157,7 @@ void MemStatPrivate::timeout()
-         else if(tokens[0] == QLatin1String("SwapFree:"))
+     for (const QString &row : rows)
+     {
+@@ -72,6 +151,7 @@ void MemStatPrivate::timeout()
              swapFree = tokens[1].toULong();
      }
--
+ 
 +#endif
      if (mSource == QLatin1String("memory"))
      {
          if (memTotal)
-@@ -96,8 +174,11 @@ void MemStatPrivate::timeout()
+@@ -88,8 +168,11 @@ void MemStatPrivate::timeout()
      {
          if (swapTotal)
          {
diff --git a/sysutils/libsysstat/files/patch-netstat.cpp b/sysutils/libsysstat/files/patch-netstat.cpp
index f0f70a36fdd4..d62dc5a4a1ac 100644
--- a/sysutils/libsysstat/files/patch-netstat.cpp
+++ b/sysutils/libsysstat/files/patch-netstat.cpp
@@ -1,4 +1,4 @@
---- netstat.cpp.orig	2021-04-18 21:04:00 UTC
+--- netstat.cpp.orig	2021-11-05 10:06:40 UTC
 +++ netstat.cpp
 @@ -26,8 +26,23 @@
  
@@ -30,9 +30,9 @@
  
 +#ifndef HAVE_SYSCTL_H
  
- #if (QT_VERSION >= QT_VERSION_CHECK(5,15,0))
      QStringList rows(readAllFile("/proc/net/dev").split(QLatin1Char('\n'), Qt::SkipEmptyParts));
-@@ -58,12 +74,78 @@ NetStatPrivate::NetStatPrivate(NetStat *parent)
+ 
+@@ -50,12 +66,79 @@ NetStatPrivate::NetStatPrivate(NetStat *parent)
  
          mSources.append(tokens[0].trimmed());
      }
@@ -108,10 +108,11 @@
 +
 +        }
 +    }
- #if (QT_VERSION >= QT_VERSION_CHECK(5,15,0))
++#else
      QStringList rows(readAllFile("/proc/net/dev").split(QLatin1Char('\n'), Qt::SkipEmptyParts));
- #else
-@@ -122,6 +204,7 @@ void NetStatPrivate::timeout()
+ 
+ 
+@@ -97,6 +180,7 @@ void NetStatPrivate::timeout()
  
          mPrevious[interfaceName] = current;
      }