Repository navigation
OpenBSD FFM port: wire FFM consumers + SystemInfo (#3332) - #3335
Conversation
…3332) Layer 2: simple FFM consumers that swap JNA sysctl for FFM equivalents. New FFM classes: - OpenBsdComputerSystemFFM — sysctl hw.vendor/version/serialno/uuid - OpenBsdFileSystemFFM — sysctl kern.nfiles/maxfiles/maxfilesperproc - OpenBsdHWDiskStoreFFM — sysctl hw.disknames + Disklabel + systat Also moves Disklabel driver from oshi-core to oshi-common (pure Java, no native deps) so oshi-core-ffm can access it without a split package.
Layer 3: FFM consumers with struct layouts and process argument parsing. New FFM classes: - OpenBsdGlobalMemoryFFM — Bcachestats struct + vmstat parsing - OpenBsdCentralProcessorFFM — CPU ticks via KERN_CPTIME/CPTIME2, dmesg topology parsing, getloadavg - OpenBsdOperatingSystemFFM — OS version, boot time, process listing, getthrid for thread ID - OpenBsdOSProcessFFM — KERN_PROC_ARGS pointer-list parsing for argv and environment, getrlimit for file descriptor limits Also adds to OpenBsdLibcFunctions: - All sysctl MIB constants (CTL_KERN, CTL_HW, CTL_VFS, etc.) - BCACHESTATS_LAYOUT (18 int64_t fields) - getloadavg binding
Layer 4: wire all FFM consumers into the platform stack. - OpenBsdHardwareAbstractionLayerFFM ties hardware classes together - Add OPENBSD to SystemInfo platform switches - Update module-info to document OpenBSD support Also moves Systat driver and OpenBsdSensors/OpenBsdPowerSource from oshi-core to oshi-common (all pure Java, no native deps) so they are accessible from oshi-core-ffm.
|
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 (18)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (10)
📜 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). (13)
🧰 Additional context used🧠 Learnings (9)📓 Common learnings📚 Learning: 2026-05-31T04:49:16.646ZApplied to files:
📚 Learning: 2026-04-10T22:44:36.786ZApplied to files:
📚 Learning: 2026-03-29T20:01:06.452ZApplied to files:
📚 Learning: 2026-04-06T04:45:47.644ZApplied to files:
📚 Learning: 2026-04-03T18:44:48.200ZApplied to files:
📚 Learning: 2026-04-12T19:22:14.417ZApplied to files:
📚 Learning: 2026-05-30T02:27:59.447ZApplied to files:
📚 Learning: 2026-05-31T05:53:04.246ZApplied to files:
🪛 zizmor (1.25.2).github/workflows/pr.yaml[warning] 110-110: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) .github/workflows/unix.yaml[warning] 18-45: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block (excessive-permissions) 🔇 Additional comments (8)
📝 WalkthroughWalkthroughAdds OpenBSD FFM support: hoists common OpenBSD classes into oshi-common, implements FFM-backed hardware and OS components in oshi-core-ffm, updates module exports, OSGi/build settings, CI workflows, and test gating to enable OpenBSD execution. ChangesOpenBSD FFM Platform Support
Estimated code review effort 🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3335 +/- ##
============================================
+ Coverage 75.85% 75.97% +0.11%
Complexity 76 76
============================================
Files 461 461
Lines 17819 17819
Branches 2898 2898
============================================
+ Hits 13517 13538 +21
+ Misses 2665 2643 -22
- Partials 1637 1638 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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
`@oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java`:
- Around line 95-104: The loop in OpenBsdHWDiskStoreFFM that parses iostat
output uses the wrong token-length guard (it checks split.length < 7) causing
valid longer lines to be skipped and short lines to be accepted; change the
condition to require a minimum length (e.g., split.length >= 7) before accessing
indices 0..5, so in the for-loop over iostat.get() only process rows where
split.length >= 7 and split[0].equals(getName()) and then call
setReadBytes(ParseUtil.parseMultipliedToLongs(split[1])),
setWriteBytes(ParseUtil.parseMultipliedToLongs(split[2])),
setReads(...split[3]...), setWrites(...split[4]...),
setTransferTime(...split[5]...) and setTimeStamp(now).
- Around line 70-76: Fix two bugs in OpenBsdHWDiskStoreFFM: (1) In the
bytesPerSector fallback calculation (where variables sectors, bytesPerSector,
size are used and Long.highestOneBit is called), parenthesize the shift so the
1.5x intent is applied — compute Long.highestOneBit(bytesPerSector +
(bytesPerSector >> 1)) instead of Long.highestOneBit(bytesPerSector +
bytesPerSector >> 1). (2) In the iostat row parsing guard that checks
split.length before indexing split[5], invert the condition to allow rows with
at least 7 columns by using split.length >= 7 (instead of the current inverted
check) so you only access split[5] when the array is long enough.
In
`@oshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.java`:
- Around line 128-143: getProcessListFromPS currently treats the ps header row
as a process; change the loop over ExecutingCommand.runNative(psCommand) to skip
the header line (e.g., skip the first returned line or detect header by checking
if the parsed map has PID/ARGS equal to the header labels) before calling
ParseUtil.stringToEnumMap and constructing OpenBsdOSProcessFFM instances so
getProcessListFromPS and getProcess(int pid) don't return a header-derived
OSProcess. Reference: getProcessListFromPS, psCommand,
ExecutingCommand.runNative, ParseUtil.stringToEnumMap, hasKeywordArgs,
OpenBsdOSProcessFFM.
- Around line 175-180: getThreadCount currently sums numeric TID values from
ExecutingCommand.runNative("ps -axHo tid") (in
OpenBsdOperatingSystemFFM#getThreadCount) which yields a large inflated number;
change it to count threads instead: iterate the returned lines (or use the list
size) and increment a counter for each non-empty TID line (skip any header/blank
lines) and return that count; remove or stop using ParseUtil.parseIntOrDefault
for summing TIDs.
- Around line 145-149: getProcessId() is incorrectly calling
OpenBsdLibcFunctions.getthrid(); replace that call with the correct PID libc
wrapper (add OpenBsdLibcFunctions.getpid() if it doesn't exist) and invoke it
via ForeignFunctions.callInArenaIntOrDefault just like the current pattern,
updating the error text from "getpid failed" to match the invoked function if
needed; target the OpenBsdOperatingSystemFFM.getProcessId() method and the
OpenBsdLibcFunctions class (add a getpid() native wrapper there) so the method
returns the real process ID instead of a thread ID.
🪄 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: e017e85f-2d92-4dbe-96fd-f5b6db3e790e
📒 Files selected for processing (26)
oshi-common/src/main/java/module-info.javaoshi-common/src/main/java/oshi/driver/unix/bsd/Systat.javaoshi-common/src/main/java/oshi/driver/unix/bsd/disk/Disklabel.javaoshi-common/src/main/java/oshi/driver/unix/bsd/disk/package-info.javaoshi-common/src/main/java/oshi/driver/unix/bsd/package-info.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.javaoshi-common/src/test/java/module-info.testoshi-common/src/test/java/oshi/driver/unix/bsd/SystatTest.javaoshi-common/src/test/java/oshi/driver/unix/bsd/disk/DisklabelTest.javaoshi-core-ffm/pom.xmloshi-core-ffm/src/main/java/module-info.javaoshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.javaoshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessorFFM.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdComputerSystemFFM.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdGlobalMemoryFFM.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayerFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdFileSystemFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOSProcessFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.javaoshi-core-ffm/src/test/java/module-info.testoshi-core/pom.xmloshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayer.javaoshi-core/src/test/java/module-info.test
💤 Files with no reviewable changes (2)
- oshi-core/src/test/java/module-info.test
- oshi-core-ffm/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). (15)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- 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: Test JDK 26, ubuntu-latest
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: JMH Benchmarks, ubuntu-latest
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (16)
📓 Common learnings
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
Applied to files:
oshi-common/src/main/java/module-info.javaoshi-core/pom.xmloshi-core-ffm/pom.xmloshi-common/src/test/java/module-info.testoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdComputerSystemFFM.javaoshi-common/src/test/java/oshi/driver/unix/bsd/disk/DisklabelTest.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayer.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdFileSystemFFM.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayerFFM.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.javaoshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdGlobalMemoryFFM.javaoshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOSProcessFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.java
📚 Learning: 2026-04-06T04:45:51.516Z
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:51.516Z
Learning: In the oshi/oshi project, the public API is strictly limited to interfaces and classes in the `oshi`, `oshi.hardware`, and `oshi.software.os` packages. All platform-specific code under subpackages like `oshi.software.os.linux`, `oshi.hardware.platform.linux`, etc., is considered implementation detail — not public API. Do not flag changes to platform-specific classes (e.g., making `LinuxOperatingSystem` abstract, narrowing constructor visibility, adding abstract methods) as public API breaks.
Applied to files:
oshi-common/src/main/java/module-info.javaoshi-core/pom.xmloshi-core-ffm/pom.xmloshi-common/src/test/java/module-info.testoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.javaoshi-common/src/test/java/oshi/driver/unix/bsd/disk/DisklabelTest.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayerFFM.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.javaoshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.javaoshi-core-ffm/src/main/java/module-info.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.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/module-info.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.java
📚 Learning: 2026-05-31T04:49:16.646Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3310
File: oshi-core/src/main/java/oshi/software/os/unix/netbsd/NetBsdOperatingSystem.java:164-166
Timestamp: 2026-05-31T04:49:16.646Z
Learning: In the oshi/oshi project, the NetBSD platform intentionally removes all JNA/native library dependencies (PR `#3310`). `NetBsdOperatingSystem.getThreadId()` uses `(int) Thread.currentThread().getId()` rather than `NetBsdLibc._lwp_self()` because the JNA native library is not bundled with the Maven dependency for the NetBSD platform. The mismatch between Java thread ids and kernel LWP ids is an accepted trade-off. Do not suggest reintroducing JNA-based calls (such as `NetBsdLibc._lwp_self()`) in NetBSD platform code.
Applied to files:
oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.javaoshi-common/src/test/java/oshi/driver/unix/bsd/disk/DisklabelTest.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayer.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayerFFM.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.javaoshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.javaoshi-core-ffm/src/main/java/module-info.javaoshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessorFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOSProcessFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.java
📚 Learning: 2026-04-03T18:44:48.200Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:63-66
Timestamp: 2026-04-03T18:44:48.200Z
Learning: In oshi/oshi PlatformEnum.java, the DRAGONFLYBSD enum constant is intentionally added for platform detection only (no implementation classes exist yet). It allows UnsupportedOperationException messages to say "DragonFly BSD" rather than "Unknown". Full DragonFly BSD support is tracked in issue `#2583`. Do not flag the missing switch-case implementations as a bug.
Applied to files:
oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdComputerSystemFFM.javaoshi-common/src/test/java/oshi/driver/unix/bsd/disk/DisklabelTest.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayer.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayerFFM.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.javaoshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.javaoshi-core-ffm/src/main/java/module-info.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.java
📚 Learning: 2026-05-04T04:58:36.843Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3227
File: oshi-metrics/src/main/java/oshi/metrics/OshiMetrics.java:35-48
Timestamp: 2026-05-04T04:58:36.843Z
Learning: In `oshi-metrics/src/main/java/oshi/metrics/OshiMetrics.java`, the `private final OperatingSystem os` field is intentionally stored in the constructor even though it is not yet used. It is a placeholder for future OS-level metrics (e.g., process metrics) that will be added incrementally. Do not flag it as dead code.
Applied to files:
oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.javaoshi-common/src/test/java/oshi/driver/unix/bsd/disk/DisklabelTest.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.javaoshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.java
📚 Learning: 2026-04-03T18:43:51.290Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:99-100
Timestamp: 2026-04-03T18:43:51.290Z
Learning: In oshi/oshi PlatformEnum.java, the DragonFly BSD detection uses `osName.equalsIgnoreCase("dragonflybsd")` intentionally, mirroring the exact same check in JNA's `Platform.java` source. Java's `os.name` property on DragonFly BSD is "dragonflybsd" (no space), so `startsWith("DragonFly")` is NOT the correct pattern here. Do not suggest changing it to `startsWith`.
Applied to files:
oshi-common/src/test/java/oshi/driver/unix/bsd/disk/DisklabelTest.javaoshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java
📚 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/openbsd/OpenBsdHardwareAbstractionLayer.java
📚 Learning: 2026-04-08T00:58:10.736Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3125
File: oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java:131-133
Timestamp: 2026-04-08T00:58:10.736Z
Learning: In `oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceJNA.java` and `oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java`, the `getPowerSources()` method intentionally returns a singleton list wrapping a single `getPowerSource("System Battery")` call, and the enumeration loop short-circuits after the first eligible battery pack. This matches the longstanding JNA behavior and is not a bug. A broader refactor to support zero-or-more batteries across both implementations is planned for a later date. Do not flag this as an issue.
Applied to files:
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayer.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.javaoshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java
📚 Learning: 2026-03-29T20:01:01.877Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:01.877Z
Learning: In this repo’s `module-info.java` files, keep exports aligned with which platform implementations are actually supported by the current FFM (Foreign Function & Memory) backend. Do not export FreeBSD, OpenBSD, or Solaris packages (e.g., `oshi.util.platform.unix.freebsd|openbsd|solaris`) in modules where the FFM implementation only supports Windows/macOS/Linux; this asymmetry vs older Java targets (e.g., the java11 module-info that exports all Unix packages) is intentional and should not be flagged as an omission unless the underlying support changes.
Applied to files:
oshi-core-ffm/src/main/java/module-info.java
📚 Learning: 2026-03-29T20:03:00.830Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java25/src/main/java/oshi/util/platform/windows/PdhUtilFFM.java:87-89
Timestamp: 2026-03-29T20:03:00.830Z
Learning: In the OSHI FFM codebase (oshi-core-java25), all PDH/Kernel32/COM wrapper methods in classes like PdhFFM, Kernel32FFM, etc. declare `throws Throwable` solely as a compiler artifact of `MethodHandle.invokeExact`. They are native calls and do not throw Java checked exceptions in practice. The enclosing `getOpenFileDescriptors()` method in PdhUtilFFM already has an outer `catch (Throwable t)` that covers the entire method body including any `finally` blocks, so no exception-masking concern exists for cleanup calls like `PdhCloseQuery` in `finally`.
Applied to files:
oshi-core-ffm/src/main/java/module-info.java
📚 Learning: 2026-04-03T02:07:49.467Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3110
File: oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java:119-121
Timestamp: 2026-04-03T02:07:49.467Z
Learning: In `oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java` (and similar FFM/API implementations in OSHI), the `updateAttributes()` method intentionally uses `catch (Throwable e) { return false; }` without logging. This is by design: `updateAttributes()` is a public API method whose contract is to return `false` on failure; callers consume the boolean and would never see log output, so adding a log statement is not desired.
Applied to files:
oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java
📚 Learning: 2026-04-20T03:07:05.660Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3176
File: oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsVirtualMemoryFFM.java:53-60
Timestamp: 2026-04-20T03:07:05.660Z
Learning: In OSHI's Windows FFM paging file implementation (`oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsVirtualMemoryFFM.java`), the `querySwapUsed()` method uses the Windows PDH raw counter for "% Usage" on the paging file. Despite its name, this raw counter returns page counts: `FirstValue` is the number of pages currently used and `SecondValue` is the total number of pages in the swap file. The formatted counter performs the division and multiplies by 100% to yield a true percentage. Therefore, computing swap used bytes as `pageSize * used.get()` (pages × page size) is correct — do not treat the return value as a percentage.
Applied to files:
oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdGlobalMemoryFFM.java
📚 Learning: 2026-04-17T23:43:35.860Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3168
File: oshi-core-java25/src/main/java/oshi/ffm/windows/PdhFFM.java:0-0
Timestamp: 2026-04-17T23:43:35.860Z
Learning: In `oshi-core-java25/src/main/java/oshi/ffm/windows/PdhFFM.java`, the `PDH_RAW_COUNTER_LAYOUT` Java FFM struct layout must place `FirstValue` at byte offset 16 (not 12). The native MSVC compiler inserts 4 bytes of implicit alignment padding before the `LONGLONG FirstValue` field (after CStatus=4 bytes + FILETIME TimeStamp=8 bytes = 12 bytes), because LONGLONG requires 8-byte alignment. The total struct size is 40 bytes (with trailing padding). Do not use JAVA_LONG_UNALIGNED without explicit padding here, as that incorrectly places FirstValue at offset 12 and causes reads of garbage counter values.
Applied to files:
oshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.java
📚 Learning: 2026-04-10T22:44:36.786Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3136
File: oshi-core-java25/src/main/java/oshi/software/os/linux/LinuxOperatingSystemFFM.java:46-53
Timestamp: 2026-04-10T22:44:36.786Z
Learning: In OSHI's `AuxvFFM.queryAuxv()` (oshi-core-java25/src/main/java/oshi/driver/linux/proc/AuxvFFM.java), the do-while loop is safe even when `/proc/self/auxv` cannot be read: `FileUtil.readAllBytesAsBuffer` returns an empty ByteBuffer on failure, and `FileUtil.readLongFromBuffer`/`readIntFromBuffer` return 0L when reading past the buffer limit. This 0L equals AT_NULL, causing the loop to exit immediately with an empty map, which triggers the `getconf`/hardcoded-default fallback in callers like `LinuxOperatingSystemFFM`. Do not flag this do-while loop or the static initializer that calls `AuxvFFM.queryAuxv()` as unsafe.
Applied to files:
oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessorFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOSProcessFFM.java
🔇 Additional comments (17)
oshi-common/src/main/java/module-info.java (1)
28-29: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdPowerSource.java (1)
5-5: LGTM!oshi-common/src/main/java/oshi/hardware/common/platform/unix/openbsd/OpenBsdSensors.java (1)
5-5: LGTM!Also applies to: 21-21
oshi-common/src/test/java/module-info.test (1)
49-52: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayer.java (1)
26-27: LGTM!oshi-common/src/test/java/oshi/driver/unix/bsd/disk/DisklabelTest.java (1)
28-28: LGTM!Also applies to: 60-60, 100-100, 137-137, 164-166, 184-186
oshi-core-ffm/pom.xml (1)
96-96: LGTM!oshi-core/pom.xml (1)
153-153: LGTM!oshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.java (1)
123-195: LGTM!oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessorFFM.java (1)
64-257: LGTM!oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdGlobalMemoryFFM.java (1)
25-60: LGTM!oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdComputerSystemFFM.java (1)
26-79: LGTM!oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHardwareAbstractionLayerFFM.java (1)
35-93: LGTM!oshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOSProcessFFM.java (1)
96-446: LGTM!oshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdFileSystemFFM.java (1)
18-31: LGTM!oshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java (1)
18-24: LGTM!Also applies to: 89-90, 106-107, 123-124
oshi-core-ffm/src/main/java/module-info.java (1)
5-6: LGTM!
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/pr.yaml:
- Line 110: The checkout step using "uses: actions/checkout@..." currently
leaves credential persistence enabled while the workflow also enables VM
workspace copyback; update that checkout step (the actions/checkout invocation)
to set persist-credentials: false so repository credentials are not written into
copied workspace metadata when VM copyback is enabled.
In @.github/workflows/unix.yaml:
- Line 58: The OpenBSD VM job is copying workspace data back with copyback: true
which can carry .git auth data; update the checkout step that uses
actions/checkout (search for the checkout step containing copyback: true or the
OpenBSD job) to set persist-credentials: false on the actions/checkout@... step
(replace or add persist-credentials: false) and do the same change for the other
OpenBSD-related checkout block referenced (the block around the 65-71 region).
Ensure you only change the checkout step option (persist-credentials: false) and
leave other checkout options intact.
🪄 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: c9b69299-9dab-4a10-9cf0-0208226dbd1e
📒 Files selected for processing (13)
.github/workflows/openbsd-ffm.yaml.github/workflows/pr.yaml.github/workflows/unix.yamloshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.javaoshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.javaoshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.javaoshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.javaoshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.javaoshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaoshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java
💤 Files with no reviewable changes (1)
- .github/workflows/openbsd-ffm.yaml
✅ Files skipped from review due to trivial changes (1)
- oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java
🚧 Files skipped from review as they are similar to previous changes (2)
- oshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.java
- oshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.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). (11)
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Test JDK 26, windows-latest
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: JMH Benchmarks, ubuntu-latest
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: Analyze (java)
- GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
🧰 Additional context used
🧠 Learnings (18)
📓 Common learnings
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3310
File: oshi-core/src/main/java/oshi/software/os/unix/netbsd/NetBsdOperatingSystem.java:164-166
Timestamp: 2026-05-31T04:49:16.646Z
Learning: In the oshi/oshi project, the NetBSD platform intentionally removes all JNA/native library dependencies (PR `#3310`). `NetBsdOperatingSystem.getThreadId()` uses `(int) Thread.currentThread().getId()` rather than `NetBsdLibc._lwp_self()` because the JNA native library is not bundled with the Maven dependency for the NetBSD platform. The mismatch between Java thread ids and kernel LWP ids is an accepted trade-off. Do not suggest reintroducing JNA-based calls (such as `NetBsdLibc._lwp_self()`) in NetBSD platform code.
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
Applied to files:
oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaoshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.javaoshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.javaoshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.javaoshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java
📚 Learning: 2026-04-03T18:44:48.200Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:63-66
Timestamp: 2026-04-03T18:44:48.200Z
Learning: In oshi/oshi PlatformEnum.java, the DRAGONFLYBSD enum constant is intentionally added for platform detection only (no implementation classes exist yet). It allows UnsupportedOperationException messages to say "DragonFly BSD" rather than "Unknown". Full DragonFly BSD support is tracked in issue `#2583`. Do not flag the missing switch-case implementations as a bug.
Applied to files:
oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaoshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.javaoshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-04-03T18:43:51.290Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:99-100
Timestamp: 2026-04-03T18:43:51.290Z
Learning: In oshi/oshi PlatformEnum.java, the DragonFly BSD detection uses `osName.equalsIgnoreCase("dragonflybsd")` intentionally, mirroring the exact same check in JNA's `Platform.java` source. Java's `os.name` property on DragonFly BSD is "dragonflybsd" (no space), so `startsWith("DragonFly")` is NOT the correct pattern here. Do not suggest changing it to `startsWith`.
Applied to files:
oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaoshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.javaoshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-05-31T04:49:16.646Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3310
File: oshi-core/src/main/java/oshi/software/os/unix/netbsd/NetBsdOperatingSystem.java:164-166
Timestamp: 2026-05-31T04:49:16.646Z
Learning: In the oshi/oshi project, the NetBSD platform intentionally removes all JNA/native library dependencies (PR `#3310`). `NetBsdOperatingSystem.getThreadId()` uses `(int) Thread.currentThread().getId()` rather than `NetBsdLibc._lwp_self()` because the JNA native library is not bundled with the Maven dependency for the NetBSD platform. The mismatch between Java thread ids and kernel LWP ids is an accepted trade-off. Do not suggest reintroducing JNA-based calls (such as `NetBsdLibc._lwp_self()`) in NetBSD platform code.
Applied to files:
oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaoshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-04-06T04:45:51.516Z
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:51.516Z
Learning: In the oshi/oshi project, the public API is strictly limited to interfaces and classes in the `oshi`, `oshi.hardware`, and `oshi.software.os` packages. All platform-specific code under subpackages like `oshi.software.os.linux`, `oshi.hardware.platform.linux`, etc., is considered implementation detail — not public API. Do not flag changes to platform-specific classes (e.g., making `LinuxOperatingSystem` abstract, narrowing constructor visibility, adding abstract methods) as public API breaks.
Applied to files:
oshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.javaoshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
📚 Learning: 2026-04-15T04:56:18.352Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3163
File: oshi-core-java25/src/test/java/oshi/ffm/mac/CoreFoundationTest.java:97-103
Timestamp: 2026-04-15T04:56:18.352Z
Learning: In CoreFoundationTest.java (oshi-core-java25/src/test/java/oshi/ffm/mac/CoreFoundationTest.java), asserting exact CFGetRetainCount deltas (+1 after retain, -1 after release) is intentional and considered reliable for freshly created CF objects (e.g., CFStringRef via CFStringRef.createCFString) where the test holds sole ownership. Do not flag these assertions as flaky — the Apple "avoid CFGetRetainCount" advisory applies to shared/framework-managed objects, not exclusively owned objects in unit tests.
Applied to files:
oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.javaoshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.javaoshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-04-18T03:18:06.205Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3170
File: oshi-benchmark/src/test/java/oshi/comparison/PerfmonComparisonTest.java:177-183
Timestamp: 2026-04-18T03:18:06.205Z
Learning: In `oshi-benchmark/src/test/java/oshi/comparison/PerfmonComparisonTest.java`, GPU engine PDH instance counts (from `GpuInformationJNA.queryGpuEngineCounters()` / `GpuInformationFFM.queryGpuEngineCounters()`) are highly volatile — counts can differ dramatically (e.g., 53 vs 40) even between queries taken milliseconds apart. Do not assert instance count equality or exact instance list matching between JNA and FFM results. The only reliable assertion is that both are empty or both are non-empty (`assertThat(ffm.getA().isEmpty()).isEqualTo(jna.getA().isEmpty())`).
Applied to files:
oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.javaoshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.javaoshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-04-17T23:43:35.860Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3168
File: oshi-core-java25/src/main/java/oshi/ffm/windows/PdhFFM.java:0-0
Timestamp: 2026-04-17T23:43:35.860Z
Learning: In `oshi-core-java25/src/main/java/oshi/ffm/windows/PdhFFM.java`, the `PDH_RAW_COUNTER_LAYOUT` Java FFM struct layout must place `FirstValue` at byte offset 16 (not 12). The native MSVC compiler inserts 4 bytes of implicit alignment padding before the `LONGLONG FirstValue` field (after CStatus=4 bytes + FILETIME TimeStamp=8 bytes = 12 bytes), because LONGLONG requires 8-byte alignment. The total struct size is 40 bytes (with trailing padding). Do not use JAVA_LONG_UNALIGNED without explicit padding here, as that incorrectly places FirstValue at offset 12 and causes reads of garbage counter values.
Applied to files:
oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java
📚 Learning: 2026-04-20T03:07:05.660Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3176
File: oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsVirtualMemoryFFM.java:53-60
Timestamp: 2026-04-20T03:07:05.660Z
Learning: In OSHI's Windows FFM paging file implementation (`oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsVirtualMemoryFFM.java`), the `querySwapUsed()` method uses the Windows PDH raw counter for "% Usage" on the paging file. Despite its name, this raw counter returns page counts: `FirstValue` is the number of pages currently used and `SecondValue` is the total number of pages in the swap file. The formatted counter performs the division and multiplies by 100% to yield a true percentage. Therefore, computing swap used bytes as `pageSize * used.get()` (pages × page size) is correct — do not treat the return value as a percentage.
Applied to files:
oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java
📚 Learning: 2026-05-30T02:27:59.447Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3307
File: .github/workflows/netbsd.yaml:4-8
Timestamp: 2026-05-30T02:27:59.447Z
Learning: In the oshi/oshi repository, the `.github/workflows/netbsd.yaml` CI workflow intentionally triggers only on `push` to the `netbsd-port` branch during development. Before the final merge to master, NetBSD CI will be integrated into the main Unix CI workflow (e.g., `.github/workflows/pr.yaml` or equivalent). Do not flag the limited trigger scope as an issue on this PR.
Applied to files:
.github/workflows/unix.yaml.github/workflows/pr.yaml
📚 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/unix.yaml.github/workflows/pr.yaml
📚 Learning: 2026-05-04T04:58:36.843Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3227
File: oshi-metrics/src/main/java/oshi/metrics/OshiMetrics.java:35-48
Timestamp: 2026-05-04T04:58:36.843Z
Learning: In `oshi-metrics/src/main/java/oshi/metrics/OshiMetrics.java`, the `private final OperatingSystem os` field is intentionally stored in the constructor even though it is not yet used. It is a placeholder for future OS-level metrics (e.g., process metrics) that will be added incrementally. Do not flag it as dead code.
Applied to files:
oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
📚 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/openbsd/OpenBsdHWDiskStore.java
📚 Learning: 2026-04-19T01:28:47.155Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3174
File: oshi-benchmark/src/test/java/oshi/comparison/WmiComparisonTest.java:237-257
Timestamp: 2026-04-19T01:28:47.155Z
Learning: In `oshi-benchmark/src/test/java/oshi/comparison/WmiComparisonTest.java`, the WMI comparison tests (e.g., `testProcessor`) intentionally validate only index 0 and a few representative fields per WMI data type (String, uint16, uint32, uint64). Exhaustive row-by-row comparison is deliberately avoided for numerically heavy multi-row tables. The design rationale is: matching row counts + a few selected fields covering each data type is sufficient to verify JNA vs FFM driver parity. Do not suggest looping over all rows for these tests.
Applied to files:
oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-04-03T02:07:49.467Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3110
File: oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java:119-121
Timestamp: 2026-04-03T02:07:49.467Z
Learning: In `oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java` (and similar FFM/API implementations in OSHI), the `updateAttributes()` method intentionally uses `catch (Throwable e) { return false; }` without logging. This is by design: `updateAttributes()` is a public API method whose contract is to return `false` on failure; callers consume the boolean and would never see log output, so adding a log statement is not desired.
Applied to files:
oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java
📚 Learning: 2026-04-10T22:44:36.786Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3136
File: oshi-core-java25/src/main/java/oshi/software/os/linux/LinuxOperatingSystemFFM.java:46-53
Timestamp: 2026-04-10T22:44:36.786Z
Learning: In OSHI's `AuxvFFM.queryAuxv()` (oshi-core-java25/src/main/java/oshi/driver/linux/proc/AuxvFFM.java), the do-while loop is safe even when `/proc/self/auxv` cannot be read: `FileUtil.readAllBytesAsBuffer` returns an empty ByteBuffer on failure, and `FileUtil.readLongFromBuffer`/`readIntFromBuffer` return 0L when reading past the buffer limit. This 0L equals AT_NULL, causing the loop to exit immediately with an empty map, which triggers the `getconf`/hardcoded-default fallback in callers like `LinuxOperatingSystemFFM`. Do not flag this do-while loop or the static initializer that calls `AuxvFFM.queryAuxv()` as unsafe.
Applied to files:
oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java
📚 Learning: 2026-04-05T05:39:21.126Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3117
File: oshi-core-java25/src/main/java/oshi/hardware/platform/linux/LinuxPowerSourceFFM.java:62-65
Timestamp: 2026-04-05T05:39:21.126Z
Learning: In OSHI's Linux FFM/JNA udev code, a null guard on `udev_enumerate_new()` is unnecessary if `udev_new()` has already been guarded: per libudev semantics, `udev_enumerate_new()` only returns NULL when udev itself is broken (e.g. OOM), so a successful `udev_new()` implies `udev_enumerate_new()` will succeed as well. Do not flag missing null checks on `udev_enumerate_new()` as an issue.
Applied to files:
oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java
🪛 zizmor (1.25.2)
.github/workflows/unix.yaml
[warning] 18-45: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
.github/workflows/pr.yaml
[warning] 110-110: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🔇 Additional comments (8)
oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java (2)
97-97: Inverted iostat token-length guard still present.The condition
split.length < 7allows undersized arrays (causing potentialArrayIndexOutOfBoundsExceptionatsplit[5]) while rejecting valid longer rows. This should besplit.length >= 6.
75-75: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java (1)
84-84: LGTM!oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java (1)
59-59: LGTM!Also applies to: 830-833, 836-844
oshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.java (1)
27-27: LGTM!oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java (1)
31-31: LGTM!oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java (1)
29-29: LGTM!oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java (1)
54-54: LGTM!
There was a problem hiding this comment.
🧹 Nitpick comments (1)
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java (1)
106-106: ⚡ Quick winConsider reordering the condition for defensive array access.
The current condition accesses
split[0]before checkingsplit.length. WhilePattern.split()typically returns at least one element even for empty input, defensive practice suggests checking the length first:- if (split[0].equals(getName()) && split.length >= 6) { + if (split.length >= 6 && split[0].equals(getName())) {This prevents any potential
ArrayIndexOutOfBoundsExceptionifsplitwere ever empty, and follows the general principle of validating array bounds before accessing elements.🤖 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-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java` at line 106, Reorder the boolean check to validate the array length before indexing to avoid potential ArrayIndexOutOfBounds; in the condition inside OpenBsdHWDiskStore (the block using the local variable split and comparing split[0] to getName()), check split.length >= 6 first and only then compare split[0].equals(getName()) so the code verifies bounds before accessing split[0].
🤖 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-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java`:
- Line 106: Reorder the boolean check to validate the array length before
indexing to avoid potential ArrayIndexOutOfBounds; in the condition inside
OpenBsdHWDiskStore (the block using the local variable split and comparing
split[0] to getName()), check split.length >= 6 first and only then compare
split[0].equals(getName()) so the code verifies bounds before accessing
split[0].
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6481a676-b43d-45a3-991b-18c435a48106
📒 Files selected for processing (15)
.github/workflows/openbsd-ffm.yaml.github/workflows/pr.yaml.github/workflows/unix.yamlCHANGELOG.mdoshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.javaoshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.javaoshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.javaoshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.javaoshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.javaoshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaoshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java
💤 Files with no reviewable changes (1)
- .github/workflows/openbsd-ffm.yaml
✅ Files skipped from review due to trivial changes (5)
- oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java
- CHANGELOG.md
- oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
- oshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.java
🚧 Files skipped from review as they are similar to previous changes (5)
- oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java
- oshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.java
- oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java
- oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java
- oshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.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, windows-latest
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: JMH Benchmarks, ubuntu-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
📚 Learning: 2026-04-03T02:07:49.467Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3110
File: oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java:119-121
Timestamp: 2026-04-03T02:07:49.467Z
Learning: In `oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java` (and similar FFM/API implementations in OSHI), the `updateAttributes()` method intentionally uses `catch (Throwable e) { return false; }` without logging. This is by design: `updateAttributes()` is a public API method whose contract is to return `false` on failure; callers consume the boolean and would never see log output, so adding a log statement is not desired.
Applied to files:
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java
📚 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/openbsd/OpenBsdHWDiskStore.java
📚 Learning: 2026-04-03T18:43:51.290Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:99-100
Timestamp: 2026-04-03T18:43:51.290Z
Learning: In oshi/oshi PlatformEnum.java, the DragonFly BSD detection uses `osName.equalsIgnoreCase("dragonflybsd")` intentionally, mirroring the exact same check in JNA's `Platform.java` source. Java's `os.name` property on DragonFly BSD is "dragonflybsd" (no space), so `startsWith("DragonFly")` is NOT the correct pattern here. Do not suggest changing it to `startsWith`.
Applied to files:
oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-04-19T01:28:47.155Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3174
File: oshi-benchmark/src/test/java/oshi/comparison/WmiComparisonTest.java:237-257
Timestamp: 2026-04-19T01:28:47.155Z
Learning: In `oshi-benchmark/src/test/java/oshi/comparison/WmiComparisonTest.java`, the WMI comparison tests (e.g., `testProcessor`) intentionally validate only index 0 and a few representative fields per WMI data type (String, uint16, uint32, uint64). Exhaustive row-by-row comparison is deliberately avoided for numerically heavy multi-row tables. The design rationale is: matching row counts + a few selected fields covering each data type is sufficient to verify JNA vs FFM driver parity. Do not suggest looping over all rows for these tests.
Applied to files:
oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-04-18T03:18:06.205Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3170
File: oshi-benchmark/src/test/java/oshi/comparison/PerfmonComparisonTest.java:177-183
Timestamp: 2026-04-18T03:18:06.205Z
Learning: In `oshi-benchmark/src/test/java/oshi/comparison/PerfmonComparisonTest.java`, GPU engine PDH instance counts (from `GpuInformationJNA.queryGpuEngineCounters()` / `GpuInformationFFM.queryGpuEngineCounters()`) are highly volatile — counts can differ dramatically (e.g., 53 vs 40) even between queries taken milliseconds apart. Do not assert instance count equality or exact instance list matching between JNA and FFM results. The only reliable assertion is that both are empty or both are non-empty (`assertThat(ffm.getA().isEmpty()).isEqualTo(jna.getA().isEmpty())`).
Applied to files:
oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-04-03T18:44:48.200Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:63-66
Timestamp: 2026-04-03T18:44:48.200Z
Learning: In oshi/oshi PlatformEnum.java, the DRAGONFLYBSD enum constant is intentionally added for platform detection only (no implementation classes exist yet). It allows UnsupportedOperationException messages to say "DragonFly BSD" rather than "Unknown". Full DragonFly BSD support is tracked in issue `#2583`. Do not flag the missing switch-case implementations as a bug.
Applied to files:
oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-05-31T04:49:16.646Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3310
File: oshi-core/src/main/java/oshi/software/os/unix/netbsd/NetBsdOperatingSystem.java:164-166
Timestamp: 2026-05-31T04:49:16.646Z
Learning: In the oshi/oshi project, the NetBSD platform intentionally removes all JNA/native library dependencies (PR `#3310`). `NetBsdOperatingSystem.getThreadId()` uses `(int) Thread.currentThread().getId()` rather than `NetBsdLibc._lwp_self()` because the JNA native library is not bundled with the Maven dependency for the NetBSD platform. The mismatch between Java thread ids and kernel LWP ids is an accepted trade-off. Do not suggest reintroducing JNA-based calls (such as `NetBsdLibc._lwp_self()`) in NetBSD platform code.
Applied to files:
oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
Applied to files:
oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-04-15T04:56:18.352Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3163
File: oshi-core-java25/src/test/java/oshi/ffm/mac/CoreFoundationTest.java:97-103
Timestamp: 2026-04-15T04:56:18.352Z
Learning: In CoreFoundationTest.java (oshi-core-java25/src/test/java/oshi/ffm/mac/CoreFoundationTest.java), asserting exact CFGetRetainCount deltas (+1 after retain, -1 after release) is intentional and considered reliable for freshly created CF objects (e.g., CFStringRef via CFStringRef.createCFString) where the test holds sole ownership. Do not flag these assertions as flaky — the Apple "avoid CFGetRetainCount" advisory applies to shared/framework-managed objects, not exclusively owned objects in unit tests.
Applied to files:
oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
📚 Learning: 2026-05-30T02:27:59.447Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3307
File: .github/workflows/netbsd.yaml:4-8
Timestamp: 2026-05-30T02:27:59.447Z
Learning: In the oshi/oshi repository, the `.github/workflows/netbsd.yaml` CI workflow intentionally triggers only on `push` to the `netbsd-port` branch during development. Before the final merge to master, NetBSD CI will be integrated into the main Unix CI workflow (e.g., `.github/workflows/pr.yaml` or equivalent). Do not flag the limited trigger scope as an issue on this PR.
Applied to files:
.github/workflows/pr.yaml.github/workflows/unix.yaml
📚 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/unix.yaml
🪛 zizmor (1.25.2)
.github/workflows/pr.yaml
[warning] 110-110: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
.github/workflows/unix.yaml
[warning] 18-45: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🔇 Additional comments (8)
.github/workflows/pr.yaml (1)
105-131: OpenBSD job follows FreeBSD pattern correctly.The new
testopenbsdjob mirrors the existingtestfreebsdjob structure appropriately, using JDK 25, aggregate coverage, and Codecov upload with theopenbsdflag..github/workflows/unix.yaml (1)
44-71: LGTM!oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java (5)
59-59: LGTM!
390-393: LGTM!
516-521: LGTM!
834-837: LGTM!
840-851: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java (1)
84-84: LGTM!
9e32a90 to
993bc58
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.java (1)
163-179:⚠️ Potential issue | 🟠 Major | ⚡ Quick winFix OpenBSD dmesg cache parsing: use regex group (2) instead of group (1)
In
OpenBsdCentralProcessor.java,q’sgroup(1)is only the CPU/core id (cpu(\\d+)), but the code feedsn.group(1)intoparseCacheStr().parseCacheStr()returns aProcessorCacheonly when the input splits into > 3 whitespace tokens; a core-id string producessplit.length == 1, so caches are never populated in the JNA implementation. The FFM implementation usesn.group(2)(the cache description), which matchesparseCacheStr()’s expectations.🔧 Proposed fix
} else { Matcher n = q.matcher(s); if (n.matches()) { - for (String cacheStr : n.group(1).split(",")) { + for (String cacheStr : n.group(2).split(",")) { ProcessorCache cache = parseCacheStr(cacheStr); if (cache != null) { caches.add(cache);🤖 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-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.java` around lines 163 - 179, The dmesg cache parsing uses the wrong regex group: when matching with Pattern q in OpenBsdCentralProcessor (variable q and Matcher n) you must pass the cache description (group 2) to parseCacheStr(), not the core id (group 1); update the loop that currently uses n.group(1) so it calls n.group(2).trim() (then split on commas and feed each part to parseCacheStr()), so ProcessorCache entries are correctly created and added to caches.
♻️ Duplicate comments (2)
.github/workflows/pr.yaml (1)
110-110:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDisable persisted checkout credentials for VM copyback jobs.
Line 118 enables VM workspace copyback, while Line 110 keeps default checkout credential persistence. That combination can expose repository credentials via copied workspace metadata. Set
persist-credentials: falseon this checkout step.🔒 Suggested fix
- - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # 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/pr.yaml at line 110, The checkout step using "uses: actions/checkout" currently leaves credential persistence enabled; update that checkout step to explicitly set persist-credentials: false so repository credentials are not saved into the workspace metadata (this affects the actions/checkout step referenced as uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10)..github/workflows/unix.yaml (1)
50-50:⚠️ Potential issue | 🟠 Major | ⚡ Quick winHarden OpenBSD VM job by disabling persisted checkout credentials.
Line 58 now copies workspace data back from the VM. If checkout credentials are persisted,
.gitauth data can be carried along that path. Update the OpenBSD job's checkout step topersist-credentials: false.🔒 Suggested fix
- - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # 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 50, The OpenBSD job's checkout step currently uses "uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10" and may persist Git credentials into the workspace; update that checkout step to include "persist-credentials: false" so .git auth data is not saved and cannot be copied back by the later workspace-copy step — locate the OpenBSD job's actions/checkout step in the workflow and add the persist-credentials: false key under that step.
🤖 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.
Outside diff comments:
In
`@oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.java`:
- Around line 163-179: The dmesg cache parsing uses the wrong regex group: when
matching with Pattern q in OpenBsdCentralProcessor (variable q and Matcher n)
you must pass the cache description (group 2) to parseCacheStr(), not the core
id (group 1); update the loop that currently uses n.group(1) so it calls
n.group(2).trim() (then split on commas and feed each part to parseCacheStr()),
so ProcessorCache entries are correctly created and added to caches.
---
Duplicate comments:
In @.github/workflows/pr.yaml:
- Line 110: The checkout step using "uses: actions/checkout" currently leaves
credential persistence enabled; update that checkout step to explicitly set
persist-credentials: false so repository credentials are not saved into the
workspace metadata (this affects the actions/checkout step referenced as uses:
actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10).
In @.github/workflows/unix.yaml:
- Line 50: The OpenBSD job's checkout step currently uses "uses:
actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10" and may persist Git
credentials into the workspace; update that checkout step to include
"persist-credentials: false" so .git auth data is not saved and cannot be copied
back by the later workspace-copy step — locate the OpenBSD job's
actions/checkout step in the workflow and add the persist-credentials: false key
under that step.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 57da9be0-89c0-48e6-a8a4-9487ab52b5b3
📒 Files selected for processing (17)
.github/workflows/openbsd-ffm.yaml.github/workflows/pr.yaml.github/workflows/unix.yamlCHANGELOG.mdoshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.javaoshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.javaoshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.javaoshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.javaoshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.javaoshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.javaoshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.javaoshi-core/src/main/java/oshi/jna/platform/unix/OpenBsdLibc.javaoshi-core/src/main/java/oshi/util/platform/unix/openbsd/OpenBsdSysctlUtil.java
💤 Files with no reviewable changes (1)
- .github/workflows/openbsd-ffm.yaml
✅ Files skipped from review due to trivial changes (3)
- oshi-core/src/main/java/oshi/jna/platform/unix/OpenBsdLibc.java
- oshi-core/src/main/java/oshi/util/platform/unix/openbsd/OpenBsdSysctlUtil.java
- CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (9)
- oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java
- oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
- oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java
- oshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.java
- oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java
- oshi-core-ffm/src/main/java/oshi/ffm/unix/openbsd/OpenBsdLibcFunctions.java
- oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
- oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStoreFFM.java
- oshi-core-ffm/src/main/java/oshi/software/os/unix/openbsd/OpenBsdOperatingSystemFFM.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). (1)
- GitHub Check: Codacy Static Code Analysis
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3307
File: .github/workflows/netbsd.yaml:4-8
Timestamp: 2026-05-30T02:27:59.447Z
Learning: In the oshi/oshi repository, the `.github/workflows/netbsd.yaml` CI workflow intentionally triggers only on `push` to the `netbsd-port` branch during development. Before the final merge to master, NetBSD CI will be integrated into the main Unix CI workflow (e.g., `.github/workflows/pr.yaml` or equivalent). Do not flag the limited trigger scope as an issue on this PR.
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
📚 Learning: 2026-04-03T02:07:49.467Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3110
File: oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java:119-121
Timestamp: 2026-04-03T02:07:49.467Z
Learning: In `oshi-core-java25/src/main/java/oshi/hardware/platform/mac/MacHWDiskStoreFFM.java` (and similar FFM/API implementations in OSHI), the `updateAttributes()` method intentionally uses `catch (Throwable e) { return false; }` without logging. This is by design: `updateAttributes()` is a public API method whose contract is to return `false` on failure; callers consume the boolean and would never see log output, so adding a log statement is not desired.
Applied to files:
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java
📚 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/openbsd/OpenBsdHWDiskStore.javaoshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.java
📚 Learning: 2026-05-31T04:49:16.646Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3310
File: oshi-core/src/main/java/oshi/software/os/unix/netbsd/NetBsdOperatingSystem.java:164-166
Timestamp: 2026-05-31T04:49:16.646Z
Learning: In the oshi/oshi project, the NetBSD platform intentionally removes all JNA/native library dependencies (PR `#3310`). `NetBsdOperatingSystem.getThreadId()` uses `(int) Thread.currentThread().getId()` rather than `NetBsdLibc._lwp_self()` because the JNA native library is not bundled with the Maven dependency for the NetBSD platform. The mismatch between Java thread ids and kernel LWP ids is an accepted trade-off. Do not suggest reintroducing JNA-based calls (such as `NetBsdLibc._lwp_self()`) in NetBSD platform code.
Applied to files:
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.java
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
Applied to files:
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.java
📚 Learning: 2026-04-03T18:44:48.200Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:63-66
Timestamp: 2026-04-03T18:44:48.200Z
Learning: In oshi/oshi PlatformEnum.java, the DRAGONFLYBSD enum constant is intentionally added for platform detection only (no implementation classes exist yet). It allows UnsupportedOperationException messages to say "DragonFly BSD" rather than "Unknown". Full DragonFly BSD support is tracked in issue `#2583`. Do not flag the missing switch-case implementations as a bug.
Applied to files:
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.java
📚 Learning: 2026-04-12T19:22:14.417Z
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:14.417Z
Learning: In OSHI's `PhysicalProcessor.getEfficiency()` API (CentralProcessor interface), a higher efficiency class value means GREATER performance and LESS efficiency (counterintuitive naming). P-cores (performance cores) get a higher value (e.g., 1), and E-cores (efficiency cores) get a lower value (e.g., 0). This is documented in the CentralProcessor javadoc. Do not flag code that assigns higher efficiency values to ARM_P_CORES or Intel P-cores as a bug.
Applied to files:
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.java
📚 Learning: 2026-05-30T02:27:59.447Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3307
File: .github/workflows/netbsd.yaml:4-8
Timestamp: 2026-05-30T02:27:59.447Z
Learning: In the oshi/oshi repository, the `.github/workflows/netbsd.yaml` CI workflow intentionally triggers only on `push` to the `netbsd-port` branch during development. Before the final merge to master, NetBSD CI will be integrated into the main Unix CI workflow (e.g., `.github/workflows/pr.yaml` or equivalent). Do not flag the limited trigger scope as an issue on this PR.
Applied to files:
.github/workflows/pr.yaml.github/workflows/unix.yaml
📚 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/unix.yaml
🪛 zizmor (1.25.2)
.github/workflows/pr.yaml
[warning] 110-110: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
.github/workflows/unix.yaml
[warning] 18-45: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🔇 Additional comments (6)
oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdHWDiskStore.java (2)
84-84: LGTM!
106-106: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/openbsd/OpenBsdCentralProcessor.java (2)
61-61: LGTM!Also applies to: 73-73
134-134: LGTM!Also applies to: 163-163
.github/workflows/pr.yaml (1)
105-132: LGTM!.github/workflows/unix.yaml (1)
44-71: LGTM!
Code fixes from review: - Add getpid() binding; use it in getProcessId() (was getthrid) - Fix getThreadCount() to count lines, not sum TID values - Skip header row in getProcessListFromPS() - Fix bytesPerSector operator precedence: add parens around >> 1 (latent bug also fixed in JNA version) Coverage & test enablement: - Enable aggregate-coverage in unix.yaml OpenBSD job + Codecov upload - Add OpenBSD job to pr.yaml (mirrors FreeBSD pattern) - Remove temporary openbsd-ffm.yaml workflow - Add OS.OPENBSD to @EnabledOnOs in SystemInfoTest, GlobalMemoryFFMTest, VirtualMemoryFFMTest, OperatingSystemFFMTest, ForeignFunctionsTest, NativeComparisonTest - Rename isFreeBsd() to isBsd() for shared start-time tolerance Cleanup: - Remove stale --add-opens for nonexistent 'oshi' package (pre-existing)
* Probe: verify JDK 25 available on OpenIndiana Standalone temporary workflow that runs `pkg install openjdk25` and a minimal oshi-core-ffm compile on the OpenIndiana VM, to confirm JDK 25 (and therefore FFM) is reachable before committing to a Solaris FFM port. To be deleted once we have an answer. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Solaris FFM port: move native-free code to oshi-common (#3338) Move pure-Java Solaris 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 OpenBSD port structure from #3333. Moved to oshi-common as-is: - Drivers: Iostat, Lshal, Prtvtoc (oshi.driver.unix.solaris.disk) - Hardware: SolarisFirmware, SolarisGraphicsCard, SolarisSoundCard, SolarisUsbDevice, SolarisSensors, SolarisComputerSystem - Software: SolarisInternetProtocolStats Moved to oshi-common with refactor: - SolarisVirtualMemory: drop direct SystemPages dependency; derive virtualMax/virtualInUse from the SolarisGlobalMemory public API (getTotal/getAvailable) instead. The kstat -p cpu_stat:::pgswapin/out paths were already shell-based, so the class is now native-free. - SolarisGlobalMemory (abstract base): expose queryAvailable(), queryTotal(), queryPageSize() and createVirtualMemory() hooks. The oshi-core concrete (extending the abstract from oshi-common) keeps the SystemPages call site; the eventual oshi-core-ffm concrete will plug into the same hooks. Remaining in oshi-core (native dependencies, port in later PRs): - SolarisLibc, KstatUtil - Drivers: PsInfo, Who, kstat/SystemPages - Hardware: SolarisCentralProcessor, SolarisHWDiskStore, SolarisNetworkIF, SolarisPowerSource, SolarisHardwareAbstractionLayer - Software: SolarisFileSystem, SolarisOSFileStore, SolarisOSProcess, SolarisOSThread, SolarisOperatingSystem, SolarisNetworkParams Build plumbing: - oshi-common module-info: export new oshi.driver.unix.solaris.disk, oshi.hardware.common.platform.unix.solaris, and oshi.software.common.os.unix.solaris packages. - oshi-core and oshi-core-ffm bnd Export-Package: add !oshi.driver.unix.solaris.disk.* exclusion so bnd doesn't pull the moved classes from oshi-common back into either OSGi bundle (same pattern as the existing !oshi.driver.unix.freebsd.disk.* exclusion). - Test module-info moves DiskDriversTest's package opening from oshi-core to oshi-common. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Solaris FFM port: FFM bindings for libc + libkstat (#3338) Add the foundation for the FFM Solaris/illumos port: bindings for libc and libkstat, a thread-safe wrapper that mirrors oshi.util.platform. unix.solaris.KstatUtil, a probe for libkstat2 (Solaris 11.4+ only), and smoke tests gated on OS.SOLARIS. New files in oshi-core-ffm: - oshi.ffm.unix.solaris.SolarisLibcFunctions — minimal libc surface: getpid, thr_self, getrlimit. RLIMIT_NOFILE = 5 (the correct illumos value; JNA's Resource.RLIMIT_NOFILE = 7 is wrong for Solaris — see the Surprises §D in issue #3338). - oshi.ffm.util.platform.unix.solaris.LibKstatFunctions — bindings for kstat_open / close / chain_update / lookup / read / data_lookup, plus kstat_t and kstat_named_t MemoryLayouts and accessors. Loaded via SymbolLookup.libraryLookup("libkstat.so.1", Arena.global()). - oshi.ffm.util.platform.unix.solaris.Kstat2Functions — probe-only stub. HAS_KSTAT2 reflects whether libkstat2.so.1 was loadable at class-init time. On illumos (OpenIndiana CI) the lookup fails and HAS_KSTAT2 = false, so FFM consumers route through LibKstat just like the JNA HAS_KSTAT2 fallback path. Bindings for the kstat2_* API will land when a downstream consumer requires them. - oshi.ffm.util.platform.unix.solaris.KstatUtilFFM — thread-safe wrapper mirroring the public API of the JNA KstatUtil: openChain with a ReentrantLock, KstatChain.{read,lookup,lookupAll,update}, and dataLookupString / dataLookupLong over the named-data union. Smoke tests (gated @EnabledOnOs(OS.SOLARIS)): - SolarisLibcFunctionsTest — getpid > 0, thr_self > 0, getrlimit round-trip on RLIMIT_NOFILE. - KstatUtilFFMTest — openChain, lookup("unix", 0, "system_misc"), dataLookupLong("boot_time") > 0. Probe workflow upgraded from `mvn compile` to `mvn test`, so the smoke tests run on every push to solaris-ffm. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Solaris FFM port: FFM consumers + SystemInfo wiring (#3338) Add Solaris/illumos FFM concretes for all native-touching hardware and software classes, wire them into oshi.ffm.SystemInfo, enable the NativeComparisonTest parity gate for OS.SOLARIS, and bump testopenindiana CI to JDK 25 with aggregate-coverage upload under the `solaris` codecov flag (mirroring the OpenBSD job). New FFM drivers in oshi-core-ffm: - oshi.ffm.driver.unix.solaris.kstat.SystemPagesFFM — kstat unix/0/system_pages wrapper. - oshi.ffm.driver.unix.solaris.PsInfoFFM — /proc/<pid>/psinfo, lwp/<tid>/lwpsinfo, usage parsers (ByteBuffer-based, pure-Java POJOs). Process arg/env via `pargs -e` instead of the JNA driver's pread on /proc/<pid>/as, trading a child-process fork for not needing open/close/pread libc bindings. New FFM hardware concretes (extend AbstractCentralProcessor / HWDiskStore / NetworkIF / PowerSource, or the oshi-common Solaris GlobalMemory abstract): - SolarisCentralProcessorFFM, SolarisGlobalMemoryFFM, SolarisHWDiskStoreFFM, SolarisNetworkIFFFM, SolarisPowerSourceFFM, SolarisHardwareAbstractionLayerFFM. New FFM software concretes: - SolarisOSProcessFFM, SolarisOSThreadFFM, SolarisOperatingSystemFFM, SolarisFileSystemFFM, SolarisOSFileStoreFFM, SolarisNetworkParamsFFM. - getSessions inherits the AbstractOperatingSystem default (Who.queryWho shell parser), matching the OpenBSD FFM pattern. SolarisLibcFunctions gained gethostname and getloadavg bindings. LibKstatFunctions gained the kstat_io_t MemoryLayout + accessors (kstatIoReads/Writes/Nread/Nwritten/Rtime/Wcnt/Rcnt) and a kstatSnaptime helper for the kstat header. Kstat2Functions remains a probe-only stub — illumos (the FFM CI target) has no libkstat2, so consumers fall back to LibKstat throughout. The JNA-side HAS_KSTAT2 branches in the JNA concretes still work on Solaris 11.4+; the FFM concretes here use the libkstat path exclusively. CI: testopenindiana bumped from JDK 21 → JDK 25 with -Paggregate-coverage and a Codecov upload under flag `solaris`. The temporary openindiana-jdk25-probe.yaml workflow is removed (its smoke tests now run as part of testopenindiana via the FFM smoke tests added in the previous commit). NativeComparisonTest @EnabledOnOs gains OS.SOLARIS. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Solaris FFM port: docs + JaCoCo cleanup, bump CHANGELOG to 7.3.0 (#3338) Wraps up the Solaris/illumos FFM port (#3338) with the same docs and coverage cleanup that landed for the FreeBSD port in #3331. Also picks up the equivalent OpenBSD cleanup that slipped out of #3335. - oshi.ffm.SystemInfo Javadoc + oshi-core-ffm module-info: list OpenBSD and Solaris in the FFM-supported platforms. - FAQ.md, PERFORMANCE.md: same. - pom.xml JaCoCo: drop the **/unix/openbsd/**, **/unix/*OpenBsd*, **/unix/solaris/**, and **/unix/*Solaris* excludes. Both platforms now have permanent CI jobs with aggregate coverage uploaded to Codecov (testopenbsd → flag `openbsd`, testopenindiana → flag `solaris`), so the excludes are now hiding real coverage. - CHANGELOG.md: rename `7.2.2 (in progress)` → `7.3.0 (in progress)` and add the Solaris FFM port entry. The version bump reflects the new platform support landing in this release per the FreeBSD port playbook. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Solaris FFM: diagnostic logging + context-switch kstat regex fix OpenIndiana JDK 25 CI exposed two regressions in #b2b8d389c8: 1. SolarisOSProcessFFM was returning a process whose state stays INVALID — i.e., PsInfoFFM.queryPsInfo silently returned null. Promote the catch-block log to WARN and include the actual file size, so the next CI run shows whether the file is unreadable, too short, or a struct-layout mismatch. 2. SolarisCentralProcessorFFM.queryContextSwitches used a single- backslash regex pipe (`pswitch\|inv_swtch`), which the shell strips to `pswitch|inv_swtch` — kstat -p reads that as two separate patterns. The JNA original double-escapes (`\\\\|` in Java → `\\|` in shell → `\|` in regex). Match the JNA escaping so the FFM path returns the same context-switch total (the NativeComparisonTest saw 0 vs 69757). The fileSystem() free-space mismatch and the FreeBSD testThreads() user-time-nondecreasing flake are not addressed here — those look like timing artifacts that need a separate look. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Solaris FFM: tolerate short psinfo/lwpsinfo/usage reads Root cause of the OpenIndiana JDK 25 CI failures (#3338): | LwpsInfo.readFrom(PsInfoFFM.java:180) | java.nio.BufferUnderflowException PsInfoFFM was reading /proc/<pid>/psinfo via ByteBuffer.getInt / getLong / get(byte[]) directly, all of which throw BufferUnderflowException on short buffers. The illumos kernel writes 416 bytes of psinfo where my parser was expecting 440 (24 bytes shorter — the embedded lwpsinfo_t at the tail of psinfo_t has a narrower pr_name on illumos than the JNA SolarisLwpsInfo struct documents, plus an extra pr_oldname field that illumos doesn't carry). JNA's SolarisPsInfo silently tolerates this via FileUtil's short-buffer-safe readers: public static int readIntFromBuffer(ByteBuffer buff) { if (buff.position() <= buff.limit() - 4) { return buff.getInt(); } return 0; } (same pattern for the long / short / byte / byte[] reads). The post-EOF fields end up zero but no exception is thrown, so the process state, name, args, etc. — all of which live in the first ~408 bytes — read cleanly. PsInfoFFM now uses these same FileUtil.read* helpers, matching JNA's behavior exactly. After this: - queryPsInfo returns a populated PsInfo (state byte at offset 314 is well within 416 bytes). - SolarisOSProcessFFM stops returning INVALID state. - The currentProcess, processListStructure, currentThreadUpdateAttributes, and currentProcessUpdateAttributes parity tests in NativeComparisonTest should now pass. The fileSystem() free-space mismatch (5000626176 vs 5013135360) and the FreeBSD testThreads timing flake are still open; both look like race conditions rather than struct-layout bugs. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Solaris: fix two pre-existing JNA bugs surfaced by FFM parity (#3338) NativeComparisonTest on OpenIndiana JDK 25 exposed two JNA bugs the FFM concretes are now reporting as parity mismatches: 1. oshi.jna.platform.unix.SolarisLibc inherited RLIMIT_NOFILE = 7 from JNA's Resource interface (the Linux value). On Solaris and illumos RLIMIT_NOFILE is 5 — value 7 is RLIM_NLIMITS, an invalid resource selector. So SolarisOSProcess.getSoftOpenFileLimit / getHardOpenFileLimit silently asked for an undefined resource and getrlimit returned -1/EINVAL, leaving rlim_cur/rlim_max at zero. Shadow with `int RLIMIT_NOFILE = 5;` — same pattern as FreeBSD #3330 and OpenBSD #3335. 2. SolarisCentralProcessor's createProcListFromDmesg regex used four backslashes — `Pattern.compile(".* cpu(\\\\d+): ((ARM|AMD|Intel).+)")`. That compiles to the regex `.* cpu(\\d+): …`, i.e. literal backslash followed by `d+`, which never matches dmesg lines like "cpu0: AMD EPYC ...". Result: PhysicalProcessor.idString stayed empty on every JNA call. Two backslashes — `\\d+` — is the regex `\d+` (one or more digits) the test was already exercising via the FFM concrete. Both bugs are inherited from the JNA implementation that pre-dates this port. Per the FFM playbook's pre-existing-bug policy, fixing them here keeps JNA and FFM in lockstep so NativeComparisonTest parity checks remain meaningful instead of silently masking the JNA side. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * NativeComparisonTest: bump totalSpace tolerance for tmpfs drift OpenIndiana JDK 25 CI showed two filesystem-comparison tests failing on Solaris tmpfs: - fileSystem() compared totalSpace with strict equality. tmpfs total on Solaris (/var/run, /tmp, etc.) tracks memory pressure and drifts by megabytes between the JNA and FFM calls — the test was reading 5058297856 from one path and 5063569408 from the other, a ~5 MB difference (~0.1%). - fileStoreUpdateAttributes() already used assertWithinRatio, but the 0.1% tolerance was just below the observed drift. Switch both to 1% via assertWithinRatio. Strict equality on a value that the kernel itself reports differently across two back-to-back calls is not a parity bug worth flagging. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * testopenindiana: bump VM RAM to 8 GB, cap JVM heap to 1 GB CI has been hitting native-malloc OOMs partway through the test suite on the OpenIndiana VM (sometimes during oshi-core SystemInfoTest, sometimes during oshi-metrics OshiMetricsTest). Symptoms are: # There is insufficient memory for the Java Runtime Environment to # continue. Native memory allocation (malloc) failed to allocate # 33792 bytes. Error detail: Chunk::new …which is illumos's malloc giving up because the JVM's metaspace + G1 heap + JNA-loaded libc + FFM linker state all want C-heap together. Two changes: - vmactions/openindiana-vm: bump `mem` from the default 6144 MB → 8192 MB. testopenbsd / testfreebsd only need 2 GB because their suites don't exercise both JNA and FFM; we do. - MAVEN_OPTS / _JAVA_OPTIONS: cap Maven and child-JVM max heap to 1 GB. The default 25%-of-system-RAM heuristic on JDK 25 was sizing to ~2 GB per JVM, leaving little C-heap for the modules that load the most native code. This should let the full Solaris/illumos CI matrix complete without hitting the OOM ceiling, so the actual NativeComparisonTest parity results show up. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * NativeComparisonTest: tolerate intermittent updateAttributes false on disks OpenIndiana CI has been failing diskStoreUpdateAttributes intermittently on Solaris disk sd2: +-- diskStoreUpdateAttributes() [X] [JNA disk sd2 updateAttributes] This is JNA's SolarisHWDiskStore.updateAttributes returning false from a kstat_lookup miss — kstat_chain_update can transiently drop entries for removable / installer / iSCSI-backed volumes whose underlying modules don't report stable IO statistics. The OpenIndiana CI VM in particular has an sd2 that comes and goes in the kstat chain. A `false` from JNA's updateAttributes isn't a JNA-vs-FFM parity bug; it just means we can't validate monotonicity for that disk on this pass. Skip the disk rather than fail the test, the same way the test already skips disks that don't have a matching FFM entry. The `matched > 0` assertion at the end still guarantees we exercised the parity check on at least one disk. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Solaris FFM: checkstyle, codecov reach, PR-review nits Three logical pieces, kept together because they all came out of the same CodeRabbit/code-review pass: Checkstyle - LibKstatFunctions accessor methods now have proper @param/@return Javadoc tags, matching the OpenBsdLibcFunctions/FreeBsdLibcFunctions pattern. - PsInfoFFM Timestruc.toMillis gets a @return tag. - SystemPagesFFM: drop the empty `if (HAS_KSTAT2) {}` block (no-op today; documented in the surrounding comment that the FFM Kstat2 binding is stubbed) and the now-unused import. - checkstyle-suppressions.xml: PsInfoFFM (and its inner LwpsInfo / PrUsage / Timestruc data classes) mirror the kernel psinfo_t / lwpsinfo_t / prusage_t fields, so suppress MemberName and VisibilityModifier on that file — same convention the JNA SolarisLibc.SolarisPsInfo inner classes get via the [\\/]jna[\\/] suppression. Codecov reach - pom.xml: drop the broad **/ffm/** JaCoCo exclude. It was hiding 731 lines of new Solaris FFM code (and would have hidden OpenBSD FFM too if anyone had been looking). Add narrower **/CupsPrinterFFM* and **/CupsFunctions* excludes to match the existing **/CupsPrinterJNA* — the rationale ("requires print service") is identical regardless of binding. - pr.yaml: add a testopenindiana job mirroring testfreebsd / testopenbsd (8 GB VM, 1 GB JVM heap caps, mvnw test -Paggregate- coverage, codecov flag `solaris`). Without this the only place testopenindiana ran was unix.yaml on master pushes, so PRs got no Solaris coverage signal until merge. PR-review nits - SolarisOSProcessFFM + SolarisOSProcess: getCurrentWorkingDirectory built `"/proc" + pid + "/cwd"` — missing the separator means the path is always `/proc1234/cwd` which never resolves, so the method always returned "". Fixed in both bindings. - Same two files: updateAttributes assigned `this.path = ParseUtil.whitespaces.split(commandLineBackup)[0]`, which throws ArrayIndexOutOfBounds when commandLineBackup is empty (kernel threads with no command line). Guard with parts.length > 0. - PsInfoFFM.queryPsInfo: downgrade the "psinfo file empty or unreadable" log from WARN to DEBUG. Short-lived processes routinely disappear from /proc between enumeration and read; the warning was diagnostic-era and now just noise. - KstatUtilFFM.read: add exponential backoff (16/32/64/128/256 ms) between kstat_read retries to match the JNA KstatUtil pattern, instead of busy-spinning. Interrupts restore the interrupt flag and bail. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> - KstatUtilFFM / PsInfoFFM / SystemPagesFFM / SolarisLibcFunctions class Javadoc: cross-module {@link oshi.util.platform.unix.solaris.KstatUtil} (and the four sibling references) were unresolvable because the FFM module doesn't depend on oshi-core, breaking javadoc:javadoc. Switched to {@code …}, the same pattern OpenBsdSysctlUtilFFM already uses. * SolarisOperatingSystem / Kstat2Functions: file-check before Native.load OpenIndiana JDK 25 CI has intermittently SIGSEGV'd in libc strlen+0x30 during oshi-core test launch: # SIGSEGV (0xb) at pc=0x00007fffaf3590d0, pid=..., tid=24 # JRE: OpenJDK 25 (build 25+-adhoc.oi.jdk25u-jdk-25-36) # Problematic frame: # C [libc.so.1+0x790d0] strlen+0x30 SolarisOperatingSystem's static initializer runs a HAS_KSTAT2 probe that calls Kstat2.INSTANCE, which on illumos is supposed to throw UnsatisfiedLinkError (libkstat2 only exists on Solaris 11.4+) and be caught. JNA 5.19 on JDK 25 has been seen to occasionally crash in Native.load's strlen path instead of throwing cleanly — and once that happens, the whole oshi-core test JVM is gone before any test runs. Fix at the source: check whether the library file exists on disk before letting JNA attempt the native load. On illumos and Solaris < 11.4 it simply doesn't, so we skip the JNA call entirely and HAS_KSTAT2 falls through to false (which is the right answer there anyway — the legacy LibKstat path handles everything). The existing try / catch around Native.load stays as a second line of defense for the "file is there but library is broken" case. Match on `libkstat2.so*` (any suffix) rather than the current `.1` SONAME so a future Solaris release that bumps to `.so.2` keeps working without code changes. The four standard library search paths (/lib/64, /usr/lib/64, /lib, /usr/lib) match Solaris's crle defaults. Same pattern applied to Kstat2Functions on the FFM side (SymbolLookup.libraryLookup uses dlopen internally and could plausibly hit the same illumos JNI bug). Replaces the testopenindiana workflow workaround from the previous attempt at this commit, which set -Doshi.os.solaris.allowkstat2=false to sidestep the probe entirely. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
SystemInfoSystatdriver,OpenBsdSensors,OpenBsdPowerSourcefrom oshi-core to oshi-common (pure Java, no native deps)Disklabeldriver from oshi-core to oshi-common (resolves split-package)--add-opensin oshi-core-ffm test module-infoNew FFM classes (oshi-core-ffm)
Layer 2 — simple sysctl consumers:
OpenBsdComputerSystemFFM— hw.vendor/version/serialno/uuidOpenBsdFileSystemFFM— kern.nfiles/maxfiles/maxfilesperprocOpenBsdHWDiskStoreFFM— hw.disknames + Disklabel + systatLayer 3 — complex consumers:
OpenBsdGlobalMemoryFFM— Bcachestats struct + vmstatOpenBsdCentralProcessorFFM— KERN_CPTIME/CPTIME2, dmesg topology, getloadavgOpenBsdOperatingSystemFFM— OS version, boot time, process listing, getthridOpenBsdOSProcessFFM— KERN_PROC_ARGS pointer-list, getrlimitLayer 4 — wiring:
OpenBsdHardwareAbstractionLayerFFMSystemInfo— addOPENBSDto platform switchesCode motion to oshi-common
Systat,OpenBsdSensors,OpenBsdPowerSource(depend on Systat)Disklabel+DisklabelTestTest plan
Refs #3332
Summary by CodeRabbit