pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bottom: Address build warnings.
Module Name: pkgsrc-wip
Committed By: Santhosh Raju <fox%NetBSD.org@localhost>
Pushed By: fox
Date: Thu Jun 25 00:24:21 2026 +0200
Changeset: ebf063a9177e673d2df2cd7fdc08d3ded751ed24
Modified Files:
bottom/distinfo
bottom/patches/patch-src_collection_disks.rs
bottom/patches/patch-src_collection_disks_netbsd.rs
bottom/patches/patch-src_collection_processes.rs
Added Files:
bottom/patches/patch-src_canvas_dialogs_process__kill__dialog.rs
bottom/patches/patch-src_collection.rs
bottom/patches/patch-src_collection_processes_unix_process__ext.rs
Log Message:
bottom: Address build warnings.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=ebf063a9177e673d2df2cd7fdc08d3ded751ed24
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
bottom/distinfo | 9 +-
...tch-src_canvas_dialogs_process__kill__dialog.rs | 249 +++++++++++++++++++++
bottom/patches/patch-src_collection.rs | 15 ++
bottom/patches/patch-src_collection_disks.rs | 6 +-
.../patches/patch-src_collection_disks_netbsd.rs | 24 +-
bottom/patches/patch-src_collection_processes.rs | 22 +-
...h-src_collection_processes_unix_process__ext.rs | 68 ++++++
7 files changed, 381 insertions(+), 12 deletions(-)
diffs:
diff --git a/bottom/distinfo b/bottom/distinfo
index 66994cc615..f1f13742b6 100644
--- a/bottom/distinfo
+++ b/bottom/distinfo
@@ -690,6 +690,9 @@ Size (wrapcenum-derive-0.4.1.crate) = 7400 bytes
BLAKE2s (zmij-1.0.19.crate) = e6857f8f672ab60cba6575bda0b64bfd4898ee7c34cb1f799842885965039969
SHA512 (zmij-1.0.19.crate) = aa191ba286f10d59727981e68f7fb0214d53b02d6c28951e6f16670433cd79abc4615384b3b1e1f74adc81a3f51c15d906fda0340b03938984693332feeac2cc
Size (zmij-1.0.19.crate) = 23948 bytes
-SHA1 (patch-src_collection_disks.rs) = 6ddb2276a665ef419268e94719a75eefff5e39f5
-SHA1 (patch-src_collection_disks_netbsd.rs) = 7888cbc6db17743783375f6a6e59f7fbe90121a8
-SHA1 (patch-src_collection_processes.rs) = 9c6ac1c1402526252ec3559fa64015ed8ee6d8fd
+SHA1 (patch-src_canvas_dialogs_process__kill__dialog.rs) = 85bd46668e3312a95835d8fe253e4366d81fed91
+SHA1 (patch-src_collection.rs) = 57f4af4730adc2b56074cd7da93afaec218cc93b
+SHA1 (patch-src_collection_disks.rs) = 63f0217e955e53a87ff134e74d15f315075e8a8c
+SHA1 (patch-src_collection_disks_netbsd.rs) = 3a5638e3cb2f79605bb0aa20f4091cb4b6e9670b
+SHA1 (patch-src_collection_processes.rs) = 21de1c63afbdaf656af1699caaa06d13c91e1751
+SHA1 (patch-src_collection_processes_unix_process__ext.rs) = afdb8d2f114a1ee5ba8102e5c17cec5095c92e74
diff --git a/bottom/patches/patch-src_canvas_dialogs_process__kill__dialog.rs b/bottom/patches/patch-src_canvas_dialogs_process__kill__dialog.rs
new file mode 100644
index 0000000000..bfcd2a6362
--- /dev/null
+++ b/bottom/patches/patch-src_canvas_dialogs_process__kill__dialog.rs
@@ -0,0 +1,249 @@
+$NetBSD$
+
+Add NetBSD support.
+
+--- src/canvas/dialogs/process_kill_dialog.rs.orig 2026-06-22 06:25:54.000000000 +0000
++++ src/canvas/dialogs/process_kill_dialog.rs
+@@ -2,7 +2,7 @@
+
+ use std::time::Instant;
+
+-#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ use ratatui::widgets::ListState;
+ use ratatui::{
+ Frame,
+@@ -11,7 +11,7 @@ use ratatui::{
+ widgets::{Paragraph, Wrap},
+ };
+
+-#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ use crate::canvas::components::scroll_bar::{
+ ScrollBarArgs, dialog_scroll_bar_area, draw_scroll_bar,
+ };
+@@ -165,6 +165,44 @@ cfg_select! {
+ "33: LIBRT",
+ ];
+ }
++ target_os = "netbsd" => {
++ const DEFAULT_KILL_SIGNAL: usize = 15;
++ const SIGNAL_TEXT: [&str; 33] = [
++ "0: Cancel",
++ "1: HUP",
++ "2: INT",
++ "3: QUIT",
++ "4: ILL",
++ "5: TRAP",
++ "6: ABRT",
++ "7: EMT",
++ "8: FPE",
++ "9: KILL",
++ "10: BUS",
++ "11: SEGV",
++ "12: SYS",
++ "13: PIPE",
++ "14: ALRM",
++ "15: TERM",
++ "16: URG",
++ "17: STOP",
++ "18: TSTP",
++ "19: CONT",
++ "20: CHLD",
++ "21: TTIN",
++ "22: TTOU",
++ "23: IO",
++ "24: XCPU",
++ "25: XFSZ",
++ "26: VTALRM",
++ "27: PROF",
++ "28: WINCH",
++ "29: INFO",
++ "30: USR1",
++ "31: USR2",
++ "32: PWR",
++ ];
++ }
+ _ => {}
+ }
+
+@@ -176,7 +214,7 @@ cfg_select! {
+ /// Note that signals are not available for Windows.
+ #[derive(Debug)]
+ pub(crate) enum ButtonState {
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ Signals {
+ state: ListState,
+ last_button_draw_area: Rect,
+@@ -240,7 +278,7 @@ impl ProcessKillDialog {
+ let pids = state.pids;
+
+ match button_state {
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ ButtonState::Signals { state, .. } => {
+ use crate::utils::process_killer;
+
+@@ -280,7 +318,7 @@ impl ProcessKillDialog {
+ }
+ }
+ }
+- any(target_os = "linux", target_os = "macos", target_os = "freebsd") => {
++ any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd") => {
+ use crate::utils::process_killer;
+
+ for pid in pids {
+@@ -306,7 +344,7 @@ impl ProcessKillDialog {
+ }
+
+ pub fn on_char(&mut self, c: char) {
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ const MAX_KEY_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(1);
+
+ match c {
+@@ -315,7 +353,7 @@ impl ProcessKillDialog {
+ 'k' => self.on_up_key(),
+ 'l' => self.on_right_key(),
+ '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => {
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ if let Some(value) = c.to_digit(10)
+ && let ProcessKillDialogState::Selecting(ProcessKillSelectingInner {
+ button_state: ButtonState::Signals { state, .. },
+@@ -364,7 +402,7 @@ impl ProcessKillDialog {
+ }
+ }
+ 'g' => {
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ {
+ if let Some(('g', last_press)) = self.last_char {
+ if last_press.elapsed() <= MAX_KEY_TIMEOUT {
+@@ -380,7 +418,7 @@ impl ProcessKillDialog {
+ }
+ }
+ 'G' => {
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ self.go_to_last();
+ }
+ _ => {}
+@@ -394,7 +432,7 @@ impl ProcessKillDialog {
+ pub fn on_click(&mut self, x: u16, y: u16) -> bool {
+ if let ProcessKillDialogState::Selecting(state) = &mut self.state {
+ match &mut state.button_state {
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ ButtonState::Signals {
+ state,
+ last_button_draw_area,
+@@ -460,7 +498,7 @@ impl ProcessKillDialog {
+ }
+ }
+
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ fn scroll_up_by(state: &mut ListState, amount: usize) {
+ if let Some(selected) = state.selected() {
+ if let Some(new_position) = selected.checked_sub(amount) {
+@@ -471,7 +509,7 @@ impl ProcessKillDialog {
+ }
+ }
+
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ fn scroll_down_by(state: &mut ListState, amount: usize) {
+ if let Some(selected) = state.selected() {
+ let new_position = selected + amount;
+@@ -487,7 +525,7 @@ impl ProcessKillDialog {
+ pub fn on_up_key(&mut self) {
+ self.last_char = None;
+
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ if let ProcessKillDialogState::Selecting(ProcessKillSelectingInner {
+ button_state: ButtonState::Signals { state, .. },
+ ..
+@@ -501,7 +539,7 @@ impl ProcessKillDialog {
+ pub fn on_down_key(&mut self) {
+ self.last_char = None;
+
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ if let ProcessKillDialogState::Selecting(ProcessKillSelectingInner {
+ button_state: ButtonState::Signals { state, .. },
+ ..
+@@ -515,7 +553,7 @@ impl ProcessKillDialog {
+ pub fn on_page_up(&mut self) {
+ self.last_char = None;
+
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ if let ProcessKillDialogState::Selecting(ProcessKillSelectingInner {
+ button_state:
+ ButtonState::Signals {
+@@ -534,7 +572,7 @@ impl ProcessKillDialog {
+ pub fn on_page_down(&mut self) {
+ self.last_char = None;
+
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ if let ProcessKillDialogState::Selecting(ProcessKillSelectingInner {
+ button_state:
+ ButtonState::Signals {
+@@ -552,7 +590,7 @@ impl ProcessKillDialog {
+ pub fn go_to_first(&mut self) {
+ self.last_char = None;
+
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ if let ProcessKillDialogState::Selecting(ProcessKillSelectingInner {
+ button_state: ButtonState::Signals { state, .. },
+ ..
+@@ -565,7 +603,7 @@ impl ProcessKillDialog {
+ pub fn go_to_last(&mut self) {
+ self.last_char = None;
+
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ if let ProcessKillDialogState::Selecting(ProcessKillSelectingInner {
+ button_state: ButtonState::Signals { state, .. },
+ ..
+@@ -587,7 +625,7 @@ impl ProcessKillDialog {
+ }
+ } else {
+ cfg_select! {
+- any(target_os = "linux", target_os = "macos", target_os = "freebsd") => {
++ any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd") => {
+ ButtonState::Signals { state: ListState::default().with_selected(Some(DEFAULT_KILL_SIGNAL)), last_button_draw_area: Rect::default() }
+ }
+ _ => {
+@@ -616,7 +654,7 @@ impl ProcessKillDialog {
+ // FIXME: Not sure if we need this. We can probably handle this better in the
+ // draw function later.
+
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ {
+ if let ProcessKillDialogState::Selecting(ProcessKillSelectingInner {
+ button_state: ButtonState::Signals { state, .. },
+@@ -675,7 +713,7 @@ impl ProcessKillDialog {
+ .wrap(Wrap { trim: true });
+
+ let title = match button_state {
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ ButtonState::Signals { .. } => {
+ Line::styled(" Select Signal ", styles.widget_title_style)
+ }
+@@ -691,7 +729,7 @@ impl ProcessKillDialog {
+ let num_lines = text.line_count(block.inner(draw_area).width) as u16;
+
+ match button_state {
+- #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
++ #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "netbsd"))]
+ ButtonState::Signals {
+ state,
+ last_button_draw_area,
diff --git a/bottom/patches/patch-src_collection.rs b/bottom/patches/patch-src_collection.rs
new file mode 100644
index 0000000000..b7927ef854
--- /dev/null
+++ b/bottom/patches/patch-src_collection.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Add NetBSD support.
+
+--- src/collection.rs.orig 2026-06-22 06:25:54.000000000 +0000
++++ src/collection.rs
+@@ -357,7 +357,7 @@ impl DataCollector {
+ }
+ }
+
+- #[cfg(any(target_os = "windows", target_os = "freebsd"))]
++ #[cfg(any(target_os = "windows", target_os = "freebsd", target_os = "netbsd"))]
+ if self.widgets_to_harvest.use_disk {
+ if self.should_run_less_routine_tasks {
+ self.sys.disks.refresh(true);
diff --git a/bottom/patches/patch-src_collection_disks.rs b/bottom/patches/patch-src_collection_disks.rs
index 735e69176b..21acaa5f12 100644
--- a/bottom/patches/patch-src_collection_disks.rs
+++ b/bottom/patches/patch-src_collection_disks.rs
@@ -1,6 +1,6 @@
$NetBSD$
-Disable catch-all for disks in NetBSD.
+Add NetBSD support.
--- src/collection/disks.rs.orig 2026-06-22 06:25:54.000000000 +0000
+++ src/collection/disks.rs
@@ -8,10 +8,10 @@ Disable catch-all for disks in NetBSD.
mod unix;
pub(crate) use self::unix::*;
}
-+ target_os = "netbsd" => {
++ target_os = "netbsd" => {
+ mod netbsd;
+ pub(crate) use self::netbsd::*;
-+ }
++ }
_ => {
mod other;
pub(crate) use self::other::*;
diff --git a/bottom/patches/patch-src_collection_disks_netbsd.rs b/bottom/patches/patch-src_collection_disks_netbsd.rs
index 0f01170ad9..0b00d90769 100644
--- a/bottom/patches/patch-src_collection_disks_netbsd.rs
+++ b/bottom/patches/patch-src_collection_disks_netbsd.rs
@@ -2,18 +2,34 @@ $NetBSD$
Implement basic disk parsing for NetBSD.
---- src/collection/disks/netbsd.rs.orig 2026-06-24 12:25:02.110444670 +0000
+--- src/collection/disks/netbsd.rs.orig 2026-06-24 22:13:37.483045145 +0000
+++ src/collection/disks/netbsd.rs
-@@ -0,0 +1,50 @@
+@@ -0,0 +1,66 @@
+//! Disk stats for NetBSD, parsed from `df -P`.
+
+use rustc_hash::FxHashMap as HashMap;
+
-+use super::{DiskHarvest, IoHarvest, keep_disk_entry};
++use super::{DiskHarvest, IoData, IoHarvest, keep_disk_entry};
+use crate::collection::{DataCollector, error::CollectionResult};
+
+pub fn get_io_usage(collector: &DataCollector) -> CollectionResult<IoHarvest> {
-+ Ok(HashMap::default())
++ let io_harvest: HashMap<String, Option<IoData>> = collector
++ .sys
++ .disks
++ .iter()
++ .map(|disk| {
++ let usage = disk.usage();
++ (
++ disk.mount_point().to_string_lossy().to_string(),
++ Some(IoData {
++ read_bytes: usage.read_bytes,
++ write_bytes: usage.written_bytes,
++ }),
++ )
++ })
++ .collect();
++
++ Ok(io_harvest)
+}
+
+pub fn get_disk_usage(collector: &DataCollector) -> CollectionResult<Vec<DiskHarvest>> {
diff --git a/bottom/patches/patch-src_collection_processes.rs b/bottom/patches/patch-src_collection_processes.rs
index 5127945db8..a90f4ddf62 100644
--- a/bottom/patches/patch-src_collection_processes.rs
+++ b/bottom/patches/patch-src_collection_processes.rs
@@ -1,8 +1,8 @@
$NetBSD$
-Enable process info collection for NetBSD.
+Add NetBSD support.
---- src/collection/processes.rs.orig 2026-06-24 10:52:04.504828582 +0000
+--- src/collection/processes.rs.orig 2026-06-22 06:25:54.000000000 +0000
+++ src/collection/processes.rs
@@ -181,7 +181,7 @@ impl DataCollector {
time_diff,
@@ -13,3 +13,21 @@ Enable process info collection for NetBSD.
sysinfo_process_data(self)
}
_ => {
+@@ -226,7 +226,7 @@ pub(super) fn process_status_str(status:
+ _ => "Unknown",
+ }
+ }
+- target_os = "freebsd" => {
++ any(target_os = "freebsd", target_os = "netbsd") => {
+ match status {
+ ProcessStatus::Idle => "Idle",
+ ProcessStatus::Run => "Runnable",
+@@ -235,6 +235,8 @@ pub(super) fn process_status_str(status:
+ ProcessStatus::Zombie => "Zombie",
+ ProcessStatus::Dead => "Dead",
+ ProcessStatus::LockBlocked => "LockBlocked",
++ ProcessStatus::Suspended => "Suspended",
++ ProcessStatus::Tracing => "Tracing",
+ _ => "Unknown",
+ }
+ }
diff --git a/bottom/patches/patch-src_collection_processes_unix_process__ext.rs b/bottom/patches/patch-src_collection_processes_unix_process__ext.rs
new file mode 100644
index 0000000000..be23afe449
--- /dev/null
+++ b/bottom/patches/patch-src_collection_processes_unix_process__ext.rs
@@ -0,0 +1,68 @@
+$NetBSD$
+
+Add NetBSD support.
+
+--- src/collection/processes/unix/process_ext.rs.orig 2026-06-22 06:25:54.000000000 +0000
++++ src/collection/processes/unix/process_ext.rs
+@@ -20,7 +20,7 @@ fn get_nice(pid: Pid) -> i32 {
+ target_os = "freebsd" => {
+ unsafe { libc::getpriority(libc::PRIO_PROCESS, pid) }
+ }
+- target_os = "macos" => {
++ any(target_os = "macos", target_os = "netbsd") => {
+ unsafe { libc::getpriority(libc::PRIO_PROCESS, pid as u32) }
+ }
+ _ => {
+@@ -63,6 +63,31 @@ fn get_priority(pid: Pid) -> i32 {
+
+ if ret == 0 { kp.ki_pri.pri_level as i32 } else { 0 }
+ }
++ target_os = "netbsd" => {
++ use libc::{c_int, c_void};
++ use std::{mem, ptr};
++
++ let mib = [libc::CTL_KERN, libc::KERN_PROC2, libc::KERN_PROC_PID, pid as c_int, mem::size_of::<libc::kinfo_proc2>() as c_int, 1];
++ let mut kp: libc::kinfo_proc2 = unsafe { mem::zeroed() };
++ let mut size = mem::size_of::<libc::kinfo_proc2>();
++
++ // SAFETY: sysctl takes the following pointer arguments
++ // - mib is valid for KERN_PROC2 with KERN_PROC_PID.
++ // - kp is a properly sized output buffer.
++ // - newp is null for a read-only sysctl.
++ let ret = unsafe {
++ libc::sysctl(
++ mib.as_ptr(),
++ mib.len() as u32,
++ &mut kp as *mut _ as *mut c_void,
++ &mut size,
++ ptr::null_mut(),
++ 0,
++ )
++ };
++
++ if ret == 0 { kp.p_priority as i32 } else { 0 }
++ }
+ _ => {
+ 0
+ }
+@@ -257,6 +282,20 @@ fn convert_process_status_to_char(status
+ _ => '?'
+ }
+ }
++ target_os = "netbsd" => {
++ match status {
++ ProcessStatus::Idle => 'I',
++ ProcessStatus::Run => 'R',
++ ProcessStatus::Sleep => 'S',
++ ProcessStatus::Stop => 'T',
++ ProcessStatus::Zombie => 'Z',
++ ProcessStatus::Dead => 'D',
++ ProcessStatus::LockBlocked => 'L',
++ ProcessStatus::Suspended => 'U',
++ ProcessStatus::Tracing => 'X',
++ _ => '?'
++ }
++ }
+ _ => {
+ '?'
+ }
Home |
Main Index |
Thread Index |
Old Index