Skip to content

Solaris: extract prtpicl, prtconf USB, svcs, and plimit/pbind parsers - #3498

Merged
dbwiddis merged 2 commits into
oshi:masterfrom
dbwiddis:solaris-prt-svcs-extractions
Jul 20, 2026
Merged

dbwiddis merged 2 commits into
oshi:masterfrom
dbwiddis:solaris-prt-svcs-extractions

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Jul 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Extract remaining Solaris-specific command parsers into testable static methods, continuing the coverage work from Solaris: extract testable parse methods from command readers #3497
  • Covers prtpicl (sensors), prtconf -pv (USB device tree), svcs -p (services), plimit (file descriptor limits), and pbind/psrinfo (process affinity)
  • Cross-OS commands (df/mount, iostat, route) deferred to their respective sweeps

Test plan

Summary by CodeRabbit

  • Improvements
    • Enhanced Solaris hardware monitoring for CPU temperature, fan speeds, voltage, and USB device details with more robust output parsing.
    • Improved Solaris process reporting for CPU affinity and open-file limits, including better handling of empty or unexpected command output.
    • Improved Solaris service detection and status reporting via clearer parsing of svcs output and legacy service mappings.
  • Tests
    • Added/expanded JUnit coverage for Solaris sensor, USB, process, and service parsing, including empty, alternate formatting, and malformed output cases.

Extract remaining Solaris-specific command parsers into testable static
methods, continuing the coverage work from #3497.

Extractions:
- SolarisSensors: parseCpuTemperature, parseFanSpeeds, parseVoltage
  (prtpicl -v -c temperature-sensor/fan/voltage-sensor)
- SolarisUsbDevice: parsePrtconf (prtconf -pv USB device tree)
- SolarisOperatingSystem: parseSvcs (svcs -p service enumeration)
- SolarisOSProcess: parseOpenFileLimit (plimit), parsePbindOutput
  (pbind -q), parsePsrinfo (psrinfo processor enumeration)
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3ae443f7-0ff4-45e7-9963-f09bc90bd818

📥 Commits

Reviewing files that changed from the base of the PR and between 258c8b3 and 28ec071.

📒 Files selected for processing (1)
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java
📜 Recent review details
⏰ Context from checks skipped due to timeout. (13)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 26, windows-latest
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Test JDK 26, macos-latest
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Analyze (java)

📝 Walkthrough

Walkthrough

Solaris hardware, process, USB, and service collectors now separate native command execution from output parsing. New JUnit tests cover normal, empty, malformed, and alternate Solaris command-output formats.

Changes

Solaris parser extraction

Layer / File(s) Summary
Sensor output parsing
oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java, oshi-common/src/test/.../solaris/SolarisSensorsTest.java
Sensor queries capture prtpicl output and pass it to temperature, fan-speed, and voltage parsers, with unit tests for supported and empty inputs.
USB tree parsing
oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDevice.java, oshi-common/src/test/.../solaris/SolarisUsbDeviceTest.java
USB discovery passes captured prtconf -pv lines to the parser, with tests for USB controllers, child devices, alternate identification, and exclusions.
Process command parsing
oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOSProcess.java, oshi-common/src/test/.../solaris/SolarisOSProcessTest.java
Affinity and open-file limit parsing use dedicated helpers for pbind, psrinfo, and plimit output, with edge-case coverage.
Service output parsing
oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystem.java, oshi-common/src/test/.../solaris/SolarisOperatingSystemTest.java
Service collection delegates svcs -p and legacy service parsing to parseSvcs, with tests for states, names, PIDs, and empty or unmatched input.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Poem

I’m a rabbit with parsers neat,
Native lines now hop in one stream.
Sensors, USB, services too,
Process masks know what to do.
Tests guard each Solaris dream!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main Solaris parser extraction work and names the core commands affected by the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.20%. Comparing base (9569fff) to head (28ec071).

Files with missing lines Patch % Lines
...tware/common/os/unix/solaris/SolarisOSProcess.java 78.57% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3498      +/-   ##
============================================
+ Coverage     76.00%   76.20%   +0.20%     
  Complexity       76       76              
============================================
  Files           591      591              
  Lines         21676    21679       +3     
  Branches       3612     3611       -1     
============================================
+ Hits          16474    16521      +47     
+ Misses         3247     3207      -40     
+ Partials       1955     1951       -4     
Flag Coverage Δ
freebsd 31.39% <62.50%> (+0.51%) ⬆️
linux 35.52% <62.50%> (+0.52%) ⬆️
macos 36.66% <62.50%> (+0.47%) ⬆️
openbsd 30.35% <62.50%> (+0.51%) ⬆️
solaris 32.16% <87.50%> (+0.21%) ⬆️
windows 44.63% <62.50%> (+0.55%) ⬆️

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.

@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.

🧹 Nitpick comments (1)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java (1)

61-74: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove stale comment and simplify array conversion.

The comment // Return max found temp appears to be accidentally copied from parseCpuTemperature. Additionally, the manual list population and array conversion can be simplified by leveraging Java 8 streams.

♻️ Proposed refactor
     static int[] parseFanSpeeds(List<String> prtpicl) {
-        List<Integer> speedList = new ArrayList<>();
-        // Return max found temp
-        for (String line : prtpicl) {
-            if (line.trim().startsWith("Speed:")) {
-                speedList.add(ParseUtil.parseLastInt(line, 0));
-            }
-        }
-        int[] fans = new int[speedList.size()];
-        for (int i = 0; i < speedList.size(); i++) {
-            fans[i] = speedList.get(i);
-        }
-        return fans;
+        return prtpicl.stream()
+                .filter(line -> line.trim().startsWith("Speed:"))
+                .mapToInt(line -> ParseUtil.parseLastInt(line, 0))
+                .toArray();
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java`
around lines 61 - 74, In parseFanSpeeds, remove the stale “max found temp”
comment and replace the manual speedList-to-array loop with a Java 8
stream-based conversion, preserving the existing parsed fan speed order and
returned int[] behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java`:
- Around line 61-74: In parseFanSpeeds, remove the stale “max found temp”
comment and replace the manual speedList-to-array loop with a Java 8
stream-based conversion, preserving the existing parsed fan speed order and
returned int[] behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3693b02e-9a06-4568-b9c2-997328827cdc

📥 Commits

Reviewing files that changed from the base of the PR and between 9569fff and 258c8b3.

📒 Files selected for processing (8)
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDevice.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOSProcess.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystem.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/solaris/SolarisSensorsTest.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDeviceTest.java
  • oshi-common/src/test/java/oshi/software/common/os/unix/solaris/SolarisOSProcessTest.java
  • oshi-common/src/test/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystemTest.java
📜 Review details
⏰ Context from checks skipped due to timeout. (13)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 26, macos-latest
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 26, windows-latest
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDevice.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystem.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOSProcess.java
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDevice.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystem.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOSProcess.java
🔇 Additional comments (8)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisSensors.java (1)

23-48: LGTM!

Also applies to: 78-96

oshi-common/src/test/java/oshi/hardware/common/platform/unix/solaris/SolarisSensorsTest.java (1)

18-69: LGTM!

oshi-common/src/main/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDevice.java (1)

40-55: LGTM!

oshi-common/src/test/java/oshi/hardware/common/platform/unix/solaris/SolarisUsbDeviceTest.java (1)

22-80: LGTM!

oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOSProcess.java (1)

95-111: LGTM!

Also applies to: 128-145, 230-244

oshi-common/src/test/java/oshi/software/common/os/unix/solaris/SolarisOSProcessTest.java (1)

18-80: LGTM!

oshi-common/src/main/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystem.java (1)

145-168: LGTM!

oshi-common/src/test/java/oshi/software/common/os/unix/solaris/SolarisOperatingSystemTest.java (1)

23-78: LGTM!

@dbwiddis
dbwiddis merged commit 8fe537d into oshi:master Jul 20, 2026
19 checks passed
@dbwiddis
dbwiddis deleted the solaris-prt-svcs-extractions branch July 20, 2026 22:12
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.

1 participant