Repository navigation
FreeBSD Port: wire FFM SystemInfo + enable parity tests (final) - #3330
Conversation
Adds PlatformEnum.FREEBSD to SUPPORTED_PLATFORMS, dispatches to FreeBsdOperatingSystemFFM / FreeBsdHardwareAbstractionLayerFFM (shipped in PRs #3322 and #3328), and updates the class-level Javadoc that previously listed only Windows/macOS/Linux. FreeBSD is dropped from the "use oshi.SystemInfo (JNA) instead" call-out since the FFM path now covers it; OpenBSD, Solaris, AIX still need the JNA entry point. This is the last load-bearing change of the FreeBSD FFM port — after this, oshi.ffm.SystemInfo.isAvailable() returns true on FreeBSD and the public API works end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Now that oshi.ffm.SystemInfo dispatches to FreeBSD (Phase 6 commit 1),
all six FFM tests previously gated to {LINUX, MAC, WINDOWS} need
FreeBSD added so they exercise the new wiring on the FreeBSD CI:
* oshi-core-ffm: SystemInfoTest, GlobalMemoryFFMTest, VirtualMemoryFFMTest,
OperatingSystemFFMTest, ForeignFunctionsTest
* oshi-benchmark: NativeComparisonTest (the big JNA-vs-FFM HAL/OS
parity test that retires the per-piece comparison tests we explicitly
skipped during Phases 3–5)
No assertion changes — the test bodies already cover the FreeBSD-relevant
surface generically through the public OSHI API. Mac CI continues to
see the same 39 successful / 53 skipped split.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
… gaps Three failures surfaced when Phase 6 commit 2 enabled NativeComparisonTest on FreeBSD. None are real parity bugs; all are structural differences between FreeBSD's process/sensor model and the other platforms. * ComparisonAssertions.assertWithinRatio now treats both-NaN as equal. CPU temperature comes back NaN on the FreeBSD CI VM (no coretemp kld module loaded) from both JNA and FFM, which is correct parity, but NaN/NaN arithmetic made the ratio check fail. * assertStartTimeMatches helper added to NativeComparisonTest. On Linux/Mac/Windows OSProcess#getStartTime() exposes the kernel's exact start time and strict equality holds. On FreeBSD startTime is derived as (now - elapsedTime) where elapsedTime is the seconds-resolution `ps -o etimes` value; JNA and FFM each capture `now` at slightly different timestamps so the derived values drift by tens of milliseconds. Switched the two startTime assertions (currentProcess() and processListStructure()) to a 2000ms tolerance on FreeBSD; other platforms keep strict equality. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…onTest Two more failures appeared once Phase 6 commit 3's startTime and NaN fixes cleared the way; both are real and fixed in this commit. 1. process.softOpenFileLimit — JNA returned 10328, FFM returned 175554 (real open-files limit). Pre-existing JNA-on-FreeBSD bug: Resource.RLIMIT_NOFILE in the JNA platform module is the Linux value 7, but on FreeBSD RLIMIT_NOFILE = 8 (7 is RLIMIT_NPROC). So FreeBsdOSProcessJNA was calling getrlimit on the wrong resource — returning the max-processes limit instead of open-files. Added an explicit `int RLIMIT_NOFILE = 8;` to FreeBsdLibc that shadows the inherited Linux constant so the existing call site picks up the correct value with no code change at the caller. FFM was already using 8 (added in Phase 5 commit 5). 2. fileStoreUpdateAttributes totalSpace — JNA and FFM call updateAttributes() back-to-back, but on a live filesystem total space can drift by a few blocks while the test is itself writing (the observed delta was exactly 3×4KB = 12 KB out of 208 GB). Relaxed the strict equality to assertWithinRatio with a 0.1% tolerance, the same pattern this file already uses for other drift-prone counters. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
freebsd-ffm.yaml was the push-triggered FreeBSD VM job introduced in Phase 1 (PR #3316) so in-progress FFM work got FreeBSD coverage between PR submissions. With the port complete and the permanent testfreebsd job in pr.yaml + unix.yaml exercising every change, the temp workflow is no longer needed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
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 (10)
💤 Files with no reviewable changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
🧰 Additional context used🧠 Learnings (12)📓 Common learnings📚 Learning: 2026-05-31T04:49:16.646ZApplied to files:
📚 Learning: 2026-03-29T20:01:06.452ZApplied to files:
📚 Learning: 2026-04-03T18:44:48.200ZApplied to files:
📚 Learning: 2026-04-18T03:18:06.205ZApplied to files:
📚 Learning: 2026-04-20T03:07:05.660ZApplied to files:
📚 Learning: 2026-04-17T23:43:35.860ZApplied to files:
📚 Learning: 2026-04-15T04:56:18.352ZApplied to files:
📚 Learning: 2026-04-03T18:43:51.290ZApplied to files:
📚 Learning: 2026-04-06T04:45:51.516ZApplied to files:
📚 Learning: 2026-05-04T04:58:36.843ZApplied to files:
📚 Learning: 2026-04-19T01:28:47.155ZApplied to files:
🔇 Additional comments (18)
📝 WalkthroughWalkthroughThis PR finalizes FreeBSD support for the FFM implementation by adding a libc constant override, wiring the FFM factory for FreeBSD, enabling platform tests, and adjusting benchmark comparison assertions to handle FreeBSD-specific behavior differences. ChangesFreeBSD FFM Support Completion
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3330 +/- ##
============================================
+ Coverage 73.08% 75.63% +2.55%
Complexity 76 76
============================================
Files 462 462
Lines 17925 17925
Branches 2928 2928
============================================
+ Hits 13100 13558 +458
+ Misses 3224 2708 -516
- Partials 1601 1659 +58
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:
|
Follow-up to the five FreeBSD FFM port PRs (#3316, #3319, #3322, #3328, #3330) covering loose ends that don't fit any individual port commit. JaCoCo agent excludes: * Remove `**/unix/BsdNetworkIF*` and `**/unix/UnixBaseboard*`. Both classes were hoisted to oshi-common during the port (#3316 and #3328 respectively) and are now exercised on the permanent FreeBSD CI job through `NativeComparisonTest.networkInterfaces()` and `ComputerSystem.getBaseboard()`; the excludes were silently dropping that coverage from the `freebsd` codecov flag. * Add `**/FreeBsdPowerSource*` alongside the existing `**/{Mac,Windows,Linux}PowerSource*` entries. No battery on the FreeBSD CI VM, same hardware-conditional pattern. Documentation: * Update the supported-platforms statement in README.md, FAQ.md, PERFORMANCE.md, src/site/markdown/index.md, oshi-core-ffm module-info Javadoc, oshi-core SystemInfo Javadoc, and oshi-core package-info Javadoc from "Windows, macOS, and Linux" to "Windows, macOS, Linux, and FreeBSD". CHANGELOG.md gains a New Features bullet linking all five FreeBSD FFM port PRs. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* 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
Phase 6 of the FreeBSD FFM port (tracking #3315). The wire-up commit:
adds FreeBSD to
oshi.ffm.SystemInfo's supported platforms,dispatches to the
FreeBsd*FFMconcretes shipped in PRs #3319,#3322, and #3328, opens
NativeComparisonTestand the other gatedFFM tests to FreeBSD, deletes the temporary CI workflow, and fixes
the residual JNA-vs-FFM parity gaps that the full
NativeComparisonTestsurfaced once it ran. With this, FreeBSD is afirst-class FFM platform alongside Windows, macOS, and Linux.
Closes #3315.
Per-commit walk
oshi.ffm.SystemInfoaddsPlatformEnum.FREEBSDtoSUPPORTED_PLATFORMSand dispatches thefactory methods to
FreeBsdOperatingSystemFFM/FreeBsdHardwareAbstractionLayerFFM. Class Javadoc updated tolist FreeBSD among supported platforms; the "use JNA instead"
call-out now only mentions OpenBSD/Solaris/AIX.
OS.FREEBSDto@EnabledOnOson thefive gated FFM tests in
oshi-core-ffm(SystemInfoTest,GlobalMemoryFFMTest, VirtualMemoryFFMTest, OperatingSystemFFMTest,
ForeignFunctionsTest) and on
NativeComparisonTestinoshi-benchmark. The per-piece comparison tests we explicitly
skipped during Phases 3–5 are now covered transitively through
the public API.
commit 2's first CI run surfaced:
ComparisonAssertions.assertWithinRationow treats both-NaN asequal so a missing-on-the-platform sensor (e.g., the FreeBSD CI
VM with no
coretempkld module) doesn't fail the ratio check.assertStartTimeMatcheshelper. On Linux/Mac/WindowsOSProcess#getStartTime()exposes the kernel's exact starttime and strict equality holds. On FreeBSD it's derived as
now - elapsedTimewhereelapsedTimeis theseconds-resolution
ps -o etimesvalue, so JNA's and FFM'sderived values drift by tens of milliseconds between snapshots.
The two startTime assertions (
currentProcess()andprocessListStructure()) use a 2000ms tolerance on FreeBSD;other platforms keep strict equality.
parity gaps:
Resource.RLIMIT_NOFILEfromJNA's platform module is 7 (the Linux value), but on FreeBSD
RLIMIT_NOFILE = 8(7 isRLIMIT_NPROC). SoFreeBsdOSProcessJNAhas been callinggetrlimiton the wrongresource — returning the max-processes limit (~10k) instead of
the open-files limit (~175k). Added an explicit
int RLIMIT_NOFILE = 8toFreeBsdLibcto shadow theinherited Linux constant; the FFM side was already correct
(added in FreeBSD Port: FFM concretes for the remaining HAL/OS surface #3328 commit 5).
fileStoreUpdateAttributesstrict totalSpace equality is tootight for a live filesystem — the test observed a 12 KB drift
(exactly 3×4KB blocks) between JNA's and FFM's
updateAttributes()calls because the CI VM was writing to/homeduring the test. Relaxed toassertWithinRatiowith a0.1% tolerance, matching the file's existing pattern for
drift-prone counters.
.github/workflows/freebsd-ffm.yamlpush-triggered jobintroduced in Phase 1. With the port complete, the permanent
testfreebsdjob inpr.yaml+unix.yamlcovers everychange.
Test plan
./mvnw clean testacrossoshi-common,oshi-core,oshi-core-ffm,oshi-benchmarkon each commit (Mac, JDK 25)./mvnw spotless:check checkstyle:checkclean on each modulesuccessful in
NativeComparisonTest, 0 failed — the JNA-vs-FFMHAL/OS parity surface that this PR enabled
BsdSysctlUtilTest,BsdSysctlUtilFFMTest) still pass via the permanenttestfreebsdjobtestfreebsdjob inpr.yamlwill exercisethe codebase under
flags: freebsdWhat's next
Per the project's [[feedback-no-transitional-tests]] policy plus
the explicit cleanup precedent from PR #3319 commit 3, any
FreeBSD-specific scaffolding that exists purely because of the FFM
port (temp tests, transitional gates) has been removed in this PR
or the prior ones. There's nothing more to clean up here.
Closes #3315.
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Tests