Skip to content

Add AIX support to the FFM (oshi-core-ffm) implementation - #3350

Merged
dbwiddis merged 11 commits into
oshi:masterfrom
dbwiddis:aix-ffm-port
Jun 7, 2026
Merged

dbwiddis merged 11 commits into
oshi:masterfrom
dbwiddis:aix-ffm-port

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Jun 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds AIX support to oshi-core-ffm, closing out the BSD/Unix FFM-port series for OSHI's supported platforms. The change splits AIX's HAL and OS classes into JNA and FFM concretes, with shared logic lifted into abstract bases in oshi-common, and wires the FFM stack into oshi.ffm.SystemInfo for AIX.

Resolves #3345.

CI

AIX cfarm CI (cfarm119, OpenJ9 JDK 25) doesn't run in the upstream oshi/oshi Actions because the cfarm workflow pulls from oshi/master, not from PR branches. It was run on every commit of this branch against the fork: actions/runs/27102129689 on dbwiddis/oshi — full mvn clean test green on the final commit, including the JNA path, FFM tests, and NativeComparisonTest parity check.

Structure

The PR is six logical commits, each green on AIX CI before the next was added:

  1. Move non-JNA classes to oshi-common — Pure-Java HAL classes (AixBaseboard/ComputerSystem/Firmware/GraphicsCard/PowerSource/Sensors/SoundCard/UsbDevice), OS classes (AixFileSystem/InstalledApps/OSFileStore), and command-driven drivers (Ls/Lscfg/Lspv/Lssrad/Uptime/Who) move from oshi-core to oshi-common. Drivers are placed under oshi.driver.common.unix.aix to avoid a split package with the JNA-only PsInfo / perfstat drivers that remain in oshi-core. Adds the CHANGELOG entry.
  2. FFM mappings for libc and libperfstat — Standalone AixPsInfo/AixLwpsInfo/Timestruc POJOs (ByteBuffer-parsed; no JNA) extracted from AixLibc into oshi-common. New oshi.ffm.unix.aix.AixLibcFunctions (thread_self, getpid, getrlimit, gethostname, open, close, pread) and PerfstatFunctions (eight perfstat_* calls + ~50 typed field accessors at byte offsets computed via JNA's reviewed Perfstat.java).
  3. Split AIX drivers into JNA + FFM peers — Renames PsInfo → PsInfoJNA and PerfstatCpu/Config/Disk/Memory/NetInterface/Process/Protocol → *JNA. Adds FFM peers under oshi.ffm.driver.unix.aix.* returning inner POJO mirrors (Solaris precedent). Adds shared oshi.driver.common.unix.aix.PsInfo for the pure-/proc-parsing methods.
  4. HAL/OS classes split into JNA + FFM with shared bases — For each JNA-using HAL/OS class, an abstract base lifts the JNA/FFM-agnostic logic into oshi-common (e.g. AixCentralProcessor shares the prtconf parsing, cache table, USER_HZ/SBITS, and tick conversion; concrete subclasses provide queryPartitionInfo/queryCpuTotal/queryPerCpuTicks from their respective perfstat data sources). AixOSThread is pure-Java and moves to oshi-common outright. The FFM SystemInfo adds AIX to its supported platforms and switch cases.
  5. Enable AIX in FFM tests + comparison test — Adds OS.AIX to the platform gates on the FFM SystemInfoTest/OperatingSystemFFMTest/VirtualMemoryFFMTest/GlobalMemoryFFMTest/ForeignFunctionsTest and on the oshi-benchmark NativeComparisonTest, plus --add-opens for the three new AIX FFM packages.
  6. Lift dlopen escape hatch + add SharedObjectLoader — libperfstat ships only as a member inside /usr/lib/libperfstat.a (shr_64.o/shr.o) and loading it requires the AIX-specific RTLD_MEMBER flag, which FFM's SymbolLookup.libraryLookup doesn't expose. The generic dlopen scaffolding (dlopenWithFlags/dlopenFirstAvailable) is on oshi.ffm.ForeignFunctions; the AIX-specific constants and library paths live in a new oshi.ffm.unix.aix.SharedObjectLoader whose name mirrors JNA's com.sun.jna.platform.unix.aix.SharedObjectLoader. Also includes two flake-mitigation fixes uncovered along the way: setState(State.INVALID) restored in the JNA/FFM AixOSProcess.updateAttributes when the pid isn't found, and a PROC_COUNT_PAD = 10 slack added to PerfstatProcess{JNA,FFM}.queryProcesses to absorb process churn between the two-call count-then-fill perfstat pattern (MacOperatingSystemJNA.getThreadCount precedent).

Notes

  • No behavior change on platforms other than AIX.
  • The JMH benchmarks in oshi-benchmark have no platform gate — they instantiate both oshi.SystemInfo and oshi.ffm.SystemInfo directly, so they pick up AIX automatically and can be run via the manual benchmarks workflow on cfarm119; PERFORMANCE.md will be updated separately when a benchmark run completes.
  • JNA struct offsets/sizes were sampled via JNA reflection against the reviewed Perfstat.java (com.sun.jna.platform.unix.aix); see the comments in PerfstatFunctions. If the JNA bindings ever drift, the NativeComparisonTest will surface it.

Test plan

  • ./mvnw spotless:apply checkstyle:check install forbiddenapis:check javadoc:javadoc test clean on macOS
  • AIX cfarm CI green on the final commit: actions/runs/27102129689

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added comprehensive IBM AIX support for system and hardware monitoring (CPUs, memory, disks, network, sensors, graphics, USB), process/thread enumeration, uptime/boot/version, and service/installed-app discovery.
    • Both JNA and FFM runtime backends supported for AIX.
  • Documentation

    • Updated README, site docs, and CHANGELOG to note AIX support and benchmark comparisons.
  • Tests

    • Enabled relevant tests and CI benchmark workflow entries for AIX.

dbwiddis added 6 commits June 7, 2026 12:23
Relocates AIX classes that don't touch JNA out of oshi-core and into
oshi-common, mirroring the structure used by the Solaris and OpenBSD
ports. This is a pure move with no behavior changes; subsequent commits
will add the FFM bindings and split the JNA-using classes.

* Drivers Ls/Lscfg/Lspv/Lssrad/Uptime/Who move to
  oshi.driver.common.unix.aix (the .common segment avoids a split
  package with the JNA-only PsInfo / perfstat drivers that remain in
  oshi-core).
* HAL classes AixBaseboard/ComputerSystem/Firmware/GraphicsCard/
  PowerSource/Sensors/SoundCard/UsbDevice move to
  oshi.hardware.common.platform.unix.aix; package-private classes are
  raised to public so the JNA HAL in oshi-core can still construct
  them across module boundaries.
* OS classes AixFileSystem/InstalledApps/OSFileStore move to
  oshi.software.common.os.unix.aix.
* Three driver tests follow their drivers; the AIX-only @EnabledOnOs
  guards remain in place.
* module-info.java exports the three new common packages and
  module-info.test opens them to org.junit.platform.commons.
* New package-info.java files replace the moved ones for both the
  oshi-core JNA-only HAL package and the new oshi-common OS package.
Adds the FFM-native bindings the AIX FFM driver split (phase 3) will
consume. The JNA struct mirrors that don't need JNA — AixPsInfo,
AixLwpsInfo, Timestruc — also move to oshi-common so both modules
share one copy.

oshi-common:
* AixPsInfo / AixLwpsInfo / Timestruc are now standalone classes
  under oshi.driver.common.unix.aix. They were already pure POJOs
  parsed from a ByteBuffer (no JNA dependency on the fields
  themselves); pulling them out of AixLibc.java lets the FFM PsInfo
  reuse the same parser.

oshi-core:
* AixLibc collapses to just the thread_self() native plus the
  CLibrary-inherited surface (gethostname/getpid/getrlimit).
  RLIMIT_NOFILE = 7 is the inherited Linux value, which is also AIX's.
* PsInfo, AixOSProcess, AixOSThread, PsInfoTest now import the structs
  from oshi-common.
* New package-info.java for oshi.driver.unix.aix (the one moved with
  the non-JNA drivers).

oshi-core-ffm (oshi.ffm.unix.aix):
* AixLibcFunctions — getpid, thread_self, getrlimit (with
  RLIMIT_NOFILE=7 + struct rlimit layout), gethostname. Same shape as
  SolarisLibcFunctions.
* PerfstatFunctions — FFM bindings for the 8 libperfstat APIs OSHI
  calls (perfstat_cpu, _cpu_total, _memory_total, _process, _disk,
  _partition_config, _netinterface, _protocol) plus ~50 typed field
  accessors for the struct fields OSHI actually reads. Struct sizes
  and offsets were computed by JNA reflection against the reviewed
  Perfstat.java; we deliberately do NOT define full struct layouts,
  only the offsets we need. libperfstat is loaded via raw dlopen
  (RTLD_MEMBER | RTLD_GLOBAL | RTLD_LAZY) because FFM's libraryLookup
  can't pass AIX's archive-member flag.

config/checkstyle-suppressions.xml:
* AixPsInfo / AixLwpsInfo / Timestruc: MemberName + VisibilityModifier
  (kernel-struct snake_case field names, mirrors the PsInfoFFM
  precedent for Solaris).
* PerfstatFunctions: JavadocMethod (~50 trivial accessors already have
  a single-line @code comment naming the field).
Renames the JNA-backed AIX drivers to *JNA in oshi-core and adds FFM
peers (*FFM) in oshi-core-ffm. Pure-Java parsing of /proc/<pid>/psinfo
that both backends share moves to oshi-common.

oshi-common (new shared driver):
* oshi.driver.common.unix.aix.PsInfo — queryPsInfo / queryLwpsInfo
  / queryArgsEnvAddrs. These read /proc files and use AixPsInfo /
  AixLwpsInfo POJOs (already in oshi-common). No JNA dependency.

oshi-core (renamed, no behavior change):
* PsInfo → PsInfoJNA — keeps the address-space queryArgsEnv that uses
  AixLibc.open / pread + JNA Memory.
* PerfstatCpu/Config/Disk/Memory/NetInterface/Process/Protocol
  → *JNA. Continue returning JNA Perfstat.* struct types.
* AixCentralProcessor / AixGlobalMemory / AixHardwareAbstractionLayer
  / AixNetworkIF / AixInternetProtocolStats / AixOSProcess /
  AixOSThread / AixOperatingSystem updated to import the JNA-suffixed
  driver names and the shared PsInfo from oshi-common.
* PsInfoTest → PsInfoJNATest, PerfstatTest → PerfstatJNATest.

oshi-core-ffm (new FFM peers):
* oshi.ffm.driver.unix.aix.PsInfoFFM — queryArgsEnv via FFM-bound
  libc open / pread / close + Arena.ofConfined.
* oshi.ffm.driver.unix.aix.perfstat.PerfstatCpuFFM / ConfigFFM /
  DiskFFM / MemoryFFM / NetInterfaceFFM / ProcessFFM / ProtocolFFM.
  Each declares inner POJO classes (CpuTotal, Disk, MemoryTotal, …)
  with snake_case field names matching the libperfstat struct, calls
  the matching PerfstatFunctions API, and converts MemorySegment ->
  POJO. Solaris precedent: PsInfoFFM keeps its mirror POJOs as inner
  classes.
* AixLibcFunctions gains open / close / pread (used by PsInfoFFM).
* PerfstatFunctions gains the memory-stat accessors AixGlobalMemory /
  AixVirtualMemory need (virt_total, real_total, real_avail,
  virt_active, pgspins, pgspouts).

config/checkstyle-suppressions.xml:
* Perfstat*FFM POJOs: MemberName + VisibilityModifier (snake_case
  mirrors of libperfstat structs, same convention as the inner
  classes in PsInfoFFM for Solaris).
* PsInfoFFM: JavadocMethod (private helper methods).
…ed bases

Splits every JNA-using AIX HAL and OS class into a JNA concrete in
oshi-core and an FFM concrete in oshi-core-ffm, with shared logic
lifted into abstract bases in oshi-common. The FFM SystemInfo now
selects the FFM stack for AIX.

oshi-common (new shared bases + utilities):
* hardware.common.platform.unix.aix:
  - AixVirtualMemory, AixGlobalMemory (PAGESIZE math, lscfg parse,
    abstract perfstat field accessors)
  - AixCentralProcessor (prtconf parsing, cache table, USER_HZ/SBITS,
    tick conversion; abstract queryPartitionInfo / queryCpuTotal /
    queryPerCpuTicks)
  - AixNetworkIF, AixHWDiskStore (updateAttributes math + IfStats /
    DiskStats POJOs)
* software.common.os.unix.aix:
  - AixInternetProtocolStats (TCP/UDP fallback values + abstract
    queryTcpStats / queryUdpStats)
  - AixNetworkParams (netstat -rnf parsing + abstract getHostName)
  - AixOSProcess (psinfo parsing, /proc enumeration, command-line /
    env memoization; abstract queryArgsEnv, getCpuAffinityMask)
  - AixOSThread (no native deps; moved here from oshi-core)
  - AixProcessState (pr_sname -> OSHI State; extracted from AixOSProcess)

oshi-core (JNA concretes):
* AixVirtualMemoryJNA / AixGlobalMemoryJNA / AixCentralProcessorJNA /
  AixHWDiskStoreJNA / AixNetworkIFJNA / AixHardwareAbstractionLayerJNA
* AixInternetProtocolStatsJNA / AixNetworkParamsJNA / AixOSProcessJNA /
  AixOperatingSystemJNA
* SystemInfo.java now wires AixOperatingSystemJNA + AixHardwareAbstractionLayerJNA.

oshi-core-ffm (FFM concretes + SystemInfo wiring):
* AixVirtualMemoryFFM / AixGlobalMemoryFFM / AixCentralProcessorFFM /
  AixHWDiskStoreFFM / AixNetworkIFFFM / AixHardwareAbstractionLayerFFM
* AixInternetProtocolStatsFFM / AixNetworkParamsFFM / AixOSProcessFFM /
  AixOperatingSystemFFM
* SystemInfo.java: AIX added to SUPPORTED_PLATFORMS, switch cases route
  to the AIX FFM HAL/OS.

config/checkstyle-suppressions.xml: MemberName / VisibilityModifier
suppressions for the shared base POJO data classes (CpuTickRow,
CpuTotalRow, IfStats, DiskStats, PartitionInfo) and the protected
lscfg supplier — snake_case mirrors of the libperfstat field names.
* oshi-core-ffm tests (VirtualMemoryFFMTest, GlobalMemoryFFMTest,
  OperatingSystemFFMTest, ForeignFunctionsTest, SystemInfoTest): add
  OS.AIX to the @EnabledOnOs gate.
* module-info.test: --add-opens for the three new FFM AIX packages
  (oshi.ffm.unix.aix, oshi.ffm.driver.unix.aix, and
  oshi.ffm.driver.unix.aix.perfstat) to org.junit.platform.commons so
  JUnit can introspect their tests.
* oshi-benchmark NativeComparisonTest: add OS.AIX. This is where the
  AIX libperfstat dlopen path (RTLD_MEMBER | RTLD_GLOBAL | RTLD_LAZY)
  + struct offsets are first exercised end-to-end on AIX CI, with the
  JNA path as a parity baseline.
* bnd-maven-plugin: no changes required. The oshi-core and oshi-core-ffm
  Export-Package globs (oshi.hardware.platform.*, oshi.software.os.unix.*,
  oshi.ffm.*) already cover the new AIX classes.
…ader

Refactors the libperfstat-loading code that was inlined in
PerfstatFunctions into two layers, mirroring how JNA's contrib/platform
splits the same problem:

oshi.ffm.ForeignFunctions (generic, OS-independent):
* dlopenWithFlags(String path, int flags): binds libc dlopen/dlsym as
  FFM downcalls, calls dlopen with the requested flags, wraps the
  handle into a SymbolLookup. The escape hatch for libraries whose
  flags FFM's libraryLookup can't pass.
* dlopenFirstAvailable(List<String>, int flags): tries paths in order
  and returns the first lookup that loads.

oshi.ffm.unix.aix.SharedObjectLoader (AIX-specific; name mirrors
com.sun.jna.platform.unix.aix.SharedObjectLoader):
* RTLD_LAZY/RTLD_GLOBAL/RTLD_MEMBER constants with the AIX values
  (RTLD_MEMBER doesn't exist on other platforms).
* loadPerfstat(): tries libperfstat.a(shr_64.o) then (shr.o), exactly
  like JNA's getPerfstatInstance.

PerfstatFunctions's library-load reduces to a single line:
    private static final SymbolLookup LIBPERFSTAT = SharedObjectLoader.loadPerfstat();
@coderabbitai

coderabbitai Bot commented Jun 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds shared AIX data contracts and base classes, introduces FFM-backed AIX bindings and implementations, and updates JNA-backed AIX wiring, tests, benchmarks, and release notes.

Changes

AIX support implementation stack

Layer / File(s) Summary
Common AIX contracts and shared abstractions
oshi-common/src/main/java/module-info.java, oshi-common/src/main/java/oshi/driver/common/unix/aix/*, oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/*, oshi-common/src/main/java/oshi/software/common/os/unix/aix/*, oshi-common/src/test/java/module-info.test, oshi-common/src/test/java/oshi/driver/common/unix/aix/*
Exports new common AIX packages, adds /proc struct mirrors and shared base classes, moves AIX package namespaces, and updates related module/test access and package docs.
FFM native bindings and helpers
oshi-core-ffm/src/main/java/oshi/ffm/ForeignFunctions.java, oshi-core-ffm/src/main/java/oshi/ffm/unix/aix/*, oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/*, oshi-core-ffm/src/main/java/oshi/ffm/unix/aix/perfstat/*
Adds FFM dlopen/dlsym helpers, AIX libc FFM bindings, SharedObjectLoader, PerfstatFunctions, and FFM-backed perfstat/psinfo drivers exposing plain-Java POJOs and query methods.
FFM AIX implementations and wiring
oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/aix/*, oshi-core-ffm/src/main/java/oshi/software/os/unix/aix/*, oshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java
Implements FFM-backed AixHardwareAbstractionLayerFFM and AixOperatingSystemFFM, plus FFM-backed processors, memory, disks, network, processes, and virtual memory, and wires AIX into FFM SystemInfo dispatch.
Core JNA class renames and JNA implementations
oshi-core/src/main/java/oshi/SystemInfo.java, oshi-core/src/main/java/oshi/driver/unix/aix/*, oshi-core/src/main/java/oshi/hardware/platform/unix/aix/*, oshi-core/src/main/java/oshi/software/os/unix/aix/*
Renames JNA-backed perfstat classes (*→*JNA), adds JNA-backed Aix*JNA implementations, adjusts SystemInfo to create JNA variants, and removes redundant nested JNA struct mirroring in favor of shared contracts.
Shared HAL/OS abstract bases
oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/*, oshi-common/src/main/java/oshi/software/common/os/unix/aix/*
Adds abstract common HAL/OS base classes (AixCentralProcessor, AixGlobalMemory, AixVirtualMemory, AixNetworkIF, AixHWDiskStore, AixInternetProtocolStats, AixNetworkParams) and POJOs/contracts used by both JNA and FFM implementations.
Tests, module opens, docs, checkstyle, CI/benchmarks
oshi-core-ffm/src/test/*, oshi-core/src/test/*, oshi-common/src/test/*, config/checkstyle-suppressions.xml, CHANGELOG.md, .github/workflows/benchmarks.yaml, PERFORMANCE.md, README.md, src/site/markdown/index.md
Enables AIX in platform-gated tests, updates module test --add-opens, adds Checkstyle suppressions for AIX naming, updates changelog/performance/readme, and adds an AIX benchaix manual benchmark job.

Sequence Diagram(s)

sequenceDiagram
  participant SystemInfo
  participant AixOperatingSystemFFM
  participant PerfstatProcessFFM
  participant AixOSProcessFFM
  participant PsInfoFFM
  SystemInfo->>AixOperatingSystemFFM: createOperatingSystem() for AIX
  AixOperatingSystemFFM->>PerfstatProcessFFM: queryProcesses()
  AixOperatingSystemFFM->>AixOSProcessFFM: construct per pid
  AixOSProcessFFM->>PsInfoFFM: queryArgsEnv(pid, psinfo)
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90+ minutes

Possibly related issues

Possibly related PRs

  • oshi/oshi#3150 — Expands NativeComparisonTest to include AIX, which aligns with the benchmark/test gating changes here.
  • oshi/oshi#3316 — Related JNA gating changes touching the same NativeComparisonTest.
  • oshi/oshi#3340 — Related benchmark workflow additions; both PRs modify .github/workflows/benchmarks.yaml.

Poem

🐰 I hop through bytes and perfstat light,
FFM and JNA dance in sight.
AIX now purrs through shared new ways,
With disks and threads and benchmark days.
Thump! My paws approve this code today.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

@codecov

codecov Bot commented Jun 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.92%. Comparing base (d185a11) to head (5fe9cd9).

Files with missing lines Patch % Lines
...e-ffm/src/main/java/oshi/ffm/ForeignFunctions.java 0.00% 30 Missing ⚠️
...hi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java 0.00% 2 Missing ⚠️
oshi-core/src/main/java/oshi/SystemInfo.java 0.00% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3350      +/-   ##
============================================
- Coverage     75.02%   74.92%   -0.11%     
  Complexity       76       76              
============================================
  Files           602      602              
  Lines         25813    25845      +32     
  Branches       3986     3990       +4     
============================================
- Hits          19366    19364       -2     
- Misses         4188     4221      +33     
- Partials       2259     2260       +1     
Flag Coverage Δ
freebsd 23.18% <0.00%> (-0.03%) ⬇️
linux 26.85% <0.00%> (-0.05%) ⬇️
macos 30.22% <0.00%> (-0.04%) ⬇️
openbsd 22.51% <0.00%> (-0.03%) ⬇️
solaris 24.80% <0.00%> (-0.02%) ⬇️
windows 36.18% <0.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

dbwiddis added 3 commits June 7, 2026 12:34
Adds a workflow_dispatch-only AIX job to the Benchmarks (manual)
workflow, parallel to the other platforms. SSH's into cfarm119 (same
host the Cfarm CI test job uses) and applies the same JNA stable-load
gymnastics — pre-extract libjnidispatch.a so the test JVM can
System.load() it directly, dodging the OpenJ9 per-PID jar-unpack
EBUSY flake.

This commit is the initial-capture variant: it fetches the PR branch
from dbwiddis/oshi (so we can run it before merge to populate the
first AIX rows in PERFORMANCE.md) and uses the heavier
`-wi 5 -i 7 -f 5` JMH settings that produced the existing
PERFORMANCE.md numbers for the other platforms. command_timeout is
bumped to 180m to give the run generous headroom.

Before merge, the git block reverts to `git pull upstream master` and
the JMH args revert to the workflow's standard `-wi 1 -i 3 -f 1`.
The phase-6 hoist landed DLOPEN/DLSYM as eager static fields on
ForeignFunctions, which means every subclass — including
WindowsForeignFunctions — triggers LINKER.defaultLookup().findOrThrow("dlopen")
in its <clinit> chain. Windows doesn't have a `dlopen` symbol
(LoadLibrary/GetProcAddress instead), so findOrThrow throws
NoSuchElementException, which the JVM wraps as ExceptionInInitializerError,
breaking every Windows FFM class on JDK 25+26.

Fix: move the dlopen/dlsym MethodHandles into a private static nested
holder (Bill Pugh pattern). The holder class is only loaded on first
access — i.e., when dlopenWithFlags() is actually called — which
Windows code paths never do. ForeignFunctions's <clinit> stays clean
on every platform.

The dlopen hoist itself stays intact; only the timing of the lookup
changes from class-load to first-call.
The earlier `java -jar oshi-benchmark/target/benchmarks.jar` call
resolved against PATH, where `/opt/freeware/bin` shadows `java` with
AIX's bundled Java 8. Java 8 doesn't recognize
`--enable-native-access`, which the @fork annotations on every
benchmark class prepend to JMH's forked JVMs (it's a JDK-17+ flag
for FFM access). Result on the first run:
"Command-line option unrecognised: --enable-native-access=ALL-UNNAMED".

Invoke JMH explicitly via \$JAVA_HOME/bin/java so the parent JVM is
JDK 25 (the one we untarred at ~/java/jdk-25.0.3+9). JMH sets
forks' java.home from the parent, so the forked JVMs also run on
JDK 25 and accept the flag.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
oshi-core/src/main/java/oshi/driver/unix/aix/PsInfoJNA.java (1)

110-119: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Stop the env-pointer walk at the first null entry.

Line 113 checks addr, but that value never changes after initialization. Once the first envp table address is non-zero, this loop runs until limit expires instead of stopping at the null terminator, so it can read past the real environment vector and fabricate extra entries.

Suggested fix
-                    long addr = bufStart == 0 ? 0 : getOffsetFromBuffer(buffer, envp - bufStart, increment);
-                    int limit = 500; // sane max env strings to stop at
-                    long offset = addr;
-                    while (addr != 0 && --limit > 0) {
+                    long addr = bufStart == 0 ? 0 : getOffsetFromBuffer(buffer, envp - bufStart, increment);
+                    int limit = 500; // sane max env strings to stop at
+                    long offset = addr;
+                    while (offset != 0 && --limit > 0) {
                         bufStart = conditionallyReadBufferFromStartOfPage(fd, buffer, bufSize, bufStart, offset);
                         long envPtr = bufStart == 0 ? 0 : getOffsetFromBuffer(buffer, offset - bufStart, increment);
-                        if (envPtr != 0) {
-                            envPtrList.add(envPtr);
-                        }
+                        if (envPtr == 0) {
+                            break;
+                        }
+                        envPtrList.add(envPtr);
                         offset += increment;
                     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@oshi-core/src/main/java/oshi/driver/unix/aix/PsInfoJNA.java` around lines 110
- 119, The loop that walks the envp table uses the initial addr variable and
never stops on the table's null terminator, causing spurious entries; update the
loop to check the freshly read envPtr each iteration and break when envPtr == 0
(i.e., after computing envPtr from getOffsetFromBuffer and before adding to
envPtrList), keeping the existing limit and offset/increment logic and using the
same symbols (addr, offset, envPtr, envp, envPtrList,
conditionallyReadBufferFromStartOfPage) so the walk halts at the first null
entry.
oshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java (1)

59-62: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Update Javadoc to reflect AIX FFM support.

The class-level Javadoc states AIX requires JNA, but this PR adds AIX to the FFM implementation. Update line 59 to include AIX in the supported platforms list, and remove AIX from line 61's "broader platform support" list.

📝 Proposed fix
- * This implementation requires JDK 25+ and currently supports Windows, macOS, Linux, FreeBSD, OpenBSD, and Solaris
- * (illumos). It uses the FFM API in place of JNA for native access, which may offer better performance. For broader
- * platform support (DragonFly BSD, NetBSD, and AIX), use the JNA-based entry point ({`@code` oshi.SystemInfo}) in the
+ * This implementation requires JDK 25+ and currently supports Windows, macOS, Linux, FreeBSD, OpenBSD, Solaris
+ * (illumos), and AIX. It uses the FFM API in place of JNA for native access, which may offer better performance. For broader
+ * platform support (DragonFly BSD and NetBSD), use the JNA-based entry point ({`@code` oshi.SystemInfo}) in the
  * {`@code` oshi-core} module.
🤖 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/SystemInfo.java` around lines 59 - 62,
Update the class Javadoc in the SystemInfo class to reflect that AIX is now
supported by the FFM implementation: add "AIX" to the list of supported
platforms in the sentence that currently lists Windows, macOS, Linux, FreeBSD,
OpenBSD, and Solaris (illumos), and remove "AIX" from the later sentence that
describes platforms requiring the JNA-based entry point ({`@code`
oshi.SystemInfo}) for broader platform support (DragonFly BSD, NetBSD, and AIX).
Ensure the wording remains grammatically correct and that the Javadoc references
to the JNA-based entry point and {`@code` oshi.SystemInfo} are preserved.
🧹 Nitpick comments (3)
oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatConfigFFM.java (1)

59-61: ⚡ Quick win

Consider adding trace-level logging for caught exceptions.

The catch block silently swallows all exceptions, which may make debugging difficult if perfstat calls fail unexpectedly. Adding LOG.trace("Failed to query partition config", t) would help diagnose issues while keeping logs quiet in normal operation.

This pattern appears across all the perfstat drivers (PerfstatConfigFFM, PerfstatCpuFFM, PerfstatDiskFFM, PerfstatMemoryFFM, PerfstatNetInterfaceFFM, PerfstatProcessFFM). Consider adding trace-level logging to all catch blocks.

🤖 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/aix/perfstat/PerfstatConfigFFM.java`
around lines 59 - 61, The catch blocks in PerfstatConfigFFM (and the other
perfstat driver classes PerfstatCpuFFM, PerfstatDiskFFM, PerfstatMemoryFFM,
PerfstatNetInterfaceFFM, PerfstatProcessFFM) currently swallow Throwable
silently; update each catch (Throwable t) block to call the logger at trace
level with the exception (e.g., LOG.trace("Failed to query partition config", t)
in PerfstatConfigFFM) so the exception and context are recorded without changing
normal logging verbosity; ensure the message matches each class/context (e.g.,
"Failed to query CPU", "Failed to query disk", etc.) and use the existing LOG
instance in each class.
oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/aix/AixNetworkIFFFM.java (1)

61-78: 💤 Low value

Consider defensive null-check for stat.name.

Line 63 calls stat.name.equals(this.getName()). If stat.name is null (e.g., from corrupt or incomplete perfstat data), this will throw NPE. Consider using Objects.equals(stat.name, this.getName()) or an explicit null-check for robustness.

🛡️ Optional defensive fix
+import java.util.Objects;
+
 // ...
 
     `@Override`
     protected IfStats queryStats() {
         for (PerfstatNetInterfaceFFM.NetInterface stat : netstats.get()) {
-            if (stat.name.equals(this.getName())) {
+            if (Objects.equals(stat.name, this.getName())) {
                 IfStats out = new IfStats();
🤖 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/hardware/platform/unix/aix/AixNetworkIFFFM.java`
around lines 61 - 78, In AixNetworkIFFFM.queryStats(), the comparison
stat.name.equals(this.getName()) can NPE if stat.name is null; change the
equality check to be null-safe (e.g., use Objects.equals(stat.name,
this.getName()) or explicitly check stat.name != null before calling equals) so
the loop skips null names and still returns the populated IfStats when names
match; update the comparison in the for-loop over
PerfstatNetInterfaceFFM.NetInterface to prevent NPEs while preserving existing
out field assignments and return behavior.
oshi-common/src/main/java/oshi/driver/common/unix/aix/package-info.java (1)

2-2: 💤 Low value

Update copyright year to reflect when the file was created.

This is a new file created in 2026, but the copyright years show 2020-2022. Consider updating to 2026 or 2020-2026 to align with the project's timeline and the AIX FFM implementation work.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@oshi-common/src/main/java/oshi/driver/common/unix/aix/package-info.java` at
line 2, The file package-info.java contains an outdated copyright header
("Copyright (c) 2020-2022 The OSHI Project Contributors"); update that header to
reflect the file creation year 2026 by changing it to either "2026" or the range
"2020-2026" so the copyright years align with the new AIX FFM 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 @.github/workflows/benchmarks.yaml:
- Around line 143-145: The checkout cleanup is incomplete: after the existing
git reset --hard, git fetch ..., and git checkout -B ... steps, ensure untracked
and ignored files are removed so stale target/ artifacts can't persist by
running a full git clean (e.g., invoke git clean -fdx) before building;
alternatively adjust the build step that currently calls mvn package to run a
clean build (e.g., use mvn clean package). Update the script around the git
reset/git fetch/git checkout sequence and/or the mvn package invocation to
include one of these changes so each job starts from a pristine workspace.
- Around line 107-123: The benchaix job is using the repository token with
default (likely write) permissions; restrict GITHUB_TOKEN to least privilege by
adding an explicit permissions block (e.g., permissions: contents: read) scoped
to the benchaix job (or at workflow top) so the job only has read access needed
for checkout; update the benchaix job definition (the job named "JMH benchmarks,
AIX" and its steps such as the appleboy/ssh-action step) to include this
permissions block to harden the workflow.

In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixHWDiskStore.java`:
- Around line 39-52: The zero-blocks branch in AixHWDiskStore unconditionally
calls setReads(stats.xfers) and setWrites(0L), which can break monotonicity;
change that branch to check current values first and only update if stats.xfers
> getReads() and 0L > getWrites() respectively (use getReads(), getWrites(),
setReads(), setWrites(), and stats.xfers to locate the code), ensuring
reads/writes are only increased similar to the non-zero branch.

In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/package-info.java`:
- Line 2: Update the copyright header in package-info.java so the year range
matches the rest of the PR; replace "2020-2022" with "2020-2026" in the file's
top comment (the copyright line) to ensure consistency with other files.

In `@oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/PsInfoFFM.java`:
- Around line 74-82: The pointer-size logic is inverted: in PsInfoFFM (method
reading /proc/<pid>/status) the local variable increment is set using status[17]
== 1 ? 8 : 4, which should be reversed so 32-bit (status[17] == 1) yields 4 and
64-bit yields 8; update the ternary (or conditional) that assigns increment to
use status[17] == 1 ? 4 : 8 (or equivalent), keeping the
Files.readAllBytes(Paths.get("/proc/" + pid + "/status")) and the existing
IOException return behavior intact so Pair<>(args, env) is still returned on
error.

In `@oshi-core/src/main/java/oshi/software/os/unix/aix/AixOSProcessJNA.java`:
- Around line 67-83: The methods getSoftOpenFileLimit and getHardOpenFileLimit
call AixLibc.INSTANCE.getrlimit but always return rlim_cur/rlim_max even if the
native call fails (leaving Resource.Rlimit zeroed); change both methods to check
the return value of AixLibc.INSTANCE.getrlimit (capture its result) and only
return rlim_cur/rlim_max when getrlimit indicates success (e.g., returns 0),
otherwise return the unavailable sentinel -1L; reference Resource.Rlimit,
AixLibc.INSTANCE.getrlimit, rlim_cur and rlim_max to locate the fix.

---

Outside diff comments:
In `@oshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java`:
- Around line 59-62: Update the class Javadoc in the SystemInfo class to reflect
that AIX is now supported by the FFM implementation: add "AIX" to the list of
supported platforms in the sentence that currently lists Windows, macOS, Linux,
FreeBSD, OpenBSD, and Solaris (illumos), and remove "AIX" from the later
sentence that describes platforms requiring the JNA-based entry point ({`@code`
oshi.SystemInfo}) for broader platform support (DragonFly BSD, NetBSD, and AIX).
Ensure the wording remains grammatically correct and that the Javadoc references
to the JNA-based entry point and {`@code` oshi.SystemInfo} are preserved.

In `@oshi-core/src/main/java/oshi/driver/unix/aix/PsInfoJNA.java`:
- Around line 110-119: The loop that walks the envp table uses the initial addr
variable and never stops on the table's null terminator, causing spurious
entries; update the loop to check the freshly read envPtr each iteration and
break when envPtr == 0 (i.e., after computing envPtr from getOffsetFromBuffer
and before adding to envPtrList), keeping the existing limit and
offset/increment logic and using the same symbols (addr, offset, envPtr, envp,
envPtrList, conditionallyReadBufferFromStartOfPage) so the walk halts at the
first null entry.

---

Nitpick comments:
In `@oshi-common/src/main/java/oshi/driver/common/unix/aix/package-info.java`:
- Line 2: The file package-info.java contains an outdated copyright header
("Copyright (c) 2020-2022 The OSHI Project Contributors"); update that header to
reflect the file creation year 2026 by changing it to either "2026" or the range
"2020-2026" so the copyright years align with the new AIX FFM implementation.

In
`@oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatConfigFFM.java`:
- Around line 59-61: The catch blocks in PerfstatConfigFFM (and the other
perfstat driver classes PerfstatCpuFFM, PerfstatDiskFFM, PerfstatMemoryFFM,
PerfstatNetInterfaceFFM, PerfstatProcessFFM) currently swallow Throwable
silently; update each catch (Throwable t) block to call the logger at trace
level with the exception (e.g., LOG.trace("Failed to query partition config", t)
in PerfstatConfigFFM) so the exception and context are recorded without changing
normal logging verbosity; ensure the message matches each class/context (e.g.,
"Failed to query CPU", "Failed to query disk", etc.) and use the existing LOG
instance in each class.

In
`@oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/aix/AixNetworkIFFFM.java`:
- Around line 61-78: In AixNetworkIFFFM.queryStats(), the comparison
stat.name.equals(this.getName()) can NPE if stat.name is null; change the
equality check to be null-safe (e.g., use Objects.equals(stat.name,
this.getName()) or explicitly check stat.name != null before calling equals) so
the loop skips null names and still returns the populated IfStats when names
match; update the comparison in the for-loop over
PerfstatNetInterfaceFFM.NetInterface to prevent NPEs while preserving existing
out field assignments and return behavior.
🪄 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: d7f76a51-62c0-43af-82e0-fe85baa639bb

📥 Commits

Reviewing files that changed from the base of the PR and between d185a11 and 39926ee.

📒 Files selected for processing (102)
  • .github/workflows/benchmarks.yaml
  • CHANGELOG.md
  • config/checkstyle-suppressions.xml
  • oshi-benchmark/src/test/java/oshi/comparison/NativeComparisonTest.java
  • oshi-common/src/main/java/module-info.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/AixLwpsInfo.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/AixPsInfo.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Ls.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lspv.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lssrad.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/PsInfo.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Timestruc.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Uptime.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Who.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/package-info.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixBaseboard.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixComputerSystem.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixFirmware.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixGlobalMemory.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixGraphicsCard.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixHWDiskStore.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixNetworkIF.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixPowerSource.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixSensors.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixSoundCard.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixUsbDevice.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixVirtualMemory.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/package-info.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixFileSystem.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixInstalledApps.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixInternetProtocolStats.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixNetworkParams.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOSFileStore.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOSProcess.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOSThread.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixProcessState.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/package-info.java
  • oshi-common/src/test/java/module-info.test
  • oshi-common/src/test/java/oshi/driver/common/unix/aix/LsDevicesTest.java
  • oshi-common/src/test/java/oshi/driver/common/unix/aix/LssradTest.java
  • oshi-common/src/test/java/oshi/driver/common/unix/aix/UptimeAndBootTimeTest.java
  • oshi-core-ffm/src/main/java/oshi/ffm/ForeignFunctions.java
  • oshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/PsInfoFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/package-info.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatConfigFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatCpuFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatDiskFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatMemoryFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatNetInterfaceFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatProcessFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatProtocolFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/package-info.java
  • oshi-core-ffm/src/main/java/oshi/ffm/unix/aix/AixLibcFunctions.java
  • oshi-core-ffm/src/main/java/oshi/ffm/unix/aix/PerfstatFunctions.java
  • oshi-core-ffm/src/main/java/oshi/ffm/unix/aix/SharedObjectLoader.java
  • oshi-core-ffm/src/main/java/oshi/ffm/unix/aix/package-info.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/aix/AixCentralProcessorFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/aix/AixGlobalMemoryFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/aix/AixHWDiskStoreFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/aix/AixHardwareAbstractionLayerFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/aix/AixNetworkIFFFM.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/aix/AixVirtualMemoryFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/unix/aix/AixInternetProtocolStatsFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/unix/aix/AixNetworkParamsFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/unix/aix/AixOSProcessFFM.java
  • oshi-core-ffm/src/main/java/oshi/software/os/unix/aix/AixOperatingSystemFFM.java
  • oshi-core-ffm/src/test/java/module-info.test
  • oshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java
  • oshi-core/src/main/java/oshi/SystemInfo.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/PsInfoJNA.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/package-info.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatConfigJNA.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatCpuJNA.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatDiskJNA.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatMemoryJNA.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatNetInterfaceJNA.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatProcessJNA.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/perfstat/PerfstatProtocolJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/AixCentralProcessorJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/AixGlobalMemoryJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/AixHWDiskStore.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/AixHWDiskStoreJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/AixHardwareAbstractionLayerJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/AixNetworkIFJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/AixVirtualMemory.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/AixVirtualMemoryJNA.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/package-info.java
  • oshi-core/src/main/java/oshi/jna/platform/unix/AixLibc.java
  • oshi-core/src/main/java/oshi/software/os/unix/aix/AixInternetProtocolStatsJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/aix/AixNetworkParams.java
  • oshi-core/src/main/java/oshi/software/os/unix/aix/AixNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/aix/AixOSProcessJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/aix/AixOperatingSystemJNA.java
  • oshi-core/src/test/java/oshi/driver/unix/aix/PsInfoJNATest.java
  • oshi-core/src/test/java/oshi/driver/unix/aix/perfstat/PerfstatJNATest.java
💤 Files with no reviewable changes (3)
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/AixVirtualMemory.java
  • oshi-core/src/main/java/oshi/software/os/unix/aix/AixNetworkParams.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/aix/AixHWDiskStore.java

Comment on lines +107 to +123
benchaix:
# SSH into the same cfarm AIX 7.3 box the regular Cfarm CI job uses. Same
# JNA stable-load gymnastics: libjnidispatch.a gets pre-extracted to a
# known cache path so the test JVM can System.load() it directly. Without
# this, OpenJ9 occasionally fails the per-PID jar-unpack with EBUSY.
#
# TEMPORARY: fetches the PR branch from dbwiddis/oshi to capture initial
# PERFORMANCE.md numbers BEFORE merge, and runs JMH at the
# PERFORMANCE.md-quality settings (-wi 5 -i 7 -f 5). Once the numbers
# are committed, switch the git block to `git pull upstream master` and
# the JMH args to the workflow's standard `-wi 1 -i 3 -f 1`.
name: JMH benchmarks, AIX
concurrency: aix_cfarm119
runs-on: ubuntu-latest
steps:
- name: Benchmark on AIX
uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2 # v1.2.5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Set explicit GITHUB_TOKEN permissions for this workflow.

Lines 107-123 add another job, but the workflow still inherits repo-default token permissions. These jobs only need read access for checkout, so leaving defaults in place unnecessarily widens the blast radius if any action step is compromised.

Suggested hardening
 on:
   workflow_dispatch:
+
+permissions:
+  contents: read
🧰 Tools
🪛 zizmor (1.25.2)

[warning] 107-184: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

🤖 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/benchmarks.yaml around lines 107 - 123, The benchaix job
is using the repository token with default (likely write) permissions; restrict
GITHUB_TOKEN to least privilege by adding an explicit permissions block (e.g.,
permissions: contents: read) scoped to the benchaix job (or at workflow top) so
the job only has read access needed for checkout; update the benchaix job
definition (the job named "JMH benchmarks, AIX" and its steps such as the
appleboy/ssh-action step) to include this permissions block to harden the
workflow.

Source: Linters/SAST tools

Comment thread .github/workflows/benchmarks.yaml Outdated
Comment on lines +143 to +145
git reset --hard
git fetch https://github.com/dbwiddis/oshi.git aix-ffm-port
git checkout -B aix-ffm-port FETCH_HEAD

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Clean the reused cfarm checkout before packaging.

Lines 143-145 reset tracked files only. Because this job reuses ~/git/oshi and Line 177 runs mvn package without clean, stale target/ output or other untracked artifacts from an older commit can survive across runs and get benchmarked instead of the fetched branch.

Suggested fix
           git reset --hard
+          git clean -fdx
           git fetch https://github.com/dbwiddis/oshi.git aix-ffm-port
           git checkout -B aix-ffm-port FETCH_HEAD
@@
-          mvn package -pl oshi-benchmark -am -DskipTests -Dshade.phase=package -q -B -Dmaven.gitcommitid.skip=true
+          mvn clean package -pl oshi-benchmark -am -DskipTests -Dshade.phase=package -q -B -Dmaven.gitcommitid.skip=true

Also applies to: 177-177

🤖 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/benchmarks.yaml around lines 143 - 145, The checkout
cleanup is incomplete: after the existing git reset --hard, git fetch ..., and
git checkout -B ... steps, ensure untracked and ignored files are removed so
stale target/ artifacts can't persist by running a full git clean (e.g., invoke
git clean -fdx) before building; alternatively adjust the build step that
currently calls mvn package to run a clean build (e.g., use mvn clean package).
Update the script around the git reset/git fetch/git checkout sequence and/or
the mvn package invocation to include one of these changes so each job starts
from a pristine workspace.

Comment on lines +74 to +82
// Data model: 1 = 32-bit, anything else (typically 64-bit) gives 8-byte pointers.
long increment;
Path p = Paths.get("/proc/" + pid + "/status");
try {
byte[] status = Files.readAllBytes(p);
increment = status[17] == 1 ? 8 : 4;
} catch (IOException e) {
return new Pair<>(args, env);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Fix inverted pointer-size logic.

The comment at line 74 states "Data model: 1 = 32-bit, anything else (typically 64-bit) gives 8-byte pointers," but line 79 assigns increment = 8 when status[17] == 1 (32-bit) and increment = 4 otherwise. This is backwards: 32-bit processes use 4-byte pointers, and 64-bit processes use 8-byte pointers.

🐛 Proposed fix
                 try {
                     byte[] status = Files.readAllBytes(p);
-                    increment = status[17] == 1 ? 8 : 4;
+                    increment = status[17] == 1 ? 4 : 8;
                 } catch (IOException e) {
                     return new Pair<>(args, env);
                 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Data model: 1 = 32-bit, anything else (typically 64-bit) gives 8-byte pointers.
long increment;
Path p = Paths.get("/proc/" + pid + "/status");
try {
byte[] status = Files.readAllBytes(p);
increment = status[17] == 1 ? 8 : 4;
} catch (IOException e) {
return new Pair<>(args, env);
}
// Data model: 1 = 32-bit, anything else (typically 64-bit) gives 8-byte pointers.
long increment;
Path p = Paths.get("/proc/" + pid + "/status");
try {
byte[] status = Files.readAllBytes(p);
increment = status[17] == 1 ? 4 : 8;
} catch (IOException e) {
return new Pair<>(args, env);
}
🤖 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/aix/PsInfoFFM.java` around
lines 74 - 82, The pointer-size logic is inverted: in PsInfoFFM (method reading
/proc/<pid>/status) the local variable increment is set using status[17] == 1 ?
8 : 4, which should be reversed so 32-bit (status[17] == 1) yields 4 and 64-bit
yields 8; update the ternary (or conditional) that assigns increment to use
status[17] == 1 ? 4 : 8 (or equivalent), keeping the
Files.readAllBytes(Paths.get("/proc/" + pid + "/status")) and the existing
IOException return behavior intact so Pair<>(args, env) is still returned on
error.

dbwiddis added 2 commits June 7, 2026 13:10
… merge-ready form

Numbers were captured by running the initial-capture variant of the
benchmarks.yaml AIX job (`-wi 5 -i 7 -f 5`, branch pulled from the
fork) on cfarm119 against the PR branch. Raw means/units, for the
record:

  CpuTicks   FFM   0.067 ± 0.002  ms/op
  CpuTicks   JNA   5.470 ± 0.050  ms/op
  FileStore  FFM   267331.697 ± 7476.719  us/op
  FileStore  JNA   267279.300 ± 6689.761  us/op
  Memory     FFM   114.414 ± 0.318  us/op
  Memory     JNA   202.620 ± 4.037  us/op
  NetworkIF  FFM   49.219 ± 1.282  us/op
  NetworkIF  JNA   340.667 ± 33.339  us/op
  Processes  FFM   8.511 ± 0.249  ms/op
  Processes  JNA   9.211 ± 0.193  ms/op

Headline: a Solaris-like ~80x FFM win on CpuTicks (libperfstat
per-call cost dwarfed by JNA marshalling), and a ~7x win on
NetworkIF. FileStore is bottlenecked on filesystem stat() calls so
the two backends tie. The supported-FFM-platforms sentence in the
intro is updated to include AIX.

benchmarks.yaml: revert the AIX job to its merge-ready form now that
the capture is in PERFORMANCE.md:

* Drop the TEMPORARY block and switch the git block back to the
  cfarm.yaml testaix pattern (`git pull upstream master`).
* JMH args back to the workflow's standard `-wi 1 -i 3 -f 1`.
* command_timeout back to 30m.
* Keep the `$JAVA_HOME/bin/java` fix — that's a real bug, not
  capture-quality only.
Fixes (all called out in the CodeRabbit pass on PR #3350):

* AixHWDiskStore (oshi-common): the zero-blocks branch in
  updateAttributes() unconditionally called setReads(stats.xfers) and
  setWrites(0L), breaking monotonicity. Only update reads if higher
  than the previous value, and leave writes alone when block-split
  info is missing. Bug is pre-existing in the original
  oshi-core/AixHWDiskStore but surfaced via this PR.
* AixOSProcessJNA: getSoftOpenFileLimit / getHardOpenFileLimit
  returned rlim_cur/rlim_max even when AixLibc.INSTANCE.getrlimit
  failed, surfacing zeroed values as real limits. Check the call's
  return value and fall through to -1L on failure. AixOSProcessFFM
  already had this check; this brings JNA into line.
* PsInfoJNA: the envp walk in queryArgsEnv tested `addr` (never
  updated inside the loop) instead of `envPtr`, so the loop only
  exited via the 500-entry safety cap and could collect stale bytes
  past the table's null terminator. Break the loop when envPtr == 0.
  Same pre-existing bug; PsInfoFFM was already correct.
* oshi.ffm.SystemInfo Javadoc: move AIX out of the JNA-only list and
  into the FFM-supported list now that this PR ships AIX FFM support.
* README.md / src/site/markdown/index.md SystemInfoFactory matrix:
  move AIX from the unsupported-platform row to the FFM-supported
  platforms.
* package-info copyright headers in
  oshi-common/oshi/{driver/common/unix/aix, hardware/common/platform/unix/aix}/:
  refresh "2020-2022" -> "2020-2026" to match the rest of the PR.
* PerfstatConfig/Cpu/Disk/Memory/NetInterface/Process/ProtocolFFM:
  the silent catch (Throwable) blocks on each queryXxx now route
  through ForeignFunctions.callInArenaOrDefault, so failures get a
  trace-level log line with the cause instead of disappearing.

Skipped (with reasons):
* benchmarks.yaml git-clean and per-job least-privilege permissions:
  workflow-wide concerns, not AIX-specific, and other benchmark jobs
  don't apply them either — out of scope.
* PsInfoFFM/JNA pointer-size ternary (`status[17] == 1 ? 8 : 4`):
  matches the long-standing JNA convention; CodeRabbit may be right
  about pr_dmodel encoding but it's been in production for years
  without 32-bit AIX user reports, so flipping without verification
  is risky. Flagged for separate investigation.
* AixNetworkIFFFM null-name guard on stat.name.equals(getName()):
  PerfstatFunctions.readName() always returns a non-null String
  (constructs one from the byte buffer), so the NPE the comment
  warns about can't happen.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/benchmarks.yaml:
- Around line 132-134: The workflow currently forces the AIX benchmark to use
upstream/master by running "git checkout master", "git reset --hard HEAD~2", and
"git pull upstream master"; replace these commands so the job checks out the
dispatched workflow ref instead (use the workflow's ref/SHA), e.g., fetch and
checkout the dispatched ref via the environment variables (GITHUB_REF or
GITHUB_SHA) or use actions/checkout with ref: ${{ github.sha }}; update the
block that contains "git checkout master", "git reset --hard HEAD~2", and "git
pull upstream master" to fetch and checkout the dispatched ref so all jobs
benchmark the same commit.

In `@src/site/markdown/index.md`:
- Line 80: The table row string "| Both `oshi-core` and `oshi-core-ffm` | &lt;25
or unsupported platform (DragonFly BSD, NetBSD) | Any | JNA (FFM unavailable) |"
is ambiguous; split it into two rows so JDK and Platform conditions are
explicit: one row with JDK "<25" and Platform "Any" and the same artifact and
note, and a second row with JDK "Any" and Platform "DragonFly BSD, NetBSD"
(artifact and note unchanged). Update the markdown table in
src/site/markdown/index.md accordingly so each condition appears in its correct
column.
🪄 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: 245ce68c-8243-4d6f-8c84-694a95157cda

📥 Commits

Reviewing files that changed from the base of the PR and between 39926ee and 5fe9cd9.

📒 Files selected for processing (16)
  • .github/workflows/benchmarks.yaml
  • PERFORMANCE.md
  • README.md
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixHWDiskStore.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/package-info.java
  • oshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatConfigFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatCpuFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatDiskFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatMemoryFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatNetInterfaceFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatProcessFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatProtocolFFM.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/PsInfoJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/aix/AixOSProcessJNA.java
  • src/site/markdown/index.md
✅ Files skipped from review due to trivial changes (3)
  • README.md
  • PERFORMANCE.md
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/package-info.java
🚧 Files skipped from review as they are similar to previous changes (9)
  • oshi-core-ffm/src/main/java/oshi/ffm/SystemInfo.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatProcessFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatConfigFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatMemoryFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatCpuFFM.java
  • oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatDiskFFM.java
  • oshi-core/src/main/java/oshi/software/os/unix/aix/AixOSProcessJNA.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixHWDiskStore.java
  • oshi-core/src/main/java/oshi/driver/unix/aix/PsInfoJNA.java
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 26, macos-latest
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: JMH Benchmarks, windows-latest
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: JMH Benchmarks, macos-latest
  • GitHub Check: JMH Benchmarks, ubuntu-latest
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.

Applied to files:

  • src/site/markdown/index.md
📚 Learning: 2026-04-03T18:44:48.200Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:63-66
Timestamp: 2026-04-03T18:44:48.200Z
Learning: In oshi/oshi PlatformEnum.java, the DRAGONFLYBSD enum constant is intentionally added for platform detection only (no implementation classes exist yet). It allows UnsupportedOperationException messages to say "DragonFly BSD" rather than "Unknown". Full DragonFly BSD support is tracked in issue `#2583`. Do not flag the missing switch-case implementations as a bug.

Applied to files:

  • src/site/markdown/index.md
📚 Learning: 2026-04-06T04:45:51.516Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:51.516Z
Learning: In the oshi/oshi project, the public API is strictly limited to interfaces and classes in the `oshi`, `oshi.hardware`, and `oshi.software.os` packages. All platform-specific code under subpackages like `oshi.software.os.linux`, `oshi.hardware.platform.linux`, etc., is considered implementation detail — not public API. Do not flag changes to platform-specific classes (e.g., making `LinuxOperatingSystem` abstract, narrowing constructor visibility, adding abstract methods) as public API breaks.

Applied to files:

  • src/site/markdown/index.md
📚 Learning: 2026-05-31T04:49:19.668Z
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:19.668Z
Learning: In the oshi/oshi project, the NetBSD platform intentionally removes all JNA/native library dependencies (PR `#3310`). `NetBsdOperatingSystem.getThreadId()` uses `(int) Thread.currentThread().getId()` rather than `NetBsdLibc._lwp_self()` because the JNA native library is not bundled with the Maven dependency for the NetBSD platform. The mismatch between Java thread ids and kernel LWP ids is an accepted trade-off. Do not suggest reintroducing JNA-based calls (such as `NetBsdLibc._lwp_self()`) in NetBSD platform code.

Applied to files:

  • src/site/markdown/index.md
📚 Learning: 2026-05-30T02:28:01.891Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3307
File: .github/workflows/netbsd.yaml:4-8
Timestamp: 2026-05-30T02:28:01.891Z
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/benchmarks.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/benchmarks.yaml
🪛 zizmor (1.25.2)
.github/workflows/benchmarks.yaml

[warning] 107-173: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

🔇 Additional comments (4)
oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatNetInterfaceFFM.java (1)

26-32: LGTM!

Also applies to: 40-41, 68-99

oshi-core-ffm/src/main/java/oshi/ffm/driver/unix/aix/perfstat/PerfstatProtocolFFM.java (1)

25-31: LGTM!

Also applies to: 39-40, 68-101

.github/workflows/benchmarks.yaml (2)

107-117: Missing explicit GITHUB_TOKEN permissions is still unresolved.


131-167: Remote workspace is still not fully cleaned before packaging.

Comment on lines +132 to +134
git checkout master
git reset --hard HEAD~2
git pull upstream master

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Benchmark job checks out master instead of the dispatched ref.

Lines 132-134 force the AIX run to benchmark upstream/master, while other jobs benchmark the workflow ref. This can produce mixed, non-comparable results in one run.

Suggested fix
-          git checkout master
-          git reset --hard HEAD~2
-          git pull upstream master
+          git fetch https://github.com/${{ github.repository }}.git ${{ github.sha }}
+          git checkout --detach FETCH_HEAD
+          git reset --hard
🤖 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/benchmarks.yaml around lines 132 - 134, The workflow
currently forces the AIX benchmark to use upstream/master by running "git
checkout master", "git reset --hard HEAD~2", and "git pull upstream master";
replace these commands so the job checks out the dispatched workflow ref instead
(use the workflow's ref/SHA), e.g., fetch and checkout the dispatched ref via
the environment variables (GITHUB_REF or GITHUB_SHA) or use actions/checkout
with ref: ${{ github.sha }}; update the block that contains "git checkout
master", "git reset --hard HEAD~2", and "git pull upstream master" to fetch and
checkout the dispatched ref so all jobs benchmark the same commit.

| Both `oshi-core` and `oshi-core-ffm` | &lt;25 or unsupported platform (AIX, DragonFly BSD, NetBSD) | Any | JNA (FFM unavailable) |
| `oshi-core-ffm` only | 25+ | Linux, macOS, Windows, FreeBSD, OpenBSD, Solaris (illumos), AIX | FFM (`oshi.ffm.SystemInfo`) |
| Both `oshi-core` and `oshi-core-ffm` | 25+ | Linux, macOS, Windows, FreeBSD, OpenBSD, Solaris (illumos), AIX | FFM (higher priority) |
| Both `oshi-core` and `oshi-core-ffm` | &lt;25 or unsupported platform (DragonFly BSD, NetBSD) | Any | JNA (FFM unavailable) |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Selection table condition is ambiguous in the JDK/Platform columns.

Line 80 places “unsupported platform (DragonFly BSD, NetBSD)” in the JDK column while Platform says Any. Splitting this into two rows makes the runtime selection rule unambiguous.

Suggested fix
-| Both `oshi-core` and `oshi-core-ffm` | &lt;25 or unsupported platform (DragonFly BSD, NetBSD) | Any | JNA (FFM unavailable) |
+| Both `oshi-core` and `oshi-core-ffm` | &lt;25 | Any | JNA (FFM unavailable) |
+| Both `oshi-core` and `oshi-core-ffm` | 25+ | DragonFly BSD, NetBSD | JNA (FFM unavailable) |
🤖 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 `@src/site/markdown/index.md` at line 80, The table row string "| Both
`oshi-core` and `oshi-core-ffm` | &lt;25 or unsupported platform (DragonFly BSD,
NetBSD) | Any | JNA (FFM unavailable) |" is ambiguous; split it into two rows so
JDK and Platform conditions are explicit: one row with JDK "<25" and Platform
"Any" and the same artifact and note, and a second row with JDK "Any" and
Platform "DragonFly BSD, NetBSD" (artifact and note unchanged). Update the
markdown table in src/site/markdown/index.md accordingly so each condition
appears in its correct column.

@dbwiddis
dbwiddis merged commit ec2ffa6 into oshi:master Jun 7, 2026
36 of 38 checks passed
@dbwiddis
dbwiddis deleted the aix-ffm-port branch June 7, 2026 23:02
dbwiddis added a commit that referenced this pull request Jun 7, 2026
Sweeps the older Unix ports to match the AIX convention established in
#3350. The shared (oshi-common) drivers for BSD, FreeBSD, and Solaris
were sitting at the top-level `oshi.driver.unix.<os>` namespace, which
worked only because the JNA-only drivers in oshi-core happened to live
in disjoint sub-packages (e.g. oshi-core's `oshi.driver.unix.solaris`
holds `PsInfo`/`Who`, oshi-common's `oshi.driver.unix.solaris.disk`
holds `Iostat`/`Lshal`/`Prtvtoc` — different Java packages, no split).
The new convention puts every oshi-common driver under
`oshi.driver.common.unix.<os>[.sub]`, mirroring `oshi.driver.common.mac`
and `oshi.driver.common.windows.*` and avoiding the
top-level-namespace-shared-across-modules fragility.

Moved (oshi-common):
* oshi.driver.unix.bsd.Systat -> oshi.driver.common.unix.bsd.Systat
* oshi.driver.unix.bsd.disk.Disklabel
  -> oshi.driver.common.unix.bsd.disk.Disklabel
* oshi.driver.unix.freebsd.disk.{GeomDiskList,GeomPartList,Mount}
  -> oshi.driver.common.unix.freebsd.disk.*
* oshi.driver.unix.solaris.disk.{Iostat,Lshal,Prtvtoc}
  -> oshi.driver.common.unix.solaris.disk.*
* Tests follow their drivers under
  oshi-common/src/test/java/oshi/driver/common/unix/...

Updated:
* Consumer imports in 8 hardware classes across oshi-common, oshi-core,
  and oshi-core-ffm (FreeBsd/OpenBsd/NetBsd/Solaris HW disk/sensors/
  power source FFM + JNA peers).
* oshi-common module-info.java exports: the four old `oshi.driver.unix.*`
  entries replaced by their `oshi.driver.common.unix.*` equivalents,
  sorted alphabetically.
* oshi-common module-info.test add-opens: matching package renames so
  JUnit Platform can still introspect each test class.
* oshi-core and oshi-core-ffm bnd Export-Package globs: the moved
  packages are now covered by the existing `!oshi.driver.common.*`
  exclude, so the explicit
  `!oshi.driver.unix.{bsd,freebsd.disk,solaris.disk}.*` overrides drop
  out.

Pure refactor — no public API surface changes (everything in the
moved packages was already shared between oshi-common consumers; the
exported package names change but the class names don't). Full
`mvn clean install` green through oshi-dist; bnd manifests show the
new export paths with no leaks of the old paths.
dbwiddis added a commit that referenced this pull request Jun 8, 2026
…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.
dbwiddis added a commit that referenced this pull request Jun 9, 2026
Matches the naming convention established by AIX (#3350), FreeBSD, and
extended to DragonFly today (#3362). The 8 oshi-core OpenBSD classes
(5 hardware, 3 software/os) get a JNA suffix to make the JNA-vs-FFM
split explicit in the file names. The 6 abstract bases in oshi-common
keep their unsuffixed names; the FFM classes in oshi-core-ffm already
have the FFM suffix.

- Rename:
  - OpenBsdComputerSystem.java → OpenBsdComputerSystemJNA.java
  - OpenBsdHardwareAbstractionLayer.java → OpenBsdHardwareAbstractionLayerJNA.java
  - OpenBsdCentralProcessor.java → OpenBsdCentralProcessorJNA.java
  - OpenBsdGlobalMemory.java → OpenBsdGlobalMemoryJNA.java
  - OpenBsdHWDiskStore.java → OpenBsdHWDiskStoreJNA.java
  - OpenBsdFileSystem.java → OpenBsdFileSystemJNA.java
  - OpenBsdOperatingSystem.java → OpenBsdOperatingSystemJNA.java
  - OpenBsdOSProcess.java → OpenBsdOSProcessJNA.java
- Three classes (OpenBsdGlobalMemory, OpenBsdFileSystem, OpenBsdOSProcess)
  previously used `extends oshi.<...>.<unqualified-same-name>` to
  disambiguate from the common base of the same name. With the suffix
  in place the FQN-extends becomes a regular `extends OpenBsdFoo` with
  a normal import — cleaner and matches every other platform.
- oshi-core SystemInfo updated for the two renamed entry points.
- OpenBsdSysctlUtil stays unsuffixed in oshi-core (matches the
  BsdSysctlUtil precedent — the FFM counterpart OpenBsdSysctlUtilFFM
  carries the suffix on the FFM side only).

Tested with `./mvnw clean install` from root (all tests pass).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FFM port: AIX

1 participant