pkgsrc-WIP-changes archive

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

btop-git: sync with upstream changes.



Module Name:	pkgsrc-wip
Committed By:	Santhosh Raju <fox%NetBSD.org@localhost>
Pushed By:	fox
Date:		Sun Mar 3 13:26:02 2024 +0100
Changeset:	3440136d762e5c035712137f00a837ab27856eb7

Modified Files:
	btop-git/distinfo
	btop-git/patches/patch-src_netbsd_btop__collect.cpp

Log Message:
btop-git: sync with upstream changes.

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

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

diffstat:
 btop-git/distinfo                                  |  3 +-
 .../patches/patch-src_netbsd_btop__collect.cpp     | 42 ++++++----------------
 2 files changed, 12 insertions(+), 33 deletions(-)

diffs:
diff --git a/btop-git/distinfo b/btop-git/distinfo
index 3bf2c38c32..0565579847 100644
--- a/btop-git/distinfo
+++ b/btop-git/distinfo
@@ -5,4 +5,5 @@ SHA512 (btop-1.2.13.20240301-c6fbfd1e27c27cfe89b2e272c0419e57193ea8c5.tar.gz) =
 Size (btop-1.2.13.20240301-c6fbfd1e27c27cfe89b2e272c0419e57193ea8c5.tar.gz) = 1145548 bytes
 SHA1 (patch-Makefile) = 851febd30b48556be117091f806c2939af23ce38
 SHA1 (patch-src_btop.cpp) = 60c805d6a5343d2e46f8f7cb0b03059426871fe9
-SHA1 (patch-src_netbsd_btop__collect.cpp) = 4b2e4b5b55a736729ae22da8fc954f39836d0fa8
+SHA1 (patch-src_btop__shared.hpp) = 4bc5e25af7a12324d5f7674b4131f802ddad9d0d
+SHA1 (patch-src_netbsd_btop__collect.cpp) = 61c86f24ce40740c1d3b7ab52d52455331476607
diff --git a/btop-git/patches/patch-src_netbsd_btop__collect.cpp b/btop-git/patches/patch-src_netbsd_btop__collect.cpp
index 86a47357eb..4921d72f2d 100644
--- a/btop-git/patches/patch-src_netbsd_btop__collect.cpp
+++ b/btop-git/patches/patch-src_netbsd_btop__collect.cpp
@@ -2,10 +2,11 @@ $NetBSD$
 
 Add support for NetBSD.
 
---- src/netbsd/btop_collect.cpp.orig	2024-03-01 14:23:27.335179971 +0000
+--- src/netbsd/btop_collect.cpp.orig	2024-03-03 12:19:49.439968982 +0000
 +++ src/netbsd/btop_collect.cpp
-@@ -0,0 +1,1436 @@
+@@ -0,0 +1,1414 @@
 +/* Copyright 2021 Aristocratos (jakob%qvantnet.com@localhost)
++   Copyright 2024 Santhosh Raju (fox%NetBSD.org@localhost)
 +
 +   Licensed under the Apache License, Version 2.0 (the "License");
 +   you may not use this file except in compliance with the License.
@@ -189,18 +190,6 @@ Add support for NetBSD.
 +		Mem::old_uptime = system_uptime();
 +		Mem::collect();
 +	}
-+
-+	//* RAII wrapper for kvm_openfiles
-+	class kvm_openfiles_wrapper {
-+		kvm_t* kd = nullptr;
-+	public:
-+		kvm_openfiles_wrapper(const char* execf, const char* coref, const char* swapf, int flags, char* err) {
-+			this->kd = kvm_openfiles(execf, coref, swapf, flags, err);
-+		}
-+		~kvm_openfiles_wrapper() { kvm_close(kd); }
-+		auto operator()() -> kvm_t* { return kd; }
-+	};
-+
 +}  // namespace Shared
 +
 +namespace Cpu {
@@ -928,17 +917,6 @@ Add support for NetBSD.
 +	bool rescale = true;
 +	uint64_t timestamp = 0;
 +
-+	//* RAII wrapper for getifaddrs
-+	class getifaddr_wrapper {
-+		struct ifaddrs *ifaddr;
-+
-+	public:
-+		int status;
-+		getifaddr_wrapper() { status = getifaddrs(&ifaddr); }
-+		~getifaddr_wrapper() { freeifaddrs(ifaddr); }
-+		auto operator()() -> struct ifaddrs * { return ifaddr; }
-+	};
-+
 +	auto collect(bool no_update) -> net_info & {
 +		auto &net = current_net;
 +		auto &config_iface = Config::getS("net_iface");
@@ -948,10 +926,10 @@ Add support for NetBSD.
 +
 +		if (not no_update and errors < 3) {
 +			//? Get interface list using getifaddrs() wrapper
-+			getifaddr_wrapper if_wrap{};
-+			if (if_wrap.status != 0) {
++			IfAddrsPtr if_addrs {};
++			if (if_addrs.get_status() != 0) {
 +				errors++;
-+				Logger::error("Net::collect() -> getifaddrs() failed with id " + to_string(if_wrap.status));
++				Logger::error("Net::collect() -> getifaddrs() failed with id " + to_string(if_addrs.get_status()));
 +				redraw = true;
 +				return empty_net;
 +			}
@@ -963,7 +941,7 @@ Add support for NetBSD.
 +			string ipv4, ipv6;
 +
 +			//? Iteration over all items in getifaddrs() list
-+			for (auto *ifa = if_wrap(); ifa != nullptr; ifa = ifa->ifa_next) {
++			for (auto *ifa = if_addrs.get(); ifa != nullptr; ifa = ifa->ifa_next) {
 +				if (ifa->ifa_addr == nullptr) continue;
 +				family = ifa->ifa_addr->sa_family;
 +				const auto &iface = ifa->ifa_name;
@@ -1250,8 +1228,8 @@ Add support for NetBSD.
 +
 +			int count = 0;
 +			char buf[_POSIX2_LINE_MAX];
-+			Shared::kvm_openfiles_wrapper kd(nullptr, nullptr, nullptr, KVM_NO_FILES, buf);
-+			const struct kinfo_proc2* kprocs = kvm_getproc2(kd(), KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &count);
++			Shared::KvmPtr kd {kvm_openfiles(nullptr, nullptr, nullptr, KVM_NO_FILES, buf)};
++			const struct kinfo_proc2* kprocs = kvm_getproc2(kd.get(), KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &count);
 +
 +			for (int i = 0; i < count; i++) {
 +				const struct kinfo_proc2* kproc = &kprocs[i];
@@ -1278,7 +1256,7 @@ Add support for NetBSD.
 +						continue;
 +					}
 +					new_proc.name = kproc->p_comm;
-+					char** argv = kvm_getargv2(kd(), kproc, 0);
++					char** argv = kvm_getargv2(kd.get(), kproc, 0);
 +					if (argv) {
 +						for (int i = 0; argv[i] and cmp_less(new_proc.cmd.size(), 1000); i++) {
 +							new_proc.cmd += argv[i] + " "s;


Home | Main Index | Thread Index | Old Index