Repository navigation
FreeBSD Port: native-free code to oshi-common - #3316
Conversation
Runs on push to freebsd-ffm and on PRs targeting that branch so the FreeBSD FFM port effort gets CI feedback (the standard PR workflow does not exercise FreeBSD). Two jobs under JDK 25 on FreeBSD: oshi-common + oshi-core-ffm for the FFM port path, oshi-core as a regression guard while code is hoisted into oshi-common. Remove on merge.
Add empty abstract FreeBsd* classes in oshi-common at parallel packages (oshi.hardware.common.platform.unix.freebsd and oshi.software.common.os.unix.freebsd). Rename the 13 FreeBsd concretes in oshi-core to FreeBsd*JNA: 11 now extend the new abstracts, while FreeBsdHardwareAbstractionLayer and FreeBsdOperatingSystem keep extending AbstractHardwareAbstractionLayer/AbstractOperatingSystem directly (matching the pattern used by other OS HAL/OS classes). DragonFly BSD references and SystemInfo updated to point at the new JNA names. FreeBsdOSThread and FreeBsdOSFileStore updated to reference the renamed PsThreadColumns / FreeBsdFileSystemJNA. Sets up the inheritance chain for commit 2 (hoist native-free code into the abstracts) and Phase 5 (add FreeBsd*FFM siblings).
Move oshi.driver.unix.freebsd.disk (GeomDiskList, GeomPartList, Mount, package-info) and DiskDriversTest from oshi-core to oshi-common. These classes are 100% command-line parsing — they belong in the native-free module so both the JNA path (oshi-core) and the FFM path (oshi-core-ffm) can use them verbatim without an FFM-specific port. Module wiring: - oshi-common module-info exports the new package. - oshi-common test module-info opens it for JUnit reflection. - oshi-core test module-info drops the now-stale add-opens for the same package. BND OSGi metadata: oshi-core and oshi-core-ffm have "Export-Package: oshi.driver.*", which previously picked up oshi.driver.unix.freebsd.disk transitively from the oshi-common dependency. After the move, BND was copying those classes back into oshi-core/-ffm target/classes, producing a JPMS split package and a ResolutionException at test launch. Added an explicit "!oshi.driver.unix.freebsd.disk.*" exclusion in both BND configs.
…-common Move FreeBsdFirmware, FreeBsdGraphicsCard, FreeBsdSoundCard, and FreeBsdUsbDevice from oshi-core (oshi.hardware.platform.unix.freebsd) to oshi-common (oshi.hardware.common.platform.unix.freebsd). All four are 100% command-line parsing (dmidecode, pciconf, lshal) with no JNA or sysctl dependency, so they live in the native-free module and are used verbatim by both the JNA and FFM paths. The package change requires import updates in: - FreeBsdHardwareAbstractionLayerJNA (Graphics/Sound/Usb) - FreeBsdComputerSystemJNA (Firmware) - DragonFlyBsdHardwareAbstractionLayer (Graphics/Sound/Usb) No BND exclusion needed here because the new package oshi.hardware.common.platform.unix.freebsd does not match any oshi-core / oshi-core-ffm Export-Package glob.
…i-common PsThreadColumns enum and the derived PS_THREAD_COLUMNS string constant are pure command-line column definitions for `ps -awwxo`. They have no JNA dependency and were already shared between FreeBsdOSProcess(JNA) and FreeBsdOSThread. Hoist them onto the FreeBsdOSProcess abstract in oshi-common as public statics so both subclasses and the now-relocated FreeBsdOSThread can reach them without an oshi-common -> oshi-core backward dependency. Move FreeBsdOSThread from oshi-core (oshi.software.os.unix.freebsd) to oshi-common (oshi.software.common.os.unix.freebsd). It is 100% command-line parsing (ps output) and is used verbatim by both the JNA and future FFM paths. Imports added in FreeBsdOSProcessJNA and FreeBsdOperatingSystemJNA for the new oshi-common location. FreeBsdOSFileStore is intentionally left in oshi-core for now; it references new FreeBsdFileSystemJNA() and will be addressed alongside the FreeBsdFileSystem hoisting work.
…free code Move the public API surface, memoized suppliers, and command-line bits of FreeBsdGlobalMemory, FreeBsdVirtualMemory, and FreeBsdSensors onto the oshi-common abstracts; the JNA concretes shrink to just the sysctl-bound query hooks. FreeBsdGlobalMemory abstract: - Owns the available/total/pageSize/vm suppliers and getter methods. - queryPageSize() lives here as a static command-line helper (sysconf PAGESIZE; sysctl hw.pagesize doesn't work on FreeBSD 13). - queryVmStats(), queryPhysMem(), createVirtualMemory() are protected abstract hooks. FreeBsdVirtualMemory abstract: - Owns swap suppliers, getters, and the swapinfo -k parsing in querySwapUsed(). - Constructor takes a FreeBsdGlobalMemory so the abstract can compute getVirtualMax/InUse from getTotal()/getAvailable(). - querySwapTotal(), queryPagesIn(), queryPagesOut() are protected abstract hooks. FreeBsdSensors abstract: - Inherits no FreeBSD-supported sources for fan speed or CPU voltage; those become concrete no-ops here so JNA/FFM don't both redeclare. - queryCpuTemperature() remains abstract — coretemp sysctl per CPU. JNA concretes (FreeBsdGlobalMemoryJNA, FreeBsdVirtualMemoryJNA, FreeBsdSensorsJNA) now contain only the BsdSysctlUtil and FreeBsdLibc sysctl reads. FreeBsdVirtualMemoryJNA constructor accepts the abstract FreeBsdGlobalMemory type since all calls it makes (getTotal, getAvailable) live on the abstract.
…tive-free code FreeBsdComputerSystem abstract: - Owns the manufModelSerialUuidVers supplier, dmidecode/lshal parsing, and the public getters. - createFirmware() returns the now-hoisted FreeBsdFirmware. - createBaseboard() returns UnixBaseboard (also moved to oshi-common). - queryHostUuid() is the only abstract hook (kern.hostuuid fallback). FreeBsdFileSystem abstract: - Owns the full getFileStores() pipeline (geom part list, df -i, mount -p) and the path/volume include/exclude config keys. - getOpenFileDescriptors/getMaxFileDescriptors delegate to two abstract hooks (kern.openfiles, kern.maxfiles). FreeBsdOSFileStore moves to oshi-common alongside the abstract. Its constructor now captures the owning FreeBsdFileSystem so updateAttributes() can re-query against whichever JNA/FFM concrete produced it, instead of the previous `new FreeBsdFileSystemJNA()` back-reference. FreeBsdNetworkParams abstract: - getIpv4DefaultGateway/getIpv6DefaultGateway are pure `route get default` command-line. - getDomainName/getHostName delegate to queryDomainName()/queryHostName() abstract hooks. queryHostName() returns null on native failure so the abstract falls back to AbstractNetworkParams.getHostName(). UnixBaseboard hoisted from oshi-core (oshi.hardware.platform.unix) to oshi-common (oshi.hardware.common.platform.unix). It is pure-Java and already shared between FreeBSD, NetBSD, OpenBSD, and Solaris; imports updated in those three other ComputerSystem classes.
Drop the wholesale **/unix/freebsd/** and **/unix/*FreeBsd*/ exclusions from the root pom JaCoCo agent config. With the FFM port effort, both the hoisted oshi-common classes and the JNA concretes are exercised on FreeBSD CI and should contribute to coverage. Update the temporary FreeBSD CI to mirror the macos / linux / pr workflows: run the full reactor with -Paggregate-coverage and push the generated jacoco-aggregate/jacoco.xml to Codecov under the `freebsd` flag. Codecov uploads from pushes on this fork will silently no-op without CODECOV_TOKEN — the upload becomes effective once the PR is opened against oshi/oshi where the secret is wired up. Consolidate the previous two-job workflow (FFM modules + oshi-core regression) into a single full-reactor job: aggregate-coverage already covers both, and the standard `unix.yaml` testfreebsd job continues to exist on master as the post-merge regression guard. DragonFly/NetBSD/OpenBSD/Solaris remain excluded — those VMs aren't in this workflow yet. OpenBSD coverage will become tractable once the upstream openbsd-vm action supports 7.8.
…e test Wire a `freebsd` codecov flag into the two long-lived workflows so coverage from the FreeBSD VM stays visible once this PR merges: - pr.yaml: new testfreebsd job (vmactions/freebsd-vm, JDK 25, aggregate-coverage, codecov flag=freebsd). The matrix is per-OS, so FreeBSD lives in its own job rather than the ubuntu/macos/windows matrix. - unix.yaml: existing testfreebsd job switched from -Djacoco.skip=true to -Paggregate-coverage and gained the codecov upload step. - freebsd-ffm.yaml: trimmed to push-only on the freebsd-ffm branch (now that pr.yaml carries FreeBSD on PRs, the workflow's pull_request trigger is redundant). Still temporary; removed at FFM-port wrap-up. Also extract FreeBsdVirtualMemory.parseSwapUsed(String) as a package-private static so the swapinfo -k column parsing is unit testable without shelling out, and add FreeBsdVirtualMemoryTest in oshi-common with five fixtures (normal row, zero used, short row, empty input, non-numeric used). Opens the new oshi.hardware.common.platform.unix.freebsd package in oshi-common module-info.test for JUnit reflection. Establishes the pattern for testability of hoisted command-line parsers; further parsers (readDmiDecode, etc.) can follow the same extract-then-test shape.
oshi.ffm.SystemInfo currently supports LINUX, MAC, and WINDOWS. On
FreeBSD it throws UnsupportedOperationException, which surfaced once
the temporary FreeBSD CI started running with -Paggregate-coverage
(which activates the JNA-vs-FFM comparison test).
Add @EnabledOnOs({ LINUX, MAC, WINDOWS }) to NativeComparisonTest so it
is skipped on FreeBSD until Phase 3 adds FreeBSD to the FFM SystemInfo
factory. Mirrors the existing @EnabledOnOs gate on
NativeFreeComparisonTest.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
📝 WalkthroughWalkthroughExtracts FreeBSD abstract bases into oshi-common, adds JNA-backed FreeBSD implementations in oshi-core, updates SystemInfo and platform wiring to use JNA variants, moves/exports FreeBSD packages, refactors virtual memory swap parsing with unit tests, and adds FreeBSD CI workflows uploading aggregate JaCoCo XML to Codecov. ChangesFreeBSD Platform Architecture Refactoring for JNA and FFM Support
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3316 +/- ##
============================================
- Coverage 76.48% 76.01% -0.48%
Complexity 76 76
============================================
Files 412 448 +36
Lines 15974 17235 +1261
Branches 2583 2820 +237
============================================
+ Hits 12218 13101 +883
- Misses 2271 2532 +261
- Partials 1485 1602 +117
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/unix.yaml (1)
22-22:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAdd
persist-credentials: falseto prevent credential leakage.The checkout action should explicitly disable credential persistence to prevent the GitHub token from being exposed in the FreeBSD VM environment or through artifacts copied back to the host.
🔒 Recommended security fix
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + persist-credentials: false🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/unix.yaml at line 22, The checkout step currently uses actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd; update that step to explicitly set persist-credentials: false to avoid leaking the GITHUB_TOKEN (i.e., add the key persist-credentials: false under the uses: actions/checkout... step in .github/workflows/unix.yaml).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/freebsd-ffm.yaml:
- Line 23: In the checkout step that uses
actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd, add the input
persist-credentials: false to the step configuration to ensure the workflow does
not persist the GITHUB_TOKEN into the FreeBSD VM or any artifacts; update the
step that currently contains "- uses:
actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" to include the
persist-credentials field alongside any existing inputs (e.g., with:
persist-credentials: false).
In @.github/workflows/pr.yaml:
- Line 83: Update the GitHub Actions checkout step (the step using "uses:
actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" / "actions/checkout")
to add persist-credentials: false so the GITHUB_TOKEN is not persisted to the
runner or artifacts; modify the checkout step's inputs to include
persist-credentials: false alongside any existing settings.
In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdGlobalMemory.java`:
- Around line 56-58: The page-size lookup in queryPageSize() incorrectly calls
ExecutingCommand.getFirstAnswer("sysconf PAGESIZE"); change that to call
ExecutingCommand.getFirstAnswer("getconf PAGESIZE") (or "getconf PAGE_SIZE") so
FreeBSD returns the correct page size instead of silently falling back to 4096L;
keep the ParseUtil.parseLongOrDefault wrapper and existing default but replace
the command string in the queryPageSize() method.
In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.java`:
- Around line 68-70: The code in FreeBsdVirtualMemory.querySwapUsed() only reads
a single row (getAnswerAt("swapinfo -k", 1)) which misses additional swap
devices and under-reports usage; change querySwapUsed() to retrieve all lines
from ExecutingCommand.getAllAnswers("swapinfo -k") (or get the full output) and
then either parse the "Total" summary row if present or sum parseSwapUsed(...)
over every device row, keeping parseSwapUsed(String line) as the per-line parser
and returning the aggregated bytes value.
---
Outside diff comments:
In @.github/workflows/unix.yaml:
- Line 22: The checkout step currently uses
actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd; update that step to
explicitly set persist-credentials: false to avoid leaking the GITHUB_TOKEN
(i.e., add the key persist-credentials: false under the uses:
actions/checkout... step in .github/workflows/unix.yaml).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1be48619-659e-4eed-95aa-1a8a869254b3
📒 Files selected for processing (55)
.github/workflows/freebsd-ffm.yaml.github/workflows/pr.yaml.github/workflows/unix.yamloshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.javaoshi-common/src/main/java/module-info.javaoshi-common/src/main/java/oshi/driver/unix/freebsd/disk/GeomDiskList.javaoshi-common/src/main/java/oshi/driver/unix/freebsd/disk/GeomPartList.javaoshi-common/src/main/java/oshi/driver/unix/freebsd/disk/Mount.javaoshi-common/src/main/java/oshi/driver/unix/freebsd/disk/package-info.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/UnixBaseboard.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessor.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdGlobalMemory.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdGraphicsCard.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdHWDiskStore.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdPowerSource.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSensors.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSoundCard.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdInternetProtocolStats.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdOSFileStore.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdOSProcess.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdOSThread.javaoshi-common/src/test/java/module-info.testoshi-common/src/test/java/oshi/driver/unix/freebsd/disk/DiskDriversTest.javaoshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemoryTest.javaoshi-core-ffm/pom.xmloshi-core/pom.xmloshi-core/src/main/java/oshi/SystemInfo.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessorJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystemJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemoryJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHardwareAbstractionLayerJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdPowerSourceJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensorsJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdVirtualMemory.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdVirtualMemoryJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdComputerSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdComputerSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisComputerSystem.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdFileSystemJNA.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdInternetProtocolStatsJNA.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOSProcessJNA.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOperatingSystemJNA.javaoshi-core/src/test/java/module-info.testpom.xml
💤 Files with no reviewable changes (3)
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdVirtualMemory.java
- pom.xml
- oshi-core/src/test/java/module-info.test
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Test JDK 21, windows-latest
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Test JDK 26, windows-latest
- GitHub Check: Analyze (java)
- GitHub Check: JMH Benchmarks, ubuntu-latest
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2026-04-06T04:45:47.644Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:47.644Z
Learning: In the oshi/oshi project, only interfaces and classes in the root packages `oshi`, `oshi.hardware`, and `oshi.software.os` are considered the public API. Code in subpackages that represent specific implementations/platforms (e.g., `oshi.software.os.linux`, `oshi.hardware.platform.linux`, and similar subpackages) is implementation detail. When reviewing, do not treat changes to classes in these platform-specific subpackages as public API breaks (for example: making `LinuxOperatingSystem` abstract, narrowing constructor visibility, or adding/removing abstract methods should not be flagged as breaking public API).
Applied to files:
oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdComputerSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdVirtualMemoryJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystemJNA.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdFileSystemJNA.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemoryJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisComputerSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdComputerSystem.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOperatingSystemJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdPowerSourceJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessorJNA.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdInternetProtocolStatsJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHardwareAbstractionLayerJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreJNA.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOSProcessJNA.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensorsJNA.java
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.
Applied to files:
oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdInternetProtocolStats.javaoshi-common/src/main/java/oshi/driver/unix/freebsd/disk/GeomDiskList.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdHWDiskStore.javaoshi-common/src/main/java/module-info.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdOSProcess.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.javaoshi-common/src/main/java/oshi/driver/unix/freebsd/disk/Mount.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSoundCard.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSensors.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/UnixBaseboard.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdGraphicsCard.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdOSFileStore.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdPowerSource.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessor.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdOSThread.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdUsbDevice.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdGlobalMemory.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.java
📚 Learning: 2026-05-31T05:53:04.246Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3311
File: .github/workflows/site.yaml:21-21
Timestamp: 2026-05-31T05:53:04.246Z
Learning: When a GitHub Actions workflow verifies that a pinned commit SHA matches a version tag, dereference annotated tags before comparing to a commit SHA. The API `GET /repos/{owner}/{repo}/git/refs/tags/{tag}` returns the tag *object* SHA for annotated tags (not the underlying commit SHA), so comparing it directly to a commit SHA will cause false mismatches. Instead: (1) fetch the tag object SHA via `GET /repos/{owner}/{repo}/git/refs/tags/{tag}`; (2) resolve that tag object to the underlying commit by calling `GET /repos/{owner}/{repo}/git/tags/{tag_object_sha}`; (3) compare the pinned commit SHA to the resolved commit at `.object.sha`.
Applied to files:
.github/workflows/pr.yaml.github/workflows/freebsd-ffm.yaml.github/workflows/unix.yaml
📚 Learning: 2026-04-12T19:34:56.879Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:34:56.879Z
Learning: In OSHI’s Java platform implementations, `PhysicalProcessor.getEfficiency()` / `EfficiencyClass` follow the same convention as Windows `PROCESSOR_RELATIONSHIP.EfficiencyClass`: a *higher* numeric efficiency class value represents *greater performance* and *less efficiency* (typically P-cores higher than E-cores). When reviewing, do not treat cases where P-cores are assigned higher efficiency/class values as a bug—this is intentional cross-platform consistency.
Applied to files:
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessor.java
🪛 zizmor (1.25.2)
.github/workflows/pr.yaml
[warning] 83-83: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
.github/workflows/freebsd-ffm.yaml
[warning] 23-23: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🔇 Additional comments (44)
.github/workflows/freebsd-ffm.yaml (1)
24-44: LGTM!.github/workflows/pr.yaml (1)
75-104: LGTM!.github/workflows/unix.yaml (1)
28-42: LGTM!oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java (1)
20-21: LGTM!Also applies to: 59-59
oshi-common/src/main/java/module-info.java (1)
28-28: LGTM!Also applies to: 34-34, 40-40
oshi-common/src/main/java/oshi/driver/unix/freebsd/disk/GeomDiskList.java (1)
2-2: LGTM!oshi-common/src/main/java/oshi/driver/unix/freebsd/disk/Mount.java (1)
2-2: LGTM!oshi-common/src/test/java/module-info.test (1)
49-52: LGTM!oshi-common/src/test/java/oshi/driver/unix/freebsd/disk/DiskDriversTest.java (1)
2-2: LGTM!oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemoryTest.java (1)
1-49: LGTM!oshi-core-ffm/pom.xml (1)
96-96: LGTM!oshi-core/pom.xml (1)
153-153: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/UnixBaseboard.java (1)
2-5: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdCentralProcessor.java (1)
1-10: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.java (1)
23-103: LGTM!oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdInternetProtocolStats.java (1)
1-10: LGTM!oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdNetworkParams.java (1)
10-44: LGTM!oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdOSFileStore.java (1)
17-39: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdGraphicsCard.java (1)
5-106: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdHWDiskStore.java (1)
9-14: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdFirmware.java (1)
5-84: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdPowerSource.java (1)
11-24: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdSensors.java (1)
9-22: LGTM!oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdOSProcess.java (1)
13-29: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessorJNA.java (1)
26-42: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystemJNA.java (1)
17-23: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemoryJNA.java (1)
20-25: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHWDiskStoreJNA.java (1)
20-108: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdHardwareAbstractionLayerJNA.java (1)
34-94: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdPowerSourceJNA.java (1)
26-146: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensorsJNA.java (1)
23-49: Remove overridden fan/voltage methods is safe (defaults exist in base)
FreeBsdSensors(oshi-common, FreeBSD) provides concrete inherited implementations:queryFanSpeeds()returnsnew int[0]andqueryCpuVoltage()returns0d, so dropping theFreeBsdSensorsJNAoverrides won’t change behavior in a way that breaks at runtime/compile time.oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdVirtualMemoryJNA.java (1)
17-37: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.java (1)
24-33: LGTM!Also applies to: 43-68
oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java (1)
37-39: LGTM!Also applies to: 96-96, 101-101, 213-213
oshi-core/src/main/java/oshi/hardware/platform/unix/netbsd/NetBsdComputerSystem.java (1)
15-15: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdComputerSystem.java (1)
15-15: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisComputerSystem.java (1)
7-7: LGTM!Also applies to: 22-22
oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdFileSystemJNA.java (1)
18-26: LGTM!oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdInternetProtocolStatsJNA.java (1)
17-17: LGTM!Also applies to: 27-31
oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.java (1)
19-28: LGTM!Also applies to: 33-60
oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOSProcessJNA.java (1)
39-42: LGTM!Also applies to: 53-60, 90-94, 370-383
oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOperatingSystemJNA.java (1)
32-32: LGTM!Also applies to: 52-59, 93-100, 142-147, 215-217
oshi-core/src/main/java/oshi/SystemInfo.java (1)
17-18: LGTM!Also applies to: 27-27, 124-125, 159-160
oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java (1)
15-24: LGTM!
Bundles four follow-ups on the Phase 2 PR: - Spotless: collapsed extra spaces in the swapinfo -k sample comment block in FreeBsdVirtualMemoryTest (caught by pr.yaml lint job). - JaCoCo agent exclude: narrowed `**/unix/*Bsd*` to `**/unix/BsdNetworkIF*`. The agent's glob lets `*` cross path separators (unlike Ant-style), so the wildcard was silently excluding every hoisted class under `unix/freebsd/Free*Bsd*` from instrumentation — first PR codecov upload showed near-0% patch coverage on the freebsd flag as a result. `BsdNetworkIF` was the only class the original pattern was meant to target; the oshi.jna.platform.unix.*BsdLibc bindings are already covered by `**/jna/**`. - FreeBsdGlobalMemory.queryPageSize: `sysconf PAGESIZE` is not a shell command — the original silently fell back to the 4096L default on every FreeBSD invocation. Switched to `getconf PAGESIZE` (per CodeRabbit). FreeBSD's getconf returns the real page size. - FreeBsdVirtualMemory.querySwapUsed: was reading only row 1 of `swapinfo -k`, under-reporting on systems with multiple swap devices. Added a `sumSwapUsed(List<String>)` aggregator that prefers a "Total" summary row when present (e.g. `-hT` output) and otherwise sums per-device "Used" columns. Four new tests cover the multi-row cases: multi-device sum, Total override, single-device parity, empty/header-only output. Skipping CodeRabbit's `persist-credentials: false` recommendation on the three checkout steps per maintainer's call.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.java (1)
79-94: ⚡ Quick winPass
trimmed(not the rawline) toparseSwapUsedfor consistency.The header/
Totaldetection usestrimmed, butparseSwapUsed(line)(Lines 88, 91) receives the untrimmed line.ParseUtil.whitespacesis\s+, andPattern.splitemits a leading empty element for input with leading whitespace, which would shift the "Used" value tosplit[3]instead ofsplit[2]. Currentswapinfooutput is left-aligned so this isn't a live defect, but aligning ontrimmedremoves the latent off-by-one and is already computed.♻️ Proposed change
if (trimmed.startsWith("Total")) { - totalRow = parseSwapUsed(line); + totalRow = parseSwapUsed(trimmed); continue; } - sum += parseSwapUsed(line); + sum += parseSwapUsed(trimmed);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.java` around lines 79 - 94, The sumSwapUsed method inconsistently passes the raw line to parseSwapUsed while using trimmed for checks; change the two parseSwapUsed(line) calls in sumSwapUsed to parseSwapUsed(trimmed) so parsing uses the same whitespace-normalized input (refer to sumSwapUsed and parseSwapUsed) to avoid off-by-one splits when leading whitespace is present.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.java`:
- Around line 79-94: The sumSwapUsed method inconsistently passes the raw line
to parseSwapUsed while using trimmed for checks; change the two
parseSwapUsed(line) calls in sumSwapUsed to parseSwapUsed(trimmed) so parsing
uses the same whitespace-normalized input (refer to sumSwapUsed and
parseSwapUsed) to avoid off-by-one splits when leading whitespace is present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6fea8b6b-e31d-4714-be8f-e5cc463c9cab
📒 Files selected for processing (4)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdGlobalMemory.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.javaoshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemoryTest.javapom.xml
🚧 Files skipped from review as they are similar to previous changes (1)
- oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdGlobalMemory.java
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 26, windows-latest
- GitHub Check: Test JDK 21, ubuntu-latest
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
- GitHub Check: Test JDK 21, windows-latest
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Analyze (java)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: JMH Benchmarks, ubuntu-latest
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.
Applied to files:
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.java
🔇 Additional comments (3)
pom.xml (1)
825-829: LGTM!oshi-common/src/test/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemoryTest.java (1)
54-90: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.java (1)
100-106: LGTM!
- Pass trimmed line (not raw) to parseSwapUsed inside sumSwapUsed. Avoids the off-by-one column split when swapinfo -k output has leading whitespace (per CodeRabbit nit). - Add @return/@PARAM Javadoc tags to the protected abstract hooks on FreeBsdGlobalMemory, FreeBsdVirtualMemory, FreeBsdComputerSystem, FreeBsdFileSystem, FreeBsdNetworkParams, and to the package-private swap parsers (per pr.yaml lint Checkstyle JavadocMethod rule). - Add package-info.java for the two new oshi-common packages, oshi.hardware.common.platform.unix.freebsd and oshi.software.common.os.unix.freebsd (per JavadocPackage rule).
There was a problem hiding this comment.
🧹 Nitpick comments (1)
oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.java (1)
127-131: 💤 Low valueUse
getOrDefault()for consistency with line 125.Lines 129-130 use the
containsKey()+get()pattern while line 125 already usesgetOrDefault(). Consider aligning for consistency.♻️ Suggested simplification
fsList.add(new FreeBsdOSFileStore(this, name, volume, name, path, options, uuid, isLocal, "", description, type, freeSpace, usableSpace, totalSpace, - inodeFreeMap.containsKey(path) ? inodeFreeMap.get(path) : 0L, - inodeTotalMap.containsKey(path) ? inodeTotalMap.get(path) : 0L)); + inodeFreeMap.getOrDefault(path, 0L), + inodeTotalMap.getOrDefault(path, 0L)));🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.java` around lines 127 - 131, In FreeBsdFileSystem where fsList.add(...) constructs a new FreeBsdOSFileStore, replace the containsKey() + get() pattern for inodeFreeMap and inodeTotalMap with getOrDefault(...) (use 0L as the default) to match the existing use on line 125; update the two occurrences referencing inodeFreeMap and inodeTotalMap inside the FreeBsdOSFileStore constructor call so both consistently use getOrDefault(path, 0L).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.java`:
- Around line 127-131: In FreeBsdFileSystem where fsList.add(...) constructs a
new FreeBsdOSFileStore, replace the containsKey() + get() pattern for
inodeFreeMap and inodeTotalMap with getOrDefault(...) (use 0L as the default) to
match the existing use on line 125; update the two occurrences referencing
inodeFreeMap and inodeTotalMap inside the FreeBsdOSFileStore constructor call so
both consistently use getOrDefault(path, 0L).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7fb05ac1-c913-4167-8a30-565e8faeaa64
📒 Files selected for processing (7)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdGlobalMemory.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/package-info.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-common/src/main/java/oshi/software/common/os/unix/freebsd/package-info.java
✅ Files skipped from review due to trivial changes (2)
- oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/package-info.java
- oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/package-info.java
🚧 Files skipped from review as they are similar to previous changes (4)
- oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdComputerSystem.java
- oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdNetworkParams.java
- oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdGlobalMemory.java
- oshi-common/src/main/java/oshi/hardware/common/platform/unix/freebsd/FreeBsdVirtualMemory.java
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Test JDK 26, windows-latest
- GitHub Check: Test JDK 21, windows-latest
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, ubuntu-latest
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.
Applied to files:
oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.java
🔇 Additional comments (1)
oshi-common/src/main/java/oshi/software/common/os/unix/freebsd/FreeBsdFileSystem.java (1)
151-163: LGTM!
Replace `containsKey(path) ? get(path) : 0L` with `getOrDefault(path, 0L)` on inodeFreeMap and inodeTotalMap inside the FreeBsdOSFileStore constructor call, matching the uuidMap.getOrDefault style used a few lines above. Pre-existing in the original FreeBsdFileSystemJNA before the oshi-common move; CodeRabbit flagged it now because the relocation brought the code into the PR diff for the first time.
* Phase 6 commit 1: wire FreeBSD into oshi.ffm.SystemInfo Adds PlatformEnum.FREEBSD to SUPPORTED_PLATFORMS, dispatches to FreeBsdOperatingSystemFFM / FreeBsdHardwareAbstractionLayerFFM (shipped in PRs #3322 and #3328), and updates the class-level Javadoc that previously listed only Windows/macOS/Linux. FreeBSD is dropped from the "use oshi.SystemInfo (JNA) instead" call-out since the FFM path now covers it; OpenBSD, Solaris, AIX still need the JNA entry point. This is the last load-bearing change of the FreeBSD FFM port — after this, oshi.ffm.SystemInfo.isAvailable() returns true on FreeBSD and the public API works end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Phase 6 commit 2: enable FreeBSD across FFM tests Now that oshi.ffm.SystemInfo dispatches to FreeBSD (Phase 6 commit 1), all six FFM tests previously gated to {LINUX, MAC, WINDOWS} need FreeBSD added so they exercise the new wiring on the FreeBSD CI: * oshi-core-ffm: SystemInfoTest, GlobalMemoryFFMTest, VirtualMemoryFFMTest, OperatingSystemFFMTest, ForeignFunctionsTest * oshi-benchmark: NativeComparisonTest (the big JNA-vs-FFM HAL/OS parity test that retires the per-piece comparison tests we explicitly skipped during Phases 3–5) No assertion changes — the test bodies already cover the FreeBSD-relevant surface generically through the public OSHI API. Mac CI continues to see the same 39 successful / 53 skipped split. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Phase 6 commit 3: handle FreeBSD-specific NativeComparisonTest parity gaps Three failures surfaced when Phase 6 commit 2 enabled NativeComparisonTest on FreeBSD. None are real parity bugs; all are structural differences between FreeBSD's process/sensor model and the other platforms. * ComparisonAssertions.assertWithinRatio now treats both-NaN as equal. CPU temperature comes back NaN on the FreeBSD CI VM (no coretemp kld module loaded) from both JNA and FFM, which is correct parity, but NaN/NaN arithmetic made the ratio check fail. * assertStartTimeMatches helper added to NativeComparisonTest. On Linux/Mac/Windows OSProcess#getStartTime() exposes the kernel's exact start time and strict equality holds. On FreeBSD startTime is derived as (now - elapsedTime) where elapsedTime is the seconds-resolution `ps -o etimes` value; JNA and FFM each capture `now` at slightly different timestamps so the derived values drift by tens of milliseconds. Switched the two startTime assertions (currentProcess() and processListStructure()) to a 2000ms tolerance on FreeBSD; other platforms keep strict equality. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Phase 6 commit 4: more FreeBSD parity gaps surfaced by NativeComparisonTest Two more failures appeared once Phase 6 commit 3's startTime and NaN fixes cleared the way; both are real and fixed in this commit. 1. process.softOpenFileLimit — JNA returned 10328, FFM returned 175554 (real open-files limit). Pre-existing JNA-on-FreeBSD bug: Resource.RLIMIT_NOFILE in the JNA platform module is the Linux value 7, but on FreeBSD RLIMIT_NOFILE = 8 (7 is RLIMIT_NPROC). So FreeBsdOSProcessJNA was calling getrlimit on the wrong resource — returning the max-processes limit instead of open-files. Added an explicit `int RLIMIT_NOFILE = 8;` to FreeBsdLibc that shadows the inherited Linux constant so the existing call site picks up the correct value with no code change at the caller. FFM was already using 8 (added in Phase 5 commit 5). 2. fileStoreUpdateAttributes totalSpace — JNA and FFM call updateAttributes() back-to-back, but on a live filesystem total space can drift by a few blocks while the test is itself writing (the observed delta was exactly 3×4KB = 12 KB out of 208 GB). Relaxed the strict equality to assertWithinRatio with a 0.1% tolerance, the same pattern this file already uses for other drift-prone counters. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Phase 6 commit 5: remove temporary FreeBSD FFM CI workflow freebsd-ffm.yaml was the push-triggered FreeBSD VM job introduced in Phase 1 (PR #3316) so in-progress FFM work got FreeBSD coverage between PR submissions. With the port complete and the permanent testfreebsd job in pr.yaml + unix.yaml exercising every change, the temp workflow is no longer needed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Follow-up to the five FreeBSD FFM port PRs (#3316, #3319, #3322, #3328, #3330) covering loose ends that don't fit any individual port commit. JaCoCo agent excludes: * Remove `**/unix/BsdNetworkIF*` and `**/unix/UnixBaseboard*`. Both classes were hoisted to oshi-common during the port (#3316 and #3328 respectively) and are now exercised on the permanent FreeBSD CI job through `NativeComparisonTest.networkInterfaces()` and `ComputerSystem.getBaseboard()`; the excludes were silently dropping that coverage from the `freebsd` codecov flag. * Add `**/FreeBsdPowerSource*` alongside the existing `**/{Mac,Windows,Linux}PowerSource*` entries. No battery on the FreeBSD CI VM, same hardware-conditional pattern. Documentation: * Update the supported-platforms statement in README.md, FAQ.md, PERFORMANCE.md, src/site/markdown/index.md, oshi-core-ffm module-info Javadoc, oshi-core SystemInfo Javadoc, and oshi-core package-info Javadoc from "Windows, macOS, and Linux" to "Windows, macOS, Linux, and FreeBSD". CHANGELOG.md gains a New Features bullet linking all five FreeBSD FFM port PRs. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* Add temporary OpenBSD FFM CI workflow (#3332) Temporary workflow for the openbsd-ffm branch during FFM migration. Mirrors the existing OpenBSD job from unix.yaml. Will be removed when the port is complete. * OpenBSD FFM port: move native-free code to oshi-common (#3332) Move pure-Java OpenBSD classes (no JNA/native dependencies) from oshi-core to oshi-common so they can be shared by both oshi-core (JNA) and oshi-core-ffm (FFM). Mirrors the FreeBSD port structure from #3316. Moved to oshi-common: - FstatUtil, OpenBsdOSThread, OpenBsdOSProcess (abstract base), OpenBsdOSFileStore, OpenBsdFileSystem (abstract base), OpenBsdInternetProtocolStats, OpenBsdNetworkParams, OpenBsdFirmware, OpenBsdGraphicsCard, OpenBsdSoundCard, OpenBsdUsbDevice, OpenBsdGlobalMemory (abstract base), OpenBsdVirtualMemory Remaining in oshi-core (have native calls): - OpenBsdSysctlUtil, OpenBsdCentralProcessor, OpenBsdGlobalMemory, OpenBsdHWDiskStore, OpenBsdOSProcess, OpenBsdOperatingSystem, OpenBsdFileSystem, OpenBsdComputerSystem, OpenBsdPowerSource, OpenBsdSensors * Fix spotless formatting in OpenBsdOSThread * Fix reversed contains check in FstatUtil The condition `!"pipe".contains(split[4])` is backwards — it tests whether the literal "pipe" contains the column value, not the other way around. Use equals() for exact token matching instead. Latent bug inherited from the original JNA code. * Fix license headers: use 2026 for new files, bump modified files
Summary
Setup commits for the FreeBSD FFM port (tracking #3315): introduce
abstract
FreeBsd*superclasses inoshi-common, rename existingJNA concretes to
FreeBsd*JNA, and migrate pure-Java / command-linecode from oshi-core into the new shared base. Establishes the
inheritance chain so Phase 5 can add
FreeBsd*FFMsiblings withoutredesigning the API.
Per-commit walk
freebsd-ffmbranch).Removed when the port lands.
FreeBsd*JNArenames in oshi-core; HAL and OS continue extendingthe
Abstract...base directly per existing convention.GeomDiskList,GeomPartList,Mount+ test) to oshi-common.FreeBsdFirmware,FreeBsdGraphicsCard,FreeBsdSoundCard,FreeBsdUsbDevice) tooshi.hardware.common.platform.unix.freebsd.*.PsThreadColumns+PS_THREAD_COLUMNSto theabstract; move
FreeBsdOSThreadto oshi-common.GlobalMemory,VirtualMemory,Sensors: public API +memoized suppliers + command-line bits on the abstract; JNA
concretes shrink to sysctl-bound hooks.
ComputerSystem(dmidecode/lshal),FileSystem(geom/df/mount),
NetworkParams(route gateway). MoveFreeBsdOSFileStore(captures owningFreeBsdFileSystemto avoida backward dep) and
UnixBaseboardto oshi-common.**/unix/freebsd/**JaCoCo exclusion; tempCI switches to
-Paggregate-coverage.freebsdcodecov flag inpr.yaml(newvmactions FreeBSD job) and
unix.yaml(existing post-merge job).First testability-pattern demo: extract
FreeBsdVirtualMemory.parseSwapUsed(String)+ unit test.NativeComparisonTestto{LINUX, MAC, WINDOWS};FFM SystemInfo doesn't support FreeBSD until Phase 3.
Intentionally deferred
PowerSource,InternetProtocolStats,HWDiskStore,CentralProcessor,OSProcess,OperatingSystem— all more thanhalf native or structurally coupled to JNA structs. Hoisting their
abstract API now without seeing what FFM's shape wants would just be
rework. They land alongside their FFM counterparts.
Test plan
./mvnw clean test -Paggregate-coveragelocally (Mac, JDK 25)freebsd-ffmtestfreebsdjob inpr.yamlvalidates codecovupload under
flags: freebsdfollow-up before merge or tracked for Phase 5
Tracks #3315.
Summary by CodeRabbit
New Features
Refactor
Tests