Skip to content

Fix the Linux soft open-file limit when the hard limit is unlimited - #3564

Merged
dbwiddis merged 2 commits into
oshi:masterfrom
dbwiddis:linux-openfile-seam
Aug 2, 2026
Merged

dbwiddis merged 2 commits into
oshi:masterfrom
dbwiddis:linux-openfile-seam

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Extracting a test seam for getProcessOpenFileLimit turned up a bug and a duplicate, so the fix, the dedup and the tests land together.

The bug

LinuxOSProcess guarded the parse with a check on the whole row:

if (line.contains("unlimited")) {
    return -1;
}

That discards both fields whenever either is unlimited. A root process after ulimit -Hn unlimited has:

Max open files            1024                 unlimited            files

and getSoftOpenFileLimit() returned -1 rather than 1024.

/proc/<pid>/limits row soft before / after hard before / after
1024 4096 1024 / 1024 4096 / 4096
1024 unlimited -1 / 1024 -1 / -1
unlimited unlimited -1 / -1 -1 / -1

The guard is also unnecessary for the case it was presumably written for: an all-unlimited row contributes no digits, so split("\\D+") gives ["", ""] and both indices already fall through to -1. Removing it fixes the middle row and changes nothing else.

The duplicate

BsdOSProcess had the same parse without that guard, so it was already correct. The two copies are now one — ProcLimits in oshi.util.driver.unix, alongside the other cross-UNIX command drivers, since /proc/<pid>/limits has the same format on Linux and on the BSDs with a mounted procfs. Neither caller changed signature or visibility; both delegate.

The seam

The parse is split from the file read, so ProcLimitsTest drives it from fixture rows on any OS — no Linux needed. Verified non-vacuous: restoring the old guard fails testHardUnlimitedKeepsSoftLimit, so it is a real regression test rather than a restatement of current behaviour.

Incidental

LinuxOSProcess javadoc claimed soft=0, hard=1. Every caller passes 1 and 2, and splitting a real row yields ["", soft, hard, ""], so 1 and 2 are right — BsdOSProcess already documented it correctly.

Two vestigial NOSONAR comments removed from the Addrinfo try-with-resources in MacNetworkParamsJNA and FreeBsdNetworkParamsJNA. Commit 40e5ee069e shows they were attached to the pre-try-with-resources form, so they suppressed a resource leak that wrapping the statement had already fixed, and have suppressed nothing since.

Verification

Full gate green from clean: install, spotless, checkstyle, forbiddenapis, javadoc, and 1509 tests successful / 0 failed.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed open-file-limit detection on Linux and BSD systems when the hard limit is unlimited but the soft limit remains numeric.
    • Improved handling of missing, empty, or unavailable process limit information.
  • Tests

    • Added coverage for numeric, unlimited, missing, and invalid open-file-limit values.
  • Chores

    • Removed obsolete static-analysis suppression comments and unused code.

Extracting a test seam for getProcessOpenFileLimit turned up a bug and a
duplicate, so all three land together.

LinuxOSProcess guarded the parse with a check on the whole row:

    if (line.contains("unlimited")) {
        return -1;
    }

which discards both fields whenever either one is unlimited. A root
process after `ulimit -Hn unlimited` has a row reading

    Max open files    1024    unlimited    files

and getSoftOpenFileLimit() returned -1 for it rather than 1024. The
guard is also unnecessary for the case it was presumably written for: an
all-unlimited row contributes no digits, so the split is ["", ""] and
both indices already fall through to -1. Removing it fixes the mixed row
and changes nothing else.

BsdOSProcess had the same parse without that guard, so it was already
correct. The two copies are now one: ProcLimits in oshi.util.driver.unix,
alongside the other cross-UNIX command drivers, since /proc/<pid>/limits
has the same format on Linux and on the BSDs with a mounted procfs.
Neither caller's signature or visibility changed; both delegate.

The parse is split from the file read, so ProcLimitsTest can drive it
from fixture rows on any OS. Restoring the old guard fails
testHardUnlimitedKeepsSoftLimit, so it is a real regression test rather
than a restatement.

LinuxOSProcess's javadoc claimed soft=0, hard=1. Every caller passes 1
and 2, and splitting a real row on \D+ yields ["", soft, hard, ""], so
1 and 2 are right; BsdOSProcess already documented it correctly.

Also drops two vestigial NOSONAR comments on the Addrinfo
try-with-resources in MacNetworkParamsJNA and FreeBsdNetworkParamsJNA.
Commit 40e5ee0 shows they were attached to the pre-try-with-resources
form, so the suppression was for a resource leak that wrapping the
statement had already fixed; they have suppressed nothing since.
@coderabbitai

coderabbitai Bot commented Aug 2, 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 Plus

Run ID: 9b93383a-e683-41c6-92f0-fc2fa1d073af

📥 Commits

Reviewing files that changed from the base of the PR and between eb4f316 and 3e08d9e.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/util/driver/unix/ProcLimits.java
  • oshi-common/src/test/java/oshi/util/driver/unix/ProcLimitsTest.java
🚧 Files skipped from review as they are similar to previous changes (4)
  • CHANGELOG.md
  • oshi-common/src/test/java/oshi/util/driver/unix/ProcLimitsTest.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/util/driver/unix/ProcLimits.java
📜 Recent review details
⏰ Context from checks skipped due to timeout. (11)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 26, ubuntu-latest
  • GitHub Check: Test JDK 21, ubuntu-latest
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Analyze (java)

📝 Walkthrough

Walkthrough

The change centralizes Linux and BSD open-file-limit parsing in ProcLimits, adds parser tests, records the fix in the changelog, and removes two NOSONAR comments from network resource declarations.

Changes

Open-file limit handling

Layer / File(s) Summary
Shared limit parser and validation
oshi-common/src/main/java/oshi/util/driver/unix/ProcLimits.java, oshi-common/src/test/java/oshi/util/driver/unix/ProcLimitsTest.java
ProcLimits reads and parses open-file limits. Tests cover numeric, unlimited, missing, and invalid inputs.
Process limit integration
oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java, oshi-common/src/main/java/oshi/software/common/os/unix/bsd/BsdOSProcess.java, CHANGELOG.md
Linux and BSD process classes delegate open-file-limit queries to ProcLimits. The changelog records the Linux fix.

Network resource declaration cleanup

Layer / File(s) Summary
Addrinfo declaration cleanup
oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java, oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.java
Removed NOSONAR comments from Addrinfo resource declarations. Runtime behavior is unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OSProcess
  participant ProcLimits
  participant Procfs
  OSProcess->>ProcLimits: queryOpenFileLimit(processId, index)
  ProcLimits->>Procfs: read /proc/<pid>/limits
  Procfs-->>ProcLimits: limit lines
  ProcLimits-->>OSProcess: numeric limit or -1
Loading

Possibly related PRs

  • oshi/oshi#3465: Both changes modify BSD open-file-limit handling.
  • oshi/oshi#3499: Both changes add dedicated Unix parsing utilities and parser tests.

Poem

A rabbit reads limits in /proc today,
Soft values remain when hard ones say “unlimited.”
Linux and BSD share the parsing track,
Two NOSONAR comments quietly step back.
Hop, hop—clean limits return!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing Linux soft open-file limit parsing when the hard limit is unlimited.
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 Aug 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.25000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.37%. Comparing base (5269d90) to head (3e08d9e).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...rc/main/java/oshi/util/driver/unix/ProcLimits.java 66.66% 4 Missing ⚠️
.../oshi/software/common/os/linux/LinuxOSProcess.java 0.00% 1 Missing ⚠️
...oshi/software/common/os/unix/bsd/BsdOSProcess.java 0.00% 1 Missing ⚠️
...tware/os/unix/freebsd/FreeBsdNetworkParamsJNA.java 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (56.25%) 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    #3564      +/-   ##
============================================
+ Coverage     79.36%   79.37%   +0.01%     
- Complexity     4038     4160     +122     
============================================
  Files           706      707       +1     
  Lines         24293    24280      -13     
  Branches       4065     4061       -4     
============================================
- Hits          19279    19272       -7     
+ Misses         2820     2811       -9     
- Partials       2194     2197       +3     
Flag Coverage Δ
freebsd 32.84% <50.00%> (+0.05%) ⬆️
linux 36.81% <50.00%> (+0.07%) ⬆️
macos 37.74% <56.25%> (+0.01%) ⬆️
openbsd 31.95% <50.00%> (+0.05%) ⬆️
solaris 33.35% <50.00%> (+0.08%) ⬆️
windows 44.65% <50.00%> (+0.04%) ⬆️

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.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java (1)

484-492: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the Javadoc index values.

The callers pass 1 for the soft limit and 2 for the hard limit. Change soft=0, hard=1 to soft=1, hard=2.

Based on the PR objective, this Javadoc must describe the current shared parser contract.

🤖 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/software/common/os/linux/LinuxOSProcess.java`
around lines 484 - 492, Update the Javadoc for
LinuxOSProcess.getProcessOpenFileLimit to document the shared parser contract
accurately: state that index 1 is the soft limit and index 2 is the hard limit,
leaving the method implementation unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@oshi-common/src/main/java/oshi/util/driver/unix/ProcLimits.java`:
- Around line 62-65: Update the index validation in the relevant ProcLimits
parsing helper to return -1 when index is less than 1, before accessing
split[index]. Preserve the existing out-of-range handling and add a fixture
assertion covering a negative index.

---

Outside diff comments:
In `@oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java`:
- Around line 484-492: Update the Javadoc for
LinuxOSProcess.getProcessOpenFileLimit to document the shared parser contract
accurately: state that index 1 is the soft limit and index 2 is the hard limit,
leaving the method implementation unchanged.
🪄 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 Plus

Run ID: 0b82e475-63b8-4195-ba5a-f413882a666d

📥 Commits

Reviewing files that changed from the base of the PR and between 5269d90 and eb4f316.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/bsd/BsdOSProcess.java
  • oshi-common/src/main/java/oshi/util/driver/unix/ProcLimits.java
  • oshi-common/src/test/java/oshi/util/driver/unix/ProcLimitsTest.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.java
📜 Review details
⏰ Context from checks skipped due to timeout. (11)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Analyze (java)
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 21, ubuntu-latest
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 26, ubuntu-latest
🧰 Additional context used
📓 Path-based instructions (5)
oshi-common/src/main/java/**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

oshi-common/src/main/java/**/*.java: Keep oshi-common pure Java 8 with no JNA, FFM, or native library loading references; shared parsing, conversion, filtering, caching, and validation logic belongs here rather than duplicated in implementation modules.
Use oshi.util.ParseUtil methods instead of banned numeric parsing APIs such as Integer.parseInt, Long.parseLong, Double.parseDouble, and Integer.decode.

Files:

  • oshi-common/src/main/java/oshi/util/driver/unix/ProcLimits.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/bsd/BsdOSProcess.java
**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

**/*.java: Do not use org.slf4j.event.**; use oshi.util.LogLevel instead.
Add the imports needed by code, and let Spotless own formatting and import ordering.
Verify native struct offsets, field widths, and sysctl/ioctl constants against the target operating system's real headers rather than inferring them from another OS.

Files:

  • oshi-common/src/main/java/oshi/util/driver/unix/ProcLimits.java
  • oshi-common/src/test/java/oshi/util/driver/unix/ProcLimitsTest.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/bsd/BsdOSProcess.java
**/src/main/java/**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

**/src/main/java/**/*.java: Every public member must have Javadoc, and code and Javadoc—including {@link ...}—must use imported simple class names rather than fully qualified names.
New classes should declare an appropriate concurrency annotation from oshi.annotation.concurrent, matching the modeled class when applicable.
Memoize constant or expensive, slowly changing system-call results with oshi.util.Memoizer, following surrounding patterns and using defaultExpiration() when values must refresh.
Place reusable per-OS acquisition and parsing helpers in oshi/driver/<os>/; keep parsing logic out of HAL classes where practical.
Prefer native calls for system information; on Linux prefer FileUtil for /proc and /sys, while on other platforms ExecutingCommand is acceptable when native APIs do not expose the information.
Do not commit generated output, target/, or IDE files.

Files:

  • oshi-common/src/main/java/oshi/util/driver/unix/ProcLimits.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/bsd/BsdOSProcess.java
**/src/test/java/**/*Test.java

📄 CodeRabbit inference engine (AGENTS.md)

**/src/test/java/**/*Test.java: Use JUnit 5 and Hamcrest; do not add Mockito. Extract parsing into methods accepting fixture data such as List<String> or String, and test those methods separately from acquisition.
Assert hardware-independent invariants such as non-null values, types, ordering, and plausible ranges rather than specific hardware values; allow zero and empty results.
Avoid timing-sensitive assertions comparing live readings, including CPU frequency, tick counters, and uptime.
Do not assume platform-specific hardware exists; tests must tolerate absent batteries, sensors, GPUs, sound cards, and processors.

Files:

  • oshi-common/src/test/java/oshi/util/driver/unix/ProcLimitsTest.java
oshi-core/src/main/java/**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

oshi-core/src/main/java/**/*.java: oshi-core must compile with Java 8; do not use modern features such as var, records, switch expressions, text blocks, List.of, or Stream.toList().
Behavior changes in JNA implementation classes should also be applied equivalently to their corresponding FFM twins, unless the difference is intentionally specific to JNA or FFM.

Files:

  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.java
🧠 Learnings (4)
📚 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/util/driver/unix/ProcLimits.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/bsd/BsdOSProcess.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/util/driver/unix/ProcLimits.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/bsd/BsdOSProcess.java
📚 Learning: 2026-07-30T00:35:22.638Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3547
File: oshi-common/src/main/java/oshi/hardware/common/platform/unix/BsdFirmware.java:82-82
Timestamp: 2026-07-30T00:35:22.638Z
Learning: In OSHI, treat changes as “API-breaking” only when they affect classes (or relevant API surface) annotated with `PublicAPI`. Public classes/members that are not annotated with `PublicAPI` should be reviewed as internal implementation details, even if they are public (e.g., classes like `oshi.hardware.common.platform.unix.BsdFirmware`). Also, respect intentional visibility decisions used for tests—e.g., methods like `BsdFirmware.parseDmesg(List<String>)` may be intentionally package-private to support tests within the same package; avoid widening visibility or altering signatures unless the related `PublicAPI` contract requires it.

Applied to files:

  • oshi-common/src/main/java/oshi/util/driver/unix/ProcLimits.java
  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.java
  • oshi-common/src/main/java/oshi/software/common/os/linux/LinuxOSProcess.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/bsd/BsdOSProcess.java
📚 Learning: 2026-04-06T04:45:47.644Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:47.644Z
Learning: In the oshi/oshi project, only interfaces and classes in the root packages `oshi`, `oshi.hardware`, and `oshi.software.os` are considered the public API. Code in subpackages that represent specific implementations/platforms (e.g., `oshi.software.os.linux`, `oshi.hardware.platform.linux`, and similar subpackages) is implementation detail. When reviewing, do not treat changes to classes in these platform-specific subpackages as public API breaks (for example: making `LinuxOperatingSystem` abstract, narrowing constructor visibility, or adding/removing abstract methods should not be flagged as breaking public API).

Applied to files:

  • oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java
  • oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.java
🔇 Additional comments (4)
oshi-core/src/main/java/oshi/software/os/mac/MacNetworkParamsJNA.java (1)

56-56: LGTM!

oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParamsJNA.java (1)

46-46: LGTM!

oshi-common/src/main/java/oshi/software/common/os/unix/bsd/BsdOSProcess.java (1)

23-23: LGTM!

Also applies to: 339-339

CHANGELOG.md (1)

5-5: LGTM!

CodeRabbit review. All three findings verified and valid.

parseOpenFileLimit guarded only the upper bound, so a negative index
passed split.length <= index and then indexed the array out of bounds.
That was unreachable while the method was protected and both call sites
passed 1 or 2, but it is public API on a utility class now, so the guard
belongs here rather than in the callers. Element 0 is the empty string
left of the "Max open files" label, so 1 is the lowest usable index.

testIndexBelowTheFirstField covers index 0 and -1; removing the guard
fails it with ArrayIndexOutOfBoundsException, so it is a real check.

LinuxOSProcess.getProcessOpenFileLimit still carried the wrong javadoc,
soft=0 and hard=1, that this branch corrected on the shared parser. Both
now say 1 for soft and 2 for hard.

The CHANGELOG entry moves to the end of the list so the entries stay in
PR order.
@dbwiddis
dbwiddis merged commit e5cc7f7 into oshi:master Aug 2, 2026
16 checks passed
@dbwiddis
dbwiddis deleted the linux-openfile-seam branch August 2, 2026 23:26
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