Skip to content

Commit b88ab7f

Browse files
Port remaining Linux JNA classes to FFM (#3121)
* Port remaining Linux JNA classes to FFM - Refactor LinuxCentralProcessor: move getSystemLoadAverage to base using /proc/loadavg fallback; JNA subclass uses getloadavg() with fallback to super; FFM subclass uses LinuxLibcFunctions with fallback - Refactor LinuxUsbDevice: rename to LinuxUsbDeviceJNA, create abstract LinuxUsbDevice base with shared template method; LinuxUsbDeviceFFM extends base using UdevFunctions - Refactor LinuxFileSystem, LinuxNetworkParams, LinuxOSProcess, LinuxOperatingSystem: extract abstract bases in oshi-core, add JNA subclasses, add FFM subclasses in oshi-core-java25 - Add LinuxLibcFunctions FFM bindings: getpid, gettid, getloadavg, sysinfo, statvfs, gethostname, getaddrinfo/freeaddrinfo, getrlimit - Add ProcPath.LOADAVG constant - Remove redundant getProcessCount override in LinuxOperatingSystemJNA - Update LinuxHardwareAbstractionLayerJNA to use LinuxUsbDeviceJNA * Fix LinuxLibcFunctions libc lookup and add CHANGELOG entry Use LINKER.defaultLookup() instead of libraryLookup("c") to resolve libc symbols. libraryLookup maps "c" to "libc.so" via System.mapLibraryName, which fails on Linux where the actual soname is "libc.so.6". libc is always linked into the JVM process so the default lookup covers all its symbols without opening the library by name. * Address CodeRabbit review findings - LinuxLibcFunctions: add SYS_GETTID mappings for riscv64/loongarch64 (178), s390x (236), ppc64le (207); log unknown arch at debug level rather than silently using a potentially wrong value - LinuxLibcFunctions: sysinfoProcs returns int via Short.toUnsignedInt to correctly expose the unsigned 16-bit procs field - LinuxLibcFunctions: gethostname size_t parameter changed from JAVA_INT to JAVA_LONG to match LP64 Linux ABI; wrapper updated to accept long - LinuxNetworkParamsFFM: pass long literal to gethostname call - LinuxNetworkParamsJNA: fix getaddrinfo error check from res > 0 to res != 0 to catch negative EAI_SYSTEM codes; call freeaddrinfo() explicitly to release C-allocated addrinfo memory (Addrinfo.close() is a no-op for native allocations) - LinuxUsbDeviceJNA: null-check udev_new() return before use - LinuxOSProcessJNA: check getrlimit() return value; fall back to getProcessOpenFileLimit() on failure - LinuxOSProcessFFM: same getrlimit() return value check and fallback * Address CodeRabbit review findings (round 2); revert USB class refactoring - LinuxOperatingSystemJNA: fix unsigned short sign-extension in getThreadCount via Short.toUnsignedInt - LinuxOperatingSystemJNA/FFM: use createOSProcess() in getProcess() - LinuxFileSystem: make getFileStoreMatching a non-static instance method so queryStatvfs dispatches polymorphically; remove null- instance overload - LinuxOSFileStore: store LinuxFileSystem reference; call fs.getFileStoreMatching() in updateAttributes() so statvfs is used on refresh - LinuxOSProcess: handle 'unlimited' and guard array bounds in getProcessOpenFileLimit() - Revert USB class refactoring (LinuxUsbDeviceJNA, abstract LinuxUsbDevice base) back to master branch state; fix HAS_UDEV import in LinuxUsbDevice to reference LinuxOperatingSystemJNA; USB consolidation deferred to a follow-up PR * Fix typo Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 180c940 commit b88ab7f

24 files changed

Lines changed: 1131 additions & 284 deletions

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
##### Bug fixes / Improvements
44
* [#3119](https://github.com/oshi/oshi/pull/3119): Fix resource leaks and flaky test in `PrivilegedUtil` - [@dbwiddis](https://github.com/dbwiddis).
5-
* [#3120](https://github.com/oshi/oshi/pull/3120): Migrate `LinuxCentralProcessor` udev calls - [@dbwiddis](https://github.com/dbwiddis).
6-
* [#3117](https://github.com/oshi/oshi/pull/3117): Begin Linux FFM migration: udev-dependent HAL components - [@dbwiddis](https://github.com/dbwiddis).
5+
* [#3117](https://github.com/oshi/oshi/pull/3117),
6+
[#3120](https://github.com/oshi/oshi/pull/3120),
7+
[#3121](https://github.com/oshi/oshi/pull/3121): Port Linux JNA classes to FFM - [@dbwiddis](https://github.com/dbwiddis).
78

89
# 6.11.0 (2026-04-04)
910

0 commit comments

Comments
 (0)