Repository navigation
Add DragonFly BSD platform support - #3303
Conversation
- Replace thr_self() with lwp_gettid() for thread ID retrieval - Replace KERN_PROC_ENV sysctl with /proc/<pid>/environ for environment variables (DragonFly lacks FreeBSD's kern.proc.env)
- Remove unsupported ps keywords (systime, majflt, minflt, nvcsw, nivcsw) that caused column misalignment - Switch etimes -> etime (DragonFly uses formatted elapsed time) - Use /proc/<pid>/cmdline for process arguments instead of KERN_PROC_ARGS sysctl (different MIB numbers on DragonFly) - Simplify thread columns to LWP, STATE, ETIME, TIME, PRI - Replace procstat (FreeBSD-only) with /proc and fstat fallback - Downgrade kern.cp_times sysctl failure to debug level
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (30)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (6)
🚧 Files skipped from review as they are similar to previous changes (23)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
📝 WalkthroughWalkthroughAdds DragonFly BSD platform: SystemInfo routing, DragonFly libc loader, HAL and CentralProcessor, DragonFly OS/process/thread implementations, procstat utilities; reuses and refactors FreeBSD components; updates CI, properties, JaCoCo, docs, module export, and tests. ChangesDragonFlyBSD Platform Support
BsdLibcLoader & FreeBSD refactors
DragonFlyBSD libc, HAL & processor
DragonFlyBSD OS, process, thread & procstat utils
Tests
Sequence Diagram(s) sequenceDiagram
participant Caller as Caller
participant SystemInfo as SystemInfo
participant DragonOS as DragonFlyBsdOperatingSystem
participant Libc as DragonFlyBsdLibc
Caller->>SystemInfo: request OS/hardware
SystemInfo->>DragonOS: createOperatingSystem()
DragonOS->>Libc: sysctl(kern.boottime) / getpid() / lwp_gettid()
DragonOS->>Caller: return OSProcess/OSThread objects
Estimated code review effort 🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3303 +/- ##
============================================
- Coverage 76.09% 76.08% -0.01%
Complexity 76 76
============================================
Files 410 410
Lines 15830 15832 +2
Branches 2546 2546
============================================
Hits 12046 12046
- Misses 2284 2285 +1
- Partials 1500 1501 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 18
🤖 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/unix.yaml:
- Around line 152-155: Replace tag-based action refs with immutable, pinned
revisions for both the checkout action and the DragonFly VM action: change uses:
actions/checkout@v6 and uses: vmactions/dragonflybsd-vm@v1 to their specific
commit SHAs (or fully qualified refs) to avoid mutable tags, and in the checkout
step (the action referenced by actions/checkout) set persist-credentials: false
to prevent leaking the workflow token to subsequent steps; locate the checkout
usage and the step with id test-dragonflybsd / vmactions/dragonflybsd-vm to make
these edits.
In
`@oshi-core/src/main/java/oshi/driver/unix/dragonflybsd/disk/GeomPartList.java`:
- Around line 58-67: When encountering a new disk header in GeomPartList (line
handling "Geom name:"), any active partition referenced by partName must be
flushed into partList before switching diskName; update the logic in the block
that processes "Geom name:" to check if partName != null and not empty and then
add the current partition object/data to partList (same approach used elsewhere)
before putting partList into partitionMap and resetting partList and diskName.
Apply the same flush-before-switch behavior to the other branch that handles
partition boundaries (the code around the "Name:" handling at the 74-81 area) so
the last partition of the previous disk is never lost or assigned to the next
disk.
In `@oshi-core/src/main/java/oshi/driver/unix/dragonflybsd/disk/Mount.java`:
- Line 22: The current MOUNT_PATTERN constant is too restrictive by forcing
device names to match "\S+p\d+" and misses other valid partition naming schemes;
update the Pattern in the Mount class (MOUNT_PATTERN) to capture any non-space
device component (for example "/dev/(\S+) on (\S+) .*") so device paths like
/dev/ada0p1, /dev/da0s1a, or other variants are all matched and downstream
partition mount points are populated correctly.
In
`@oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java`:
- Around line 114-116: The regex strings in DragonFlyBsdCentralProcessor
(variables normal and hybrid) are over-escaped so they don’t match
digits/spaces; update Pattern.compile("cpu(\\\\d+): (.+) on .*") to
Pattern.compile("cpu(\\d+): (.+) on .*") and Pattern.compile("CPU\\\\s*(\\\\d+):
(.+) affinity:.*") to Pattern.compile("CPU\\s*(\\d+): (.+) affinity:.*"); make
the analogous fixes in FreeBsdCentralProcessor where the same over-escaping
occurs so dmesg parsing yields numeric CPU IDs and
createProcListFromDmesg(logProcs, dmesg) can produce physical processor data.
In
`@oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdGraphicsCard.java`:
- Around line 57-85: When starting a new device block in the parsing loop (the
branch that checks line.contains("class=0x")), reset per-device fields
productId, vendorId, versionInfo and classCode (and name if needed) to
Constants.UNKNOWN (or empty string as existing pattern expects) before
splitting/parsing the header so values from the previous device don’t carry
over; update the code around the parsing in DragonFlyBsdGraphicsCard (the block
that populates classCode, productId, vendorId, versionInfo and sets name) to
initialize those variables at the start of the new-device branch prior to the
ParseUtil.whitespaces.split loop.
In
`@oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdPowerSource.java`:
- Around line 50-52: getPowerSources() currently always returns a single
fabricated PowerSource by calling getPowerSource("BAT0"); change it to detect
when no battery exists and return an empty list instead. Specifically: update
getPowerSource(String) (the implementation around lines 54-90) to return null
when it cannot find or parse real battery data, and update getPowerSources() to
call getPowerSource("BAT0") and return Collections.emptyList() (or
Arrays.asList()) only when the result is non-null — otherwise return an empty
list. Ensure callers still get a non-null List but no fake BAT0 entry when there
is no battery.
In
`@oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdSoundCard.java`:
- Around line 67-69: The loop building DragonFlyBsdSoundCard entries can pass
nulls from productMap.get(s) and vendorMap.get(s), producing "null ..." names;
update the loop that constructs DragonFlyBsdSoundCard (the sounds iteration
where soundCards.add is called) to guard against missing entries by substituting
safe defaults (e.g., product = productMap.get(s) != null ? productMap.get(s) :
"Unknown", vendor = vendorMap.get(s) != null ? vendorMap.get(s) : "") and then
build the display name from those defaults (avoid concatenating "null"). Ensure
you use these defaulted vendor and product variables when calling the
DragonFlyBsdSoundCard constructor.
In
`@oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdUsbDevice.java`:
- Line 125: The line hubMap.put(parent, hubMap.get(usbus)) can store null when
usbus has no entry; change it to always put a non-null list for parent by
retrieving a default empty collection when usbus is absent and wrapping that in
a new mutable list before storing (so hubMap.getOrDefault(devPath, ...) later
never returns null and iterating childPaths cannot NPE); update the statement
that writes to hubMap (referencing hubMap, parent, usbus) accordingly and ensure
you use Collections.emptyList() or equivalent as the default and copy it into a
new ArrayList to avoid shared mutable state.
In
`@oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.java`:
- Around line 2-7: Update the package Javadoc in package-info.java for the
oshi.hardware.platform.unix.dragonflybsd package: replace the phrase "FreeBSD
systems" with "DragonFly BSD systems" (or "DragonFlyBSD systems") so the comment
accurately reflects the DragonFlyBSD platform; edit the top-level Javadoc block
in package-info.java to mention DragonFlyBSD and keep the rest of the
description intact.
In
`@oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdFileSystem.java`:
- Around line 113-117: The code builds a mount basename into variable "name"
from the mount path but then uses that "name" to look up UUIDs in uuidMap, which
is keyed by device names from "geom part list"; change the lookup to use a
device-derived key instead: derive deviceName from "volume" (e.g., substring
after last '/' of volume) and use that deviceName for uuidMap.get(...) when
resolving UUIDs in DragonFlyBsdFileSystem; keep existing fallback for root
mounts only for display/name, but ensure the uuid lookup always uses the
device-derived key (reference variables: name, volume and map uuidMap in class
DragonFlyBsdFileSystem).
- Around line 81-82: The inode maps are keyed by the wrong token when parsing
`df -i`: inodeFreeMap.put(split[0], ...) and inodeTotalMap.put(split[0], ...)
use the device token but later code looks up by mount path
(inodeFreeMap.get(mount) / inodeTotalMap.get(mount)), causing mismatches; update
the parsing code in DragonFlyBsdFileSystem.java to use the same key used during
mount assembly (the mount path variable, e.g., `mount` or `mountPath`) when
calling inodeFreeMap.put and inodeTotalMap.put so lookups (in the block that
reads inodeFreeMap.get(mount) and inodeTotalMap.get(mount)) return the correct
values.
In
`@oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdInternetProtocolStats.java`:
- Around line 42-43: The aggregation of TCP counters in
DragonFlyBsdInternetProtocolStats currently adds int fields (e.g.,
tcp.tcps_rcvbadsum + tcp.tcps_rcvbadoff + tcp.tcps_rcvmemdrop +
tcp.tcps_rcvshort) and only then calls ParseUtil.unsignedIntToLong, risking
32-bit overflow; fix by converting each counter to long/unsigned long first
(call ParseUtil.unsignedIntToLong on each tcp.* field) and then sum the
resulting longs (same change for the other occurrence around tcp.* fields at the
second aggregation), ensuring you use
ParseUtil.unsignedIntToLong(tcp.tcps_rcvbadsum) +
ParseUtil.unsignedIntToLong(tcp.tcps_rcvbadoff) + ... so all additions occur as
long arithmetic.
In
`@oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdNetworkParams.java`:
- Around line 46-49: getDomainName() currently trims info.ai_canonname inside
the try-with-resources and calls LIBC.freeaddrinfo(ptr.getValue()) afterward,
which will throw if ai_canonname is null and skip freeing the native addrinfo;
change the logic to first capture ai_canonname from Addrinfo safely (e.g.,
String canonname = info.ai_canonname == null ? "" : info.ai_canonname.trim())
and ensure LIBC.freeaddrinfo(ptr.getValue()) is always invoked (move the
freeaddrinfo call into a finally block or after the try-with-resources with
guaranteed execution) so Addrinfo/ptr.getValue() is freed on all paths while
preserving the returned canonname.
In
`@oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java`:
- Line 76: The code in DragonFlyBsdOperatingSystem sets family using
BsdSysctlUtil.sysctl("kern.ostype", "FreeBSD"), which can misreport DragonFly
systems; update the fallback value used in the BsdSysctlUtil.sysctl call to a
DragonFly-specific string (e.g., "DragonFly") so the variable family in
DragonFlyBsdOperatingSystem reflects the correct OS when sysctl lookup fails.
In
`@oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.java`:
- Around line 440-442: The code in DragonFlyBsdOSProcess that splits
maxOpenFilesLine and calls ParseUtil.parseLongOrDefault(split[index], -1) can
throw ArrayIndexOutOfBoundsException when the line contains non-numeric tokens
like "unlimited"; update the method to guard the indexed access by verifying
split.length > index and that split[index] is non-empty before calling
ParseUtil.parseLongOrDefault, and if the check fails return -1; apply this
change around the existing maxOpenFilesLine, split, index and
ParseUtil.parseLongOrDefault usage so the method returns -1 for missing or
non-numeric tokens instead of throwing.
In
`@oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/BsdSysctlUtil.java`:
- Around line 19-21: The class Javadoc incorrectly mentions "FreeBSD" for the
DragonFlyBSD-specific class; update the Javadoc comment on class BsdSysctlUtil
to reference "DragonFlyBSD" (or a neutral term like "BSD/DragonFly") instead of
"FreeBSD" so generated docs correctly reflect the platform; locate the Javadoc
block immediately above the BsdSysctlUtil class declaration and revise its
description accordingly.
In
`@oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.java`:
- Around line 5-8: The package Javadoc in package-info.java incorrectly says
“FreeBSD”; update the comment for the package
oshi.util.platform.unix.dragonflybsd to correctly describe DragonFly BSD (e.g.,
"Provides utilities for DragonFly BSD" or "Utilities for DragonFly BSD") so the
Javadoc matches the package name and intent (edit the Javadoc block at the top
of package-info.java).
In
`@oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.java`:
- Around line 36-44: The implementation of ProcstatUtil.getCwdMap currently only
handles pid >= 0 but the Javadoc says negative pid should mean "all processes";
update getCwdMap to handle pid < 0 by iterating over all process IDs and
populating the map: for each pid from the system-wide PID list (use the existing
method that returns all PIDs, e.g., getAllPids() or the project's PID-listing
utility) call ProcstatUtil.getCwd(pid) and, when non-empty, put it into cwdMap;
preserve the existing single-pid path (calling getCwd(pid)) and make sure to
swallow/handle any per-pid errors so a failure on one process doesn’t abort the
whole map population.
🪄 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: 36070914-8d75-4770-aa0c-7694d754fb9a
📒 Files selected for processing (38)
.github/workflows/unix.yamloshi-common/src/main/resources/oshi.propertiesoshi-core/src/main/java/module-info.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core/src/main/java/oshi/driver/unix/dragonflybsd/Who.javaoshi-core/src/main/java/oshi/driver/unix/dragonflybsd/disk/GeomDiskList.javaoshi-core/src/main/java/oshi/driver/unix/dragonflybsd/disk/GeomPartList.javaoshi-core/src/main/java/oshi/driver/unix/dragonflybsd/disk/Mount.javaoshi-core/src/main/java/oshi/driver/unix/dragonflybsd/disk/package-info.javaoshi-core/src/main/java/oshi/driver/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdComputerSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdFirmware.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdGlobalMemory.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdGraphicsCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHWDiskStore.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdPowerSource.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdSensors.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdSoundCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdUsbDevice.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdVirtualMemory.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/jna/platform/unix/DragonFlyBsdLibc.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdFileSystem.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdInternetProtocolStats.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdNetworkParams.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSFileStore.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/BsdSysctlUtil.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.javaoshi-core/src/test/java/oshi/hardware/platform/shared/CentralProcessorTest.javaoshi-core/src/test/java/oshi/software/os/shared/OperatingSystemTest.javapom.xml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 21, windows-latest
- GitHub Check: Test JDK 11, windows-latest
- GitHub Check: Analyze (java)
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: JMH Benchmarks, ubuntu-latest
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 11, macos-latest
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-04-06T04:45:47.644Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:47.644Z
Learning: In the oshi/oshi project, only interfaces and classes in the root packages `oshi`, `oshi.hardware`, and `oshi.software.os` are considered the public API. Code in subpackages that represent specific implementations/platforms (e.g., `oshi.software.os.linux`, `oshi.hardware.platform.linux`, and similar subpackages) is implementation detail. When reviewing, do not treat changes to classes in these platform-specific subpackages as public API breaks (for example: making `LinuxOperatingSystem` abstract, narrowing constructor visibility, or adding/removing abstract methods should not be flagged as breaking public API).
Applied to files:
oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdInternetProtocolStats.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdSoundCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdComputerSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdSensors.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdGlobalMemory.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdNetworkParams.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdFileSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdUsbDevice.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdFirmware.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSFileStore.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdGraphicsCard.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdPowerSource.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdVirtualMemory.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHWDiskStore.java
🪛 zizmor (1.25.2)
.github/workflows/unix.yaml
[warning] 152-152: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 152-152: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
[error] 155-155: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🔇 Additional comments (14)
oshi-common/src/main/resources/oshi.properties (1)
268-270: LGTM!oshi-core/src/main/java/module-info.java (1)
26-26: LGTM!oshi-core/src/main/java/oshi/SystemInfo.java (1)
16-16: LGTM!Also applies to: 25-25, 128-129, 161-162
oshi-core/src/main/java/oshi/jna/platform/unix/DragonFlyBsdLibc.java (1)
1-105: LGTM!oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSFileStore.java (1)
24-34: LGTM!oshi-core/src/main/java/oshi/driver/unix/dragonflybsd/Who.java (1)
38-63: LGTM!oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.java (1)
44-169: LGTM!oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.java (1)
1-8: LGTM!oshi-core/src/test/java/oshi/hardware/platform/shared/CentralProcessorTest.java (1)
166-166: LGTM!oshi-core/src/test/java/oshi/software/os/shared/OperatingSystemTest.java (1)
130-134: LGTM!Also applies to: 422-426
pom.xml (1)
822-822: LGTM!Also applies to: 828-828
oshi-core/src/main/java/oshi/driver/unix/dragonflybsd/disk/GeomDiskList.java (1)
33-77: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHWDiskStore.java (1)
37-107: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.java (1)
33-91: LGTM!
| - uses: actions/checkout@v6 | ||
| - name: Test in DragonFly BSD | ||
| id: test-dragonflybsd | ||
| uses: vmactions/dragonflybsd-vm@v1 |
There was a problem hiding this comment.
Pin action revisions and disable checkout credential persistence.
Line 152 and Line 155 use tag-based action refs (@v6, @v1) and actions/checkout keeps credentials by default. That weakens supply-chain guarantees and can leak token scope into later steps.
Suggested hardening
- - uses: actions/checkout@v6
+ - uses: actions/checkout@<full_commit_sha>
+ with:
+ persist-credentials: false
...
- uses: vmactions/dragonflybsd-vm@v1
+ uses: vmactions/dragonflybsd-vm@<full_commit_sha>🧰 Tools
🪛 zizmor (1.25.2)
[warning] 152-152: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 152-152: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
[error] 155-155: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/unix.yaml around lines 152 - 155, Replace tag-based action
refs with immutable, pinned revisions for both the checkout action and the
DragonFly VM action: change uses: actions/checkout@v6 and uses:
vmactions/dragonflybsd-vm@v1 to their specific commit SHAs (or fully qualified
refs) to avoid mutable tags, and in the checkout step (the action referenced by
actions/checkout) set persist-credentials: false to prevent leaking the workflow
token to subsequent steps; locate the checkout usage and the step with id
test-dragonflybsd / vmactions/dragonflybsd-vm to make these edits.
| public static Map<Integer, String> getCwdMap(int pid) { | ||
| Map<Integer, String> cwdMap = new HashMap<>(); | ||
| if (pid >= 0) { | ||
| String cwd = getCwd(pid); | ||
| if (!cwd.isEmpty()) { | ||
| cwdMap.put(pid, cwd); | ||
| } | ||
| } | ||
| return cwdMap; |
There was a problem hiding this comment.
getCwdMap contract doesn’t match implementation for pid < 0.
Javadoc promises “all processes” for negative PID, but Line 38 only executes for pid >= 0, so callers get an empty map for pid < 0.
Suggested fix direction
public static Map<Integer, String> getCwdMap(int pid) {
Map<Integer, String> cwdMap = new HashMap<>();
- if (pid >= 0) {
+ if (pid >= 0) {
String cwd = getCwd(pid);
if (!cwd.isEmpty()) {
cwdMap.put(pid, cwd);
}
+ } else {
+ // populate all pids from /proc
+ try (Stream<Path> proc = Files.list(Paths.get("/proc"))) {
+ proc.filter(Files::isDirectory)
+ .map(Path::getFileName)
+ .map(Path::toString)
+ .filter(s -> s.chars().allMatch(Character::isDigit))
+ .mapToInt(Integer::parseInt)
+ .forEach(p -> {
+ String cwd = getCwd(p);
+ if (!cwd.isEmpty()) {
+ cwdMap.put(p, cwd);
+ }
+ });
+ } catch (IOException e) {
+ // fallback remains empty map
+ }
}
return cwdMap;
}🤖 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/util/platform/unix/dragonflybsd/ProcstatUtil.java`
around lines 36 - 44, The implementation of ProcstatUtil.getCwdMap currently
only handles pid >= 0 but the Javadoc says negative pid should mean "all
processes"; update getCwdMap to handle pid < 0 by iterating over all process IDs
and populating the map: for each pid from the system-wide PID list (use the
existing method that returns all PIDs, e.g., getAllPids() or the project's
PID-listing utility) call ProcstatUtil.getCwd(pid) and, when non-empty, put it
into cwdMap; preserve the existing single-pid path (calling getCwd(pid)) and
make sure to swallow/handle any per-pid errors so a failure on one process
doesn’t abort the whole map population.
CodeRabbit Review ResponseFixed (commit 3b89801):
Skipped:
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java (1)
237-237:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winError message references wrong directory.
The code checks
/etc/rc.don line 226 but the error message says/etc/initdoes not exist.Proposed fix
- LOG.error("Directory: /etc/init does not exist"); + LOG.error("Directory: /etc/rc.d does not exist");🤖 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/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java` at line 237, The error message in DragonFlyBsdOperatingSystem (LOG.error call) incorrectly mentions "/etc/init" while the code is checking for "/etc/rc.d"; update the LOG.error text to reference "/etc/rc.d" so the message matches the check performed by the class DragonFlyBsdOperatingSystem (use the existing LOG.error invocation to change the string).
🧹 Nitpick comments (1)
oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java (1)
43-46: 💤 Low valueJavadoc contains garbled/leftover text from FreeBSD.
The class documentation mixes a DragonFly description ("HAMMER2 filesystem...LWKT subsystem") with leftover FreeBSD text ("accounting for more than three-quarters of all installed simply, permissively licensed BSD systems"). This appears to be copy-paste remnants.
Suggested fix
/** - * DragonFly BSD is a free and open-source Unix-like operating system forked from FreeBSD 4.8 in 2003. It features the - * HAMMER2 filesystem and a unique approach to SMP with its lightweight kernel threads (LWKT) subsystem. popular - * open-source BSD operating system, accounting for more than three-quarters of all installed simply, permissively - * licensed BSD systems. + * DragonFly BSD is a free and open-source Unix-like operating system forked from FreeBSD 4.8 in 2003. It features the + * HAMMER2 filesystem and a unique approach to SMP with its lightweight kernel threads (LWKT) subsystem. */🤖 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/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java` around lines 43 - 46, Update the class Javadoc for DragonFlyBsdOperatingSystem to remove the leftover FreeBSD/garbled text: replace the mixed/incorrect sentences with a concise, accurate description mentioning DragonFly BSD, its HAMMER2 filesystem and LWKT subsystem, fix capitalization ("popular" → "Popular" if used) and remove phrases like "accounting for more than three-quarters..." so the Javadoc for the DragonFlyBsdOperatingSystem class only contains correct DragonFly-specific information.
🤖 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.
Outside diff comments:
In
`@oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java`:
- Line 237: The error message in DragonFlyBsdOperatingSystem (LOG.error call)
incorrectly mentions "/etc/init" while the code is checking for "/etc/rc.d";
update the LOG.error text to reference "/etc/rc.d" so the message matches the
check performed by the class DragonFlyBsdOperatingSystem (use the existing
LOG.error invocation to change the string).
---
Nitpick comments:
In
`@oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java`:
- Around line 43-46: Update the class Javadoc for DragonFlyBsdOperatingSystem to
remove the leftover FreeBSD/garbled text: replace the mixed/incorrect sentences
with a concise, accurate description mentioning DragonFly BSD, its HAMMER2
filesystem and LWKT subsystem, fix capitalization ("popular" → "Popular" if
used) and remove phrases like "accounting for more than three-quarters..." so
the Javadoc for the DragonFlyBsdOperatingSystem class only contains correct
DragonFly-specific information.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 988a7bcc-3c43-47df-b4bc-cfa60c230240
📒 Files selected for processing (20)
oshi-core/src/main/java/oshi/driver/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdSoundCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdUsbDevice.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdUsbDevice.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdFileSystem.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdInternetProtocolStats.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdNetworkParams.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdFileSystem.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdInternetProtocolStats.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOSProcess.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/BsdSysctlUtil.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.java
✅ Files skipped from review due to trivial changes (2)
- oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.java
- oshi-core/src/main/java/oshi/driver/unix/dragonflybsd/package-info.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). (9)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: JMH Benchmarks, ubuntu-latest
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Test JDK 21, macos-latest
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Analyze (java)
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
🧰 Additional context used
🧠 Learnings (1)
📚 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/hardware/platform/unix/freebsd/FreeBsdUsbDevice.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdFileSystem.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdInternetProtocolStats.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdInternetProtocolStats.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdSoundCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdUsbDevice.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdFileSystem.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdNetworkParams.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java
🔇 Additional comments (20)
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdUsbDevice.java (1)
11-11: LGTM!Also applies to: 126-126
oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOSProcess.java (1)
463-465: LGTM!oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.java (1)
2-2: LGTM!Also applies to: 47-47
oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.java (1)
6-6: LGTM!oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdFileSystem.java (1)
77-83: LGTM!oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.java (1)
6-6: LGTM!oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdInternetProtocolStats.java (1)
40-42: LGTM!Also applies to: 51-52
oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdInternetProtocolStats.java (1)
42-44: LGTM!Also applies to: 53-54
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.java (1)
2-2: LGTM!Also applies to: 114-116, 223-233
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.java (1)
2-2: LGTM!Also applies to: 15-15, 69-71
oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdSoundCard.java (1)
15-15: LGTM!Also applies to: 69-71
oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdUsbDevice.java (1)
11-11: LGTM!Also applies to: 126-126
oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/BsdSysctlUtil.java (1)
20-20: LGTM!oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdFileSystem.java (1)
77-83: LGTM!oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.java (1)
442-444: LGTM!oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdNetworkParams.java (1)
47-47: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java (2)
114-116: LGTM!
267-279: LGTM!Also applies to: 282-312, 314-327, 382-404
oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java (2)
76-76: LGTM!
108-149: LGTM!Also applies to: 151-187, 189-213
Fix issues identified by CodeRabbit, applied to both DragonFly BSD and FreeBSD where the same pattern exists: - Fix over-escaped regex in CentralProcessor dmesg parsing - Fix potential null in SoundCard name construction - Fix potential null in UsbDevice hubMap lookup - Fix potential null in NetworkParams canonname - Fix integer overflow in InternetProtocolStats counter aggregation - Fix ArrayIndexOutOfBoundsException in OSProcess file limit parsing - Fix inode map keyed by device instead of mount point in FileSystem - Fix DragonFly-specific: javadoc references to FreeBSD, OS family fallback string
b1d4d42 to
8dd01c4
Compare
05a0b1e to
583a119
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java`:
- Around line 221-222: DragonFlyBsdOperatingSystem#getNetworkParams returns new
FreeBsdNetworkParams which hard-codes FreeBsdLibc.INSTANCE; change this so
DragonFly uses DragonFlyBsdLibc: either create a DragonFlyBsdNetworkParams class
that mirrors FreeBsdNetworkParams but calls DragonFlyBsdLibc.INSTANCE for
gethostname/getaddrinfo, and return new DragonFlyBsdNetworkParams() from
DragonFlyBsdOperatingSystem#getNetworkParams, or refactor FreeBsdNetworkParams
to accept a libc binding in its constructor and pass DragonFlyBsdLibc.INSTANCE
from DragonFlyBsdOperatingSystem#getNetworkParams; update references to
FreeBsdLibc.INSTANCE inside FreeBsdNetworkParams to use the injected binding.
🪄 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: 203e05bd-cf5d-4b86-b3f1-2e31edaf8838
📒 Files selected for processing (27)
.github/workflows/unix.yamlREADME.mdoshi-core/src/main/java/module-info.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdFirmware.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemory.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGraphicsCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensors.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.javaoshi-core/src/main/java/oshi/jna/platform/unix/BsdLibcLoader.javaoshi-core/src/main/java/oshi/jna/platform/unix/DragonFlyBsdLibc.javaoshi-core/src/main/java/oshi/jna/platform/unix/FreeBsdLibc.javaoshi-core/src/main/java/oshi/jna/platform/unix/OpenBsdLibc.javaoshi-core/src/main/java/oshi/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.javasrc/site/markdown/index.md
✅ Files skipped from review due to trivial changes (6)
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.java
- src/site/markdown/index.md
- oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.java
- README.md
- oshi-core/src/main/java/oshi/package-info.java
- oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.java
🚧 Files skipped from review as they are similar to previous changes (18)
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensors.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGraphicsCard.java
- oshi-core/src/main/java/oshi/jna/platform/unix/BsdLibcLoader.java
- oshi-core/src/main/java/oshi/jna/platform/unix/DragonFlyBsdLibc.java
- oshi-core/src/main/java/oshi/jna/platform/unix/FreeBsdLibc.java
- oshi-core/src/main/java/oshi/jna/platform/unix/OpenBsdLibc.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemory.java
- .github/workflows/unix.yaml
- oshi-core/src/main/java/module-info.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdFirmware.java
- oshi-core/src/main/java/oshi/SystemInfo.java
- oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.java
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.java
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.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). (6)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: Analyze (java)
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
🧰 Additional context used
🧠 Learnings (1)
📚 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/hardware/platform/unix/freebsd/FreeBsdComputerSystem.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java
🔇 Additional comments (2)
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystem.java (1)
2-2: LGTM!Also applies to: 27-27
oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java (1)
98-103: LGTM!Also applies to: 203-217
| public NetworkParams getNetworkParams() { | ||
| return new FreeBsdNetworkParams(); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
for name in FreeBsdNetworkParams.java DragonFlyBsdOperatingSystem.java FreeBsdLibc.java DragonFlyBsdLibc.java; do
path="$(fd -a "^${name}$" oshi-core/src/main/java | head -n1 || true)"
if [ -z "$path" ]; then
echo "Missing: $name" >&2
continue
fi
echo "=== $path ==="
sed -n '1,140p' "$path"
echo
doneRepository: oshi/oshi
Length of output: 12860
Route DragonFly getNetworkParams() through DragonFlyBsdLibc (not FreeBsdLibc)
DragonFlyBsdOperatingSystem#getNetworkParams() currently returns new FreeBsdNetworkParams(), and FreeBsdNetworkParams hard-codes FreeBsdLibc.INSTANCE for hostname/domain lookups (gethostname()/getaddrinfo()). Add a DragonFly-specific NetworkParams that uses DragonFlyBsdLibc.INSTANCE, or refactor FreeBsdNetworkParams to inject the correct libc binding.
💡 Minimal direction
`@Override`
public NetworkParams getNetworkParams() {
- return new FreeBsdNetworkParams();
+ return new DragonFlyBsdNetworkParams();
}🤖 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/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java`
around lines 221 - 222, DragonFlyBsdOperatingSystem#getNetworkParams returns new
FreeBsdNetworkParams which hard-codes FreeBsdLibc.INSTANCE; change this so
DragonFly uses DragonFlyBsdLibc: either create a DragonFlyBsdNetworkParams class
that mirrors FreeBsdNetworkParams but calls DragonFlyBsdLibc.INSTANCE for
gethostname/getaddrinfo, and return new DragonFlyBsdNetworkParams() from
DragonFlyBsdOperatingSystem#getNetworkParams, or refactor FreeBsdNetworkParams
to accept a libc binding in its constructor and pass DragonFlyBsdLibc.INSTANCE
from DragonFlyBsdOperatingSystem#getNetworkParams; update references to
FreeBsdLibc.INSTANCE inside FreeBsdNetworkParams to use the injected binding.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java (1)
32-49: 💤 Low valueConsider adding debug logging on sysctl failure for consistency.
queryProcessorCpuLoadTicks()logs a debug message withNative.getLastError()when the sysctl fails (line 60), butquerySystemCpuLoadTicks()silently returns zeros. For consistent debugging, consider adding similar logging here.🔧 Proposed fix
try (CloseableSizeTByReference size = new CloseableSizeTByReference(cpTime.size())) { - if (0 == DragonFlyBsdLibc.INSTANCE.sysctlbyname("kern.cp_time", cpTime.getPointer(), size, null, - size_t.ZERO)) { + String name = "kern.cp_time"; + if (0 != DragonFlyBsdLibc.INSTANCE.sysctlbyname(name, cpTime.getPointer(), size, null, + size_t.ZERO)) { + LOG.debug("Failed sysctl call: {}, Error code: {}", name, Native.getLastError()); + return ticks; + } - cpTime.read(); + cpTime.read(); - ticks[TickType.USER.getIndex()] = cpTime.cpu_ticks[FreeBsdLibc.CP_USER]; - ticks[TickType.NICE.getIndex()] = cpTime.cpu_ticks[FreeBsdLibc.CP_NICE]; - ticks[TickType.SYSTEM.getIndex()] = cpTime.cpu_ticks[FreeBsdLibc.CP_SYS]; - ticks[TickType.IRQ.getIndex()] = cpTime.cpu_ticks[FreeBsdLibc.CP_INTR]; - ticks[TickType.IDLE.getIndex()] = cpTime.cpu_ticks[FreeBsdLibc.CP_IDLE]; - } + ticks[TickType.USER.getIndex()] = cpTime.cpu_ticks[FreeBsdLibc.CP_USER]; + ticks[TickType.NICE.getIndex()] = cpTime.cpu_ticks[FreeBsdLibc.CP_NICE]; + ticks[TickType.SYSTEM.getIndex()] = cpTime.cpu_ticks[FreeBsdLibc.CP_SYS]; + ticks[TickType.IRQ.getIndex()] = cpTime.cpu_ticks[FreeBsdLibc.CP_INTR]; + ticks[TickType.IDLE.getIndex()] = cpTime.cpu_ticks[FreeBsdLibc.CP_IDLE]; }🤖 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/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java` around lines 32 - 49, The method querySystemCpuLoadTicks() currently returns zeros on sysctl failure without logging; add a debug log like the one in queryProcessorCpuLoadTicks() to record the failure and Native.getLastError() (or the equivalent error code/message) when DragonFlyBsdLibc.INSTANCE.sysctlbyname(...) returns non-zero, so you can diagnose failures; place the log inside the try block where the sysctl call is checked (before returning ticks) and use the same logger used by queryProcessorCpuLoadTicks() with a clear message including "kern.cp_time" and the native error details.
🤖 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-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java`:
- Around line 32-49: The method querySystemCpuLoadTicks() currently returns
zeros on sysctl failure without logging; add a debug log like the one in
queryProcessorCpuLoadTicks() to record the failure and Native.getLastError() (or
the equivalent error code/message) when
DragonFlyBsdLibc.INSTANCE.sysctlbyname(...) returns non-zero, so you can
diagnose failures; place the log inside the try block where the sysctl call is
checked (before returning ticks) and use the same logger used by
queryProcessorCpuLoadTicks() with a clear message including "kern.cp_time" and
the native error details.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2e08ba30-5a49-471c-914a-e70d5971ca3a
📒 Files selected for processing (28)
.github/workflows/unix.yamlREADME.mdoshi-core/src/main/java/module-info.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdFirmware.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemory.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGraphicsCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensors.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.javaoshi-core/src/main/java/oshi/jna/platform/unix/BsdLibcLoader.javaoshi-core/src/main/java/oshi/jna/platform/unix/DragonFlyBsdLibc.javaoshi-core/src/main/java/oshi/jna/platform/unix/FreeBsdLibc.javaoshi-core/src/main/java/oshi/jna/platform/unix/OpenBsdLibc.javaoshi-core/src/main/java/oshi/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.javaoshi-core/src/test/java/oshi/software/os/shared/OperatingSystemTest.javasrc/site/markdown/index.md
✅ Files skipped from review due to trivial changes (6)
- oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.java
- oshi-core/src/main/java/oshi/package-info.java
- src/site/markdown/index.md
- README.md
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.java
- oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.java
🚧 Files skipped from review as they are similar to previous changes (20)
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemory.java
- oshi-core/src/test/java/oshi/software/os/shared/OperatingSystemTest.java
- oshi-core/src/main/java/oshi/jna/platform/unix/DragonFlyBsdLibc.java
- oshi-core/src/main/java/oshi/jna/platform/unix/FreeBsdLibc.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdFirmware.java
- .github/workflows/unix.yaml
- oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGraphicsCard.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystem.java
- oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.java
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.java
- oshi-core/src/main/java/oshi/jna/platform/unix/BsdLibcLoader.java
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.java
- oshi-core/src/main/java/module-info.java
- oshi-core/src/main/java/oshi/jna/platform/unix/OpenBsdLibc.java
- oshi-core/src/main/java/oshi/SystemInfo.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). (8)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Analyze (java)
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: JMH Benchmarks, ubuntu-latest
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
🧰 Additional context used
🧠 Learnings (1)
📚 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/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensors.java
🔇 Additional comments (2)
oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java (1)
24-30: LGTM!Also applies to: 51-78
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensors.java (1)
2-2: LGTM!Also applies to: 21-21
4495c6c to
8b375f1
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.java (1)
69-71:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAvoid leading whitespace in fallback sound card names.
When
info.vendoris missing, this now produces names like" Unknown". Build the combined name conditionally, or trim it before constructing theFreeBsdSoundCard.Proposed fix
String product = productMap.getOrDefault(s, Constants.UNKNOWN); String vendor = vendorMap.getOrDefault(s, ""); - soundCards.add(new FreeBsdSoundCard(product, vendor + " " + product, product)); + String name = vendor.isEmpty() ? product : vendor + " " + product; + soundCards.add(new FreeBsdSoundCard(product, name, product));🤖 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/hardware/platform/unix/freebsd/FreeBsdSoundCard.java` around lines 69 - 71, The combined sound card name construction can produce a leading space when vendorMap.getOrDefault(s, "") returns empty (e.g., " Unknown"); update the logic around productMap, vendorMap and the FreeBsdSoundCard constructor to either conditionally build the combined name only when vendor is non-empty or trim the resulting string before passing it in; specifically, when creating new FreeBsdSoundCard(product, vendor + " " + product, product) use a safeCombined variable (e.g., vendor.isEmpty() ? product : (vendor + " " + product)) or call .trim() on the concatenation so the display name never has a leading space, while still keeping product and Constants.UNKNOWN handling intact.
🧹 Nitpick comments (1)
oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java (1)
51-79: ⚡ Quick winValidate the returned
kern.cputimepayload before indexing it.This derives
structSizefrom the first size query and never revalidates after the data fetch. If the secondsysctlbyname()returns a different byte count, or one that's not a whole number of per-CPU records, the offset math can read garbage or trip JNA bounds checks. UsedataSize.getValue()for the final size and bail out unless it is a positive multiple ofgetLogicalProcessorCount()and large enough for the tick fields.Proposed hardening
long arraySize = size.getValue().longValue(); if (arraySize <= 0) { return ticks; } - long structSize = arraySize / getLogicalProcessorCount(); try (Memory m = new Memory(arraySize); CloseableSizeTByReference dataSize = new CloseableSizeTByReference(arraySize)) { if (0 != DragonFlyBsdLibc.INSTANCE.sysctlbyname(name, m, dataSize, null, size_t.ZERO)) { LOG.debug("Failed sysctl data query: {}, Error code: {}", name, Native.getLastError()); return ticks; } - for (int cpu = 0; cpu < getLogicalProcessorCount(); cpu++) { + int logicalCount = getLogicalProcessorCount(); + long returnedSize = dataSize.getValue().longValue(); + long minStructSize = (long) (FreeBsdLibc.CP_IDLE + 1) * FreeBsdLibc.UINT64_SIZE; + if (logicalCount <= 0 || returnedSize < logicalCount * minStructSize + || returnedSize % logicalCount != 0) { + LOG.debug("Unexpected {} payload size: {}", name, returnedSize); + return ticks; + } + long structSize = returnedSize / logicalCount; + for (int cpu = 0; cpu < logicalCount; cpu++) { ticks[cpu][TickType.USER.getIndex()] = m .getLong(structSize * cpu + FreeBsdLibc.CP_USER * FreeBsdLibc.UINT64_SIZE); ticks[cpu][TickType.NICE.getIndex()] = m🤖 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/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java` around lines 51 - 79, The code in DragonFlyBsdCentralProcessor reads kern.cputime into Memory using an initial size probe but doesn’t revalidate the actual returned byte count from the second sysctlbyname call; use dataSize.getValue() (from the CloseableSizeTByReference dataSize) to compute the final array size, compute structSize = finalSize / getLogicalProcessorCount(), and validate that finalSize > 0, finalSize % getLogicalProcessorCount() == 0, and structSize is at least large enough to contain all tick fields (e.g., (FreeBsdLibc.CP_IDLE + 1) * FreeBsdLibc.UINT64_SIZE) before indexing ticks[cpu][...]; if validation fails, log a debug/error and return ticks instead of performing the unsafe offsets.
🤖 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.
Outside diff comments:
In
`@oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.java`:
- Around line 69-71: The combined sound card name construction can produce a
leading space when vendorMap.getOrDefault(s, "") returns empty (e.g., "
Unknown"); update the logic around productMap, vendorMap and the
FreeBsdSoundCard constructor to either conditionally build the combined name
only when vendor is non-empty or trim the resulting string before passing it in;
specifically, when creating new FreeBsdSoundCard(product, vendor + " " +
product, product) use a safeCombined variable (e.g., vendor.isEmpty() ? product
: (vendor + " " + product)) or call .trim() on the concatenation so the display
name never has a leading space, while still keeping product and
Constants.UNKNOWN handling intact.
---
Nitpick comments:
In
`@oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java`:
- Around line 51-79: The code in DragonFlyBsdCentralProcessor reads kern.cputime
into Memory using an initial size probe but doesn’t revalidate the actual
returned byte count from the second sysctlbyname call; use dataSize.getValue()
(from the CloseableSizeTByReference dataSize) to compute the final array size,
compute structSize = finalSize / getLogicalProcessorCount(), and validate that
finalSize > 0, finalSize % getLogicalProcessorCount() == 0, and structSize is at
least large enough to contain all tick fields (e.g., (FreeBsdLibc.CP_IDLE + 1) *
FreeBsdLibc.UINT64_SIZE) before indexing ticks[cpu][...]; if validation fails,
log a debug/error and return ticks instead of performing the unsafe offsets.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ae253d5c-eca3-4e0c-b5d2-5006d45b6b73
📒 Files selected for processing (29)
.github/workflows/unix.yamlCHANGELOG.mdREADME.mdoshi-core/src/main/java/module-info.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdFirmware.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemory.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGraphicsCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensors.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.javaoshi-core/src/main/java/oshi/jna/platform/unix/BsdLibcLoader.javaoshi-core/src/main/java/oshi/jna/platform/unix/DragonFlyBsdLibc.javaoshi-core/src/main/java/oshi/jna/platform/unix/FreeBsdLibc.javaoshi-core/src/main/java/oshi/jna/platform/unix/OpenBsdLibc.javaoshi-core/src/main/java/oshi/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.javaoshi-core/src/test/java/oshi/software/os/shared/OperatingSystemTest.javasrc/site/markdown/index.md
💤 Files with no reviewable changes (1)
- CHANGELOG.md
✅ Files skipped from review due to trivial changes (4)
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.java
- README.md
- oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.java
🚧 Files skipped from review as they are similar to previous changes (20)
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGraphicsCard.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensors.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystem.java
- oshi-core/src/main/java/oshi/package-info.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdFirmware.java
- oshi-core/src/main/java/module-info.java
- oshi-core/src/main/java/oshi/jna/platform/unix/OpenBsdLibc.java
- oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemory.java
- .github/workflows/unix.yaml
- oshi-core/src/main/java/oshi/SystemInfo.java
- oshi-core/src/test/java/oshi/software/os/shared/OperatingSystemTest.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.java
- oshi-core/src/main/java/oshi/jna/platform/unix/BsdLibcLoader.java
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.java
- oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.java
- oshi-core/src/main/java/oshi/jna/platform/unix/FreeBsdLibc.java
- oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.java
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.java
- oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.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). (10)
- 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: Test JDK 11, macos-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: JMH Benchmarks, windows-latest
- GitHub Check: JMH Benchmarks, ubuntu-latest
- GitHub Check: JMH Benchmarks, macos-latest
- GitHub Check: Analyze (java)
- GitHub Check: Codacy Static Code Analysis
🧰 Additional context used
🧠 Learnings (1)
📚 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/hardware/platform/unix/freebsd/FreeBsdSoundCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java
🔇 Additional comments (4)
src/site/markdown/index.md (1)
19-19: LGTM!oshi-core/src/main/java/oshi/jna/platform/unix/DragonFlyBsdLibc.java (1)
8-19: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.java (1)
23-23: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java (1)
29-43: LGTM!
|
@CodeRabbit full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java (1)
212-213:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse a DragonFly-specific NetworkParams binding instead of
FreeBsdNetworkParams.This still routes DragonFly through
FreeBsdNetworkParams, which is expected to bind FreeBSD libc calls. Please switch to a DragonFly binding (or inject libc into a shared implementation).#!/bin/bash set -euo pipefail echo "Locate DragonFly OS getNetworkParams implementation:" fd -a "^DragonFlyBsdOperatingSystem.java$" oshi-core/src/main/java | while read -r f; do echo "== $f ==" rg -n "getNetworkParams|FreeBsdNetworkParams|DragonFlyBsdLibc|FreeBsdLibc" "$f" done echo echo "Inspect FreeBsdNetworkParams libc binding:" fd -a "^FreeBsdNetworkParams.java$" oshi-core/src/main/java | while read -r f; do echo "== $f ==" rg -n "FreeBsdLibc|DragonFlyBsdLibc|gethostname|getaddrinfo" "$f" doneExpected result: DragonFly path should not depend on
FreeBsdLibc-bound network params.🤖 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/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java` around lines 212 - 213, The DragonFlyBsdOperatingSystem.getNetworkParams() currently returns FreeBsdNetworkParams which binds FreeBsdLibc; change this to return a DragonFly-specific implementation (e.g., DragonFlyBsdNetworkParams) or refactor to a shared NetworkParams implementation that accepts the proper libc binding; update the class returned by getNetworkParams in DragonFlyBsdOperatingSystem and ensure the new DragonFlyBsdNetworkParams uses DragonFlyBsdLibc (not FreeBsdLibc), adjust imports and any factory/constructor signatures accordingly so DragonFly uses its own libc binding for gethostname/getaddrinfo calls.oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.java (1)
33-44:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAlign
getCwdMap(int pid)behavior with its documented contract.Javadoc says negative
pidreturns all processes, but current implementation returns an empty map forpid < 0.🤖 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/util/platform/unix/dragonflybsd/ProcstatUtil.java` around lines 33 - 44, The getCwdMap(int pid) method currently only handles pid >= 0 but its Javadoc promises that a negative pid returns all processes; update getCwdMap to handle pid < 0 by iterating over all process IDs and calling getCwd for each, adding non-empty results to cwdMap. Use the existing process-listing utility in this class or project (the method that returns all PIDs) to obtain the PID list, then for each pid call getCwd(pid) and put non-empty values into cwdMap.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.java`:
- Around line 280-283: The affinity bit-shift can overflow for CPU indexes ≥ 64
in DragonFlyBsdOSProcess, so when computing bitMask after
ParseUtil.parseIntOrDefault (variable bitToSet) ensure you skip out-of-range
indexes before shifting; change the condition that sets bitMask (currently using
"if (bitToSet >= 0) { bitMask |= 1L << bitToSet; }") to only perform the shift
when bitToSet < Long.SIZE (or 64), e.g., check "bitToSet >= 0 && bitToSet <
Long.SIZE" and ignore values outside that range to avoid wraparound.
---
Duplicate comments:
In
`@oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java`:
- Around line 212-213: The DragonFlyBsdOperatingSystem.getNetworkParams()
currently returns FreeBsdNetworkParams which binds FreeBsdLibc; change this to
return a DragonFly-specific implementation (e.g., DragonFlyBsdNetworkParams) or
refactor to a shared NetworkParams implementation that accepts the proper libc
binding; update the class returned by getNetworkParams in
DragonFlyBsdOperatingSystem and ensure the new DragonFlyBsdNetworkParams uses
DragonFlyBsdLibc (not FreeBsdLibc), adjust imports and any factory/constructor
signatures accordingly so DragonFly uses its own libc binding for
gethostname/getaddrinfo calls.
In
`@oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.java`:
- Around line 33-44: The getCwdMap(int pid) method currently only handles pid >=
0 but its Javadoc promises that a negative pid returns all processes; update
getCwdMap to handle pid < 0 by iterating over all process IDs and calling getCwd
for each, adding non-empty results to cwdMap. Use the existing process-listing
utility in this class or project (the method that returns all PIDs) to obtain
the PID list, then for each pid call getCwd(pid) and put non-empty values into
cwdMap.
🪄 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: faac1015-1e62-4ce8-8e2a-da499b9a03b4
📒 Files selected for processing (37)
.github/workflows/unix.yamlCHANGELOG.mdREADME.mdoshi-common/src/main/resources/oshi.propertiesoshi-core/src/main/java/module-info.javaoshi-core/src/main/java/oshi/SystemInfo.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdFirmware.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemory.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGraphicsCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensors.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdUsbDevice.javaoshi-core/src/main/java/oshi/jna/platform/unix/BsdLibcLoader.javaoshi-core/src/main/java/oshi/jna/platform/unix/DragonFlyBsdLibc.javaoshi-core/src/main/java/oshi/jna/platform/unix/FreeBsdLibc.javaoshi-core/src/main/java/oshi/jna/platform/unix/OpenBsdLibc.javaoshi-core/src/main/java/oshi/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdFileSystem.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdInternetProtocolStats.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOperatingSystem.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/ProcstatUtil.javaoshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.javaoshi-core/src/test/java/oshi/hardware/platform/shared/CentralProcessorTest.javaoshi-core/src/test/java/oshi/software/os/shared/OperatingSystemTest.javapom.xmlsrc/site/markdown/index.md
📜 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). (1)
- GitHub Check: Codacy Static Code Analysis
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-04-06T04:45:47.644Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:47.644Z
Learning: In the oshi/oshi project, only interfaces and classes in the root packages `oshi`, `oshi.hardware`, and `oshi.software.os` are considered the public API. Code in subpackages that represent specific implementations/platforms (e.g., `oshi.software.os.linux`, `oshi.hardware.platform.linux`, and similar subpackages) is implementation detail. When reviewing, do not treat changes to classes in these platform-specific subpackages as public API breaks (for example: making `LinuxOperatingSystem` abstract, narrowing constructor visibility, or adding/removing abstract methods should not be flagged as breaking public API).
Applied to files:
oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemory.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensors.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdFirmware.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdFileSystem.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdInternetProtocolStats.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGraphicsCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.javaoshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystem.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOperatingSystem.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdUsbDevice.javaoshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOSProcess.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSProcess.javaoshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.javaoshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOperatingSystem.java
🪛 markdownlint-cli2 (0.22.1)
CHANGELOG.md
[warning] 3-3: Heading levels should only increment by one level at a time
Expected: h2; Actual: h5
(MD001, heading-increment)
🪛 zizmor (1.25.2)
.github/workflows/unix.yaml
[warning] 151-151: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 151-151: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
[error] 154-154: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🔇 Additional comments (35)
.github/workflows/unix.yaml (2)
151-154: The unpinned action references and credential persistence concerns were previously raised and intentionally skipped per project convention, as documented in the PR objectives.
146-165: LGTM!CHANGELOG.md (1)
1-6: LGTM!README.md (1)
19-19: LGTM!oshi-common/src/main/resources/oshi.properties (1)
268-269: LGTM!oshi-core/src/main/java/module-info.java (1)
5-5: LGTM!Also applies to: 26-26
oshi-core/src/main/java/oshi/SystemInfo.java (1)
16-16: LGTM!Also applies to: 25-25, 59-60, 128-129, 161-162
pom.xml (1)
822-822: LGTM!Also applies to: 828-828
oshi-core/src/main/java/oshi/package-info.java (1)
35-35: LGTM!src/site/markdown/index.md (1)
19-19: LGTM!oshi-core/src/main/java/oshi/jna/platform/unix/BsdLibcLoader.java (1)
10-13: LGTM!Also applies to: 16-17, 26-28
oshi-core/src/main/java/oshi/jna/platform/unix/FreeBsdLibc.java (1)
2-2: LGTM!Also applies to: 19-19
oshi-core/src/main/java/oshi/jna/platform/unix/OpenBsdLibc.java (1)
2-2: LGTM!Also applies to: 17-17
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdCentralProcessor.java (1)
40-40: LGTM!Also applies to: 114-117, 223-234
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdComputerSystem.java (1)
2-2: LGTM!Also applies to: 27-27
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdFirmware.java (1)
2-2: LGTM!Also applies to: 23-23
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGlobalMemory.java (1)
2-2: LGTM!Also applies to: 23-23
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdGraphicsCard.java (1)
22-22: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSensors.java (1)
2-2: LGTM!Also applies to: 21-21
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdSoundCard.java (1)
2-2: LGTM!Also applies to: 15-15, 23-23, 69-71
oshi-core/src/main/java/oshi/hardware/platform/unix/freebsd/FreeBsdUsbDevice.java (1)
11-11: LGTM!Also applies to: 126-126
oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdNetworkParams.java (1)
2-2: LGTM!Also applies to: 26-26, 47-47
oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdFileSystem.java (1)
77-83: LGTM!oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdInternetProtocolStats.java (1)
40-42: LGTM!Also applies to: 51-52
oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOSProcess.java (1)
463-465: LGTM!oshi-core/src/main/java/oshi/software/os/unix/freebsd/FreeBsdOperatingSystem.java (1)
2-2: LGTM!Also applies to: 241-241
oshi-core/src/main/java/oshi/jna/platform/unix/DragonFlyBsdLibc.java (1)
7-20: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdCentralProcessor.java (1)
28-82: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/DragonFlyBsdHardwareAbstractionLayer.java (1)
39-100: LGTM!oshi-core/src/main/java/oshi/hardware/platform/unix/dragonflybsd/package-info.java (1)
5-8: LGTM!oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/DragonFlyBsdOSThread.java (1)
44-53: LGTM!Also applies to: 116-130, 132-168
oshi-core/src/main/java/oshi/util/platform/unix/dragonflybsd/package-info.java (1)
5-8: LGTM!oshi-core/src/main/java/oshi/software/os/unix/dragonflybsd/package-info.java (1)
5-8: LGTM!oshi-core/src/test/java/oshi/hardware/platform/shared/CentralProcessorTest.java (1)
166-167: LGTM!oshi-core/src/test/java/oshi/software/os/shared/OperatingSystemTest.java (1)
87-91: LGTM!Also applies to: 133-137, 425-429
Introduce BsdLibcLoader helper to load BSD libc via "c" (works on both FreeBSD and DragonFly). Both FreeBsdLibc and DragonFlyBsdLibc use this helper. DragonFlyBsdLibc now extends FreeBsdLibc, adding only lwp_gettid(). Since FreeBsdLibc loads successfully on DragonFly, all FreeBSD classes that use BsdSysctlUtil/FreeBsdLibc work on both platforms. DragonFly HAL and OS now directly use FreeBSD implementations for identical functionality (ComputerSystem, GlobalMemory, Sensors, CentralProcessor, FileSystem, InternetProtocolStats, NetworkParams, PowerSource, HWDiskStore, GraphicsCard, SoundCard, UsbDevice). Only DragonFly-specific code remains: - DragonFlyBsdLibc (lwp_gettid) - HAL (wiring) - OperatingSystem (ps keywords, thread ID, PID filter, boot time) - OSProcess (args/env via /proc, start time from /proc/status) - OSThread (different thread columns) - ProcstatUtil (fstat-based, not procstat) Also: remove owner guard from DragonFly CI job, fix FreeBSD job name.
Summary
Adds DragonFly BSD as a supported platform in OSHI, using JNA for native access.
Approach
Started from the FreeBSD implementation (copy + rename), then iteratively fixed DragonFly-specific differences. Deduplicated by having DragonFly classes extend or delegate to FreeBSD equivalents where behavior is identical — only 15 DragonFly-specific files remain (down from 31 in the initial copy).
Key DragonFly BSD differences from FreeBSD
"c"not"libc"(JNA PR Include DragonFlyBSD in library loading fallback paths java-native-access/jna#1727 filed to fix upstream)lwp_gettid()instead ofthr_self()/proc/<pid>/cmdlineand/proc/<pid>/statusinstead ofKERN_PROC_ARGS/KERN_PROC_ENVsysctls (different MIB numbers)group,gid,etime,lwp; usesrgid,tid,ucomm,commandinsteadkern.cp_times: Not available (per-CPU ticks)procstat: Not available; uses FreeBSD'sfstat-based fallbackSystem.getenv()Changes
lwp_gettid()and FreeBSD-compatible sysctl/utmpx/proc-based process info, and start time retrievalCode Reuse Strategy
Testing
All tests pass on DragonFly BSD 6.4.2:
vmactions/dragonflybsd-vm@v1in GitHub ActionsRelated
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores / CI
Documentation