Skip to content

Add support for NetBSD.#275

Open
fraggerfox wants to merge 1 commit into
xxxserxxx:masterfrom
fraggerfox:add-netbsd-support
Open

Add support for NetBSD.#275
fraggerfox wants to merge 1 commit into
xxxserxxx:masterfrom
fraggerfox:add-netbsd-support

Conversation

@fraggerfox

@fraggerfox fraggerfox commented May 7, 2026

Copy link
Copy Markdown

This is the follow up to #274 introducing NetBSD support.

This pull request adds NetBSD support to the project by updating build constraints and introducing a new implementation for process listing on NetBSD. The most significant changes are:

NetBSD Support

  • Added a new file widgets/proc_netbsd.go that implements the getProcs() function using NetBSD-specific ps command syntax and output parsing to retrieve process information. This includes careful handling of column widths and conversion of process data.
  • Support for Temperature is sensors is currently missing in NetBSD (since I need to run it on actual h/w to check if it works). I do plan on adding support to it, once I have time to debug it.

Build Constraints

  • Updated the build tag in logging/logging_dup2.go to include netbsd, ensuring the file is included in NetBSD builds.

Screenshot

image

Running in NetBSD 10.1.

P.S: Some of the code has been written using AI Agent assistance.

@fraggerfox
fraggerfox marked this pull request as ready for review May 7, 2026 03:54
@xxxserxxx

Copy link
Copy Markdown
Owner

How are you running NetBSD? On bare metal, or in a VM? I'm going to set up a VM to verify compilation, and am curious if you have anything I can crib from for the automation.

@fraggerfox

fraggerfox commented May 7, 2026

Copy link
Copy Markdown
Author

How are you running NetBSD? On bare metal, or in a VM? I'm going to set up a VM to verify compilation, and am curious if you have anything I can crib from for the automation.

I am running it in a vm (hence also the lack of temperature sensors implementation).

In the vm, standard go125 build -o cmd/gotop/gotop ./cmd/gotop/ should result in a binary that can execute in NetBSD.

$ file ./cmd/gotop/gotop
./cmd/gotop/gotop: ELF 64-bit LSB executable, x86-64, version 1 (NetBSD), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 7.0, BuildID[sha1]=0f437f26884e13be7f29f6569100fbdc1e51c295, with debug_info, not stripped

@fraggerfox

Copy link
Copy Markdown
Author

How are you running NetBSD? On bare metal, or in a VM? I'm going to set up a VM to verify compilation, and am curious if you have anything I can crib from for the automation.

For automation in GHA, if you are using something like vmactions you can do something like this

  build-netbsd-latest-gcc:
      runs-on: ubuntu-22.04
      timeout-minutes: 20
      steps:
        - uses: actions/checkout@v6
          with:
            submodules: recursive
        - name: Compile
          uses: vmactions/netbsd-vm@v1
          with:
            release: '10.1'
            usesh: true
            prepare: |
              PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
              PKG_PATH="https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/10.1/All/"
              export PATH PKG_PATH
              /usr/sbin/pkg_add pkgin
              pkgin -y install go125
              git config --global --add safe.directory /home/runner/work/gotop/gotop
            run: |
              set -e
              go125 build -o cmd/gotop/gotop ./cmd/gotop/

For exact implementation and prerequisites you can check how it is setup for htop / btop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants