head 1.2; access; symbols pkgsrc-2025Q4:1.1.0.2 pkgsrc-2025Q4-base:1.1; locks; strict; comment @// @; 1.2 date 2025.12.28.02.25.17; author fox; state dead; branches; next 1.1; commitid nJ9wqNwL4iXWs7oG; 1.1 date 2025.10.11.09.29.30; author wiz; state Exp; branches; next ; commitid z1teinGleRuQj8eG; desc @@ 1.2 log @sysutils/btop: Update to 1.4.6 - Remove the upstreamed patches. - Update required GCC to 14. - Fix permissions for the files. Changes since 1.4.5: ## v1.4.6 References | Description | Author(s) --- | --- | --- #1272 | Skip 'H' and 'HX' suffix in AMD cpu name trimming | @@ramdomPTM #1268 | feature: add process renice functionality | @@goddamnparticle #1285 | Revert "Use /sys/dev/block/MAJOR:MINOR instead of /sys/block/NAME for disk I/O" #1270 | @@deckstose #1277 | feat: Introduce cpu frequency display modes | @@emiliopedrollo #1282 | Fix CPU frequency detection for LoongArch CPUs | @@Twopic2 #1275 | fix arrow keys that send 'O' instead of '[' | @@vandabbin #1251 | OpenBSD: battery: add support for watthour and watts sensors | @@shtrophic #1208 | Add Gotham theme | @@jrebs #1291 | Fix macOS deadlocks and race conditions in collector threads #1292 | @@kuzmeech #1296 | fix: btop crash on arm cpu | @@emiliopedrollo @@zenofile #984 | Added ability to set which gpu vendors to enable | @@thedustinmiller #1274 | added tree toggle of expand/collapse for children of process | @@irabrine #1300 | Use right key codes to match f1 and f2 keys | @@vandabbin #1305 | Handle missing SMC gracefully on macOS | @@achille #1309 | Fix redraw in proc list when changing sort order | @@vandabbin #1304 | Fix load average and GPU watts leaking past box border | @@vandabbin #1220 | feat: respect effective cpus from cgroup | @@deckstose #1218 | feat: display container engine | @@deckstose #1315 | feat: raise cpp standard to c++23 | @@deckstose d0cbaf7 | Add configuration toggle for terminal synchronization | @@aristocratos #1306 | Implement feat Process list pausing | @@vandabbin #1322 | flip name, command, and user sorting | @@vandabbin #1334 | fix tty theme for pause banner | @@vandabbin #1325 | test: add test harness with ctest | @@deckstose #1339 | fix: skip first argument of argv | @@AlvaroParker #1357 | feat: add --themes-dir flag | @@adeci #1359 | fix: don't over-/underflow when parsing --update argument | @@yinghao-w #1362 | fix segfault on musl systems | @@v1cont #1363 | Pass only static duration strings to Config::set in Config::apply_preset | @@yinghao-w #1366 | fix: cpu per-thread totals not reaching 100% | @@Tom94 #1367 | Fix: Align boxes when Cpu bottom and Gpu on | @@yinghao-w #1372 | Minor fixes and improvements for NetBSD | @@fraggerfox #1377 | Fixed GPU rendering | @@TheSovietPancakes #1379 | Fix: Always collect GPU data when cpu_graph_lower = "Auto" | @@yinghao-w #1393 | Fix: humanized units shortening | @@yinghao-w #1401 | Feat: add mouse dragging of scrollbar | @@yinghao-w #1399 | feat: add cli option to dump default config | @@deckstose e969f43 | Added "save_config_on_exit" option to configuration | @@aristocratos @ text @$NetBSD: patch-src_netbsd_btop__collect.cpp,v 1.1 2025/10/11 09:29:30 wiz Exp $ Bugfixes and improvements from RVP in PR 59702. --- src/netbsd/btop_collect.cpp.orig 2025-09-19 20:29:22.000000000 +0000 +++ src/netbsd/btop_collect.cpp @@@@ -52,6 +52,7 @@@@ tab-size = 4 #include #include #include +#include #include #include @@@@ -220,12 +221,12 @@@@ namespace Cpu { prop_object_t fields_array; // List of common thermal sensors in NetBSD. const string sensors[6] = { - "acpitz0", - "acpitz1", "coretemp0", - "coretemp1", + "acpitz0", "thinkpad0", - "amdzentemp0" + "amdzentemp0", + "coretemp1", + "acpitz1" }; int fd = open(_PATH_SYSMON, O_RDONLY); @@@@ -242,10 +243,9 @@@@ namespace Cpu { return got_sensors; } + close(fd); + if (prop_dictionary_count(dict) == 0) { - if (fd != -1) { - close(fd); - } Logger::warning("no drivers registered for envsys"); return got_sensors; } @@@@ -261,15 +261,13 @@@@ namespace Cpu { } } if (prop_object_type(fields_array) != PROP_TYPE_ARRAY) { - if (fd != -1) { - close(fd); - } return got_sensors; } if (Config::getB("show_coretemp") and Config::getB("check_temp")) { got_sensors = true; } + return got_sensors; } @@@@ -294,32 +292,32 @@@@ namespace Cpu { return; } + close(fd); + if (prop_dictionary_count(dict) == 0) { - if (fd != -1) { - close(fd); - } Logger::warning("no drivers registered for envsys"); return; } prop_object_t fields_array = prop_dictionary_get(prop_dictionary_t(dict), Cpu::cpu_sensor.c_str()); if (prop_object_type(fields_array) != PROP_TYPE_ARRAY) { - if (fd != -1) { - close(fd); - } Logger::warning("unknown device " + Cpu::cpu_sensor); return; } prop_object_iterator_t fields_iter = prop_array_iterator(prop_array_t(fields_array)); if (fields_iter == NULL) { - if (fd != -1) { - close(fd); - } return; } + regex_t r; + if (regcomp(&r, "(cpu[0-9]* )*temperature", REG_EXTENDED)) { + Logger::warning("regcomp() failed"); + return; + } + string prop_description = "no description"; + char buf[64]; while ((fields = (prop_dictionary_t) prop_object_iterator_next(prop_object_iterator_t(fields_iter))) != NULL) { props = (prop_dictionary_t) prop_dictionary_get(fields, "device-properties"); if (props != NULL) continue; @@@@ -333,16 +331,19 @@@@ namespace Cpu { } - prop_description = prop_string_cstring(prop_string_t(description)); + prop_string_copy_value(prop_string_t(description), buf, sizeof buf); + prop_description = buf; - if (prop_description == "temperature") { - current_temp = prop_number_integer_value(prop_number_t(cur_value)); + if (regexec(&r, prop_description.c_str(), 0, NULL, 0) == 0) { + current_temp = prop_number_signed_value(prop_number_t(cur_value)); if (max_value != NULL) { - current_cpu.temp_max = MUKTOC(prop_number_integer_value(prop_number_t(max_value))); + current_cpu.temp_max = MUKTOC(prop_number_signed_value(prop_number_t(max_value))); } } } + regfree(&r); + prop_object_iterator_release(fields_iter); prop_object_release(dict); @@@@ -441,10 +442,9 @@@@ namespace Cpu { return {0, 0.0, 0, ""}; } + close(fd); + if (prop_dictionary_count(dict) == 0) { - if (fd != -1) { - close(fd); - } has_battery = false; Logger::warning("no drivers registered for envsys"); return {0, 0.0, 0, ""}; @@@@ -452,9 +452,6 @@@@ namespace Cpu { prop_object_t fields_array = prop_dictionary_get(prop_dictionary_t(dict), "acpibat0"); if (prop_object_type(fields_array) != PROP_TYPE_ARRAY) { - if (fd != -1) { - close(fd); - } has_battery = false; Logger::warning("unknown device 'acpibat0'"); return {0, 0.0, 0, ""}; @@@@ -462,9 +459,6 @@@@ namespace Cpu { prop_object_iterator_t fields_iter = prop_array_iterator(prop_array_t(fields_array)); if (fields_iter == NULL) { - if (fd != -1) { - close(fd); - } has_battery = false; return {0, 0.0, 0, ""}; } @@@@ -476,6 +470,7 @@@@ namespace Cpu { int64_t max_charge = 0; string status = "unknown"; string prop_description = "no description"; + char buf[64]; while ((fields = (prop_dictionary_t) prop_object_iterator_next(prop_object_iterator_t(fields_iter))) != NULL) { props = (prop_dictionary_t) prop_dictionary_get(fields, "device-properties"); @@@@ -490,23 +485,26 @@@@ namespace Cpu { } - prop_description = prop_string_cstring(prop_string_t(description)); + prop_string_copy_value(prop_string_t(description), buf, sizeof buf); + prop_description = buf; if (prop_description == "charge") { if (max_value == NULL) { continue; } - cur_charge = prop_number_integer_value(prop_number_t(cur_value)); - max_charge = prop_number_integer_value(prop_number_t(max_value)); + cur_charge = prop_number_signed_value(prop_number_t(cur_value)); + max_charge = prop_number_signed_value(prop_number_t(max_value)); } if (prop_description == "present") { - is_present = prop_number_integer_value(prop_number_t(cur_value)); + is_present = prop_number_signed_value(prop_number_t(cur_value)); } if (prop_description == "charging") { status = prop_description; - string charging_type = prop_string_cstring(prop_string_t(prop_dictionary_get(fields, "type"))); + char buf[64]; + prop_string_copy_value(prop_string_t(prop_dictionary_get(fields, "type")), buf, sizeof buf); + string charging_type = buf; is_battery = charging_type == "Battery charge" ? true : false; } @ 1.1 log @btop: apply patch from RVP via PR 59702 for various improvements. Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD$ @