Repository navigation
Conversation
fd3e4e7 to
4cd4d97
Compare
| */ | ||
| @Structure.FieldOrder({ "insi_fport", "insi_lport", "insi_gencnt", "insi_flags", "insi_flow", "insi_vflag", | ||
| "insi_ip_ttl", "rfu_1", "insi_faddr", "insi_laddr", "insi_v4", "insi_v6" }) | ||
| class InSockInfo extends Structure { |
There was a problem hiding this comment.
The first members match. Are the latter members intentionally not mapped as struct but instead as byte arrays?
There was a problem hiding this comment.
int arrays to be precise.
I knew there was a reason I hadn't contributed these upstream for years... since I didn't really need them in my project I just made sure the byte counts matched as creating a union I would never need was annoying.
So this is four 32-bit IP addresses, the larger member of the first and second unions (thus int[4])
struct in4in6_addr {
u_int32_t i46a_pad32[3];
struct in_addr i46a_addr4;
};
struct in_addr {
in_addr_t s_addr;
};
typedef __uint32_t in_addr_t; /* base type for internet address */
Similarly with the last insi_v6 structure.
Not sure I want to go to the trouble of mapping them. I can just close this PR. (I guess it's not that hard. I'm just lazy.)
4ba2dc0 to
70db423
Compare
|
Properly mapped the unions. Made identical changes here: https://github.com/dbwiddis/oshi/tree/jna-union-mapping And got sane socket info: |
matthiasblaesing
left a comment
There was a problem hiding this comment.
The "opaque" elements in SocketInfo could be mapped as structures. On the other hand it should be possible to provide decoder helper for that.
Yeah, a ton of fields with a nested union with 7 structures in it. You can see why I skipped it when I didn't need that info. :) I'll see if I can get to it this weekend. |
Just to be clear: This was not a "this must be done" request. If you decide that the current state is sensible, I'm ok with that. |
|
Understood. I'm still going to evaluate the scope and consider if there's a way to map it in a non-breaking way if it needs to be added later. |
Add In4In6Addr, In6Addr, InsiAddr union for proper address mapping in InSockInfo. Add ProcFileInfo, SockbufInfo, SocketInfo, Pri union, and SocketFdInfo structures for proc_pidfdinfo support. InSockInfo.read() and SocketInfo.read() automatically select the correct union type based on insi_vflag and soi_kind respectively. Add testProcPidFdSocketInfo test exercising proc_pidfdinfo with PROC_PIDFDSOCKETINFO.
70db423 to
abfd400
Compare
|
OK, I looked again after fresh coffee and was confusing myself. I'd already mapped the more complicated one. This last one is a nice flat structure with easy mappings that add up to 136. I'll merge in 24 hours if you don't object. |
matthiasblaesing
left a comment
There was a problem hiding this comment.
Thank you - great work!
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [net.java.dev.jna:jna](https://github.com/java-native-access/jna) | `5.18.1` → `5.19.1` |  |  | --- ### Release Notes <details> <summary>java-native-access/jna (net.java.dev.jna:jna)</summary> ### [`v5.19.1`](https://github.com/java-native-access/jna/blob/HEAD/CHANGES.md#Release-5191) [Compare Source](java-native-access/jna@5.19.0...5.19.1) \============== ## Bug Fixes - [#​1730](java-native-access/jna#1730): Replace usage of `MethodHandle` with reflection to restore support for older Android releases - [@​matthiasblaesing](https://github.com/matthiasblaesing). ### [`v5.19.0`](https://github.com/java-native-access/jna/blob/HEAD/CHANGES.md#Release-5190) [Compare Source](java-native-access/jna@5.18.1...5.19.0) \============== ## Features - [#​1696](java-native-access/jna#1696): Add `LARGE_INTEGER.ByValue` to `LARGE_INTEGER` in `WinNT.java` - [@​baier233](https://github.com/baier233). - [#​1697](java-native-access/jna#1697): Add WlanApi module - [@​eranl](https://github.com/eranl). - [#​1718](java-native-access/jna#1718): Add `Cups` to `c.s.j.p.unix` providing CUPS printing system bindings for destinations, jobs, options, and server configuration - [@​dbwiddis](https://github.com/dbwiddis). - [#​1720](java-native-access/jna#1720): Add `groupCount` and `groupMasks` fields to `CACHE_RELATIONSHIP` in `c.s.j.p.win32.WinNT`, matching the updated Windows struct layout - [@​dbwiddis](https://github.com/dbwiddis). - [#​1719](java-native-access/jna#1719): Add `CoreGraphics` to `c.s.j.p.mac` with Quartz Window Services and Display Services bindings; implement `getAllWindows()` in `MacWindowUtils` - [@​dbwiddis](https://github.com/dbwiddis). - [#​1723](java-native-access/jna#1723): Add `ProcFdInfo`, `InSockInfo`, `TcpSockInfo`, `proc_pidfdinfo`, `statfs64`, and `vm_deallocate` to `c.s.j.p.mac.SystemB` - [@​dbwiddis](https://github.com/dbwiddis). - [#​1725](java-native-access/jna#1725): Add `BluetoothApis` to `c.s.j.p.win32` providing Bluetooth device and radio enumeration via `BluetoothFindFirstRadio`, `BluetoothFindFirstDevice`, and related functions - [@​dbwiddis](https://github.com/dbwiddis). ## Bug Fixes - [#​1644](java-native-access/jna#1644): Fix bug in VARDESC and TYPEDESC causing an illegal memory access - [@​lwahonen](https://github.com/lwahonen) - [#​1715](java-native-access/jna#1715): Fix `UdevDevice.getSysname()` calling `udev_device_get_syspath` instead of `udev_device_get_sysname` - [@​dbwiddis](https://github.com/dbwiddis). - [#​1721](java-native-access/jna#1721): Fix switched `serverName`/`domainName` arguments in `Netapi32Util#getDCName` - [@​dbwiddis](https://github.com/dbwiddis). - [#​1722](java-native-access/jna#1722): Fix `Advapi32#RegisterServiceCtrlHandler` using wrong `Handler` type - [@​dbwiddis](https://github.com/dbwiddis). - [#​1636](java-native-access/jna#1636): Drop hard dependency on java.lang.SecurityManager/java.security.AccessController - [@​matthiasblaesing](https://github.com/matthiasblaesing). - [#​1724](java-native-access/jna#1724): Fix `host_page_size` in `c.s.j.p.mac.SystemB` and `getxattr`/`setxattr`/`listxattr` in `c.s.j.p.mac.XAttr` using `long` instead of pointer-sized types for `size_t`/`ssize_t` parameters - [@​dbwiddis](https://github.com/dbwiddis). - [#​1727](java-native-access/jna#1727): Include DragonFlyBSD in `NativeLibrary` versioned library resolution, libc special-case loading, and 64-bit search paths - [@​dbwiddis](https://github.com/dbwiddis). - [#​1709](java-native-access/jna#1709): Rebuild native library for OpenBSD 7.9 x86-64, drop OpenBSD x86 - [@​matthiasblaesing](https://github.com/matthiasblaesing). </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 9am on tuesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE3NS4xIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> Reviewed-on: https://code.futo.org/harbor/harbor/pulls/1820 Reviewed-by: Mark Harding <[email protected]>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [net.java.dev.jna:jna](https://github.com/java-native-access/jna) | `5.18.1` → `5.19.1` |  |  | --- ### Release Notes <details> <summary>java-native-access/jna (net.java.dev.jna:jna)</summary> ### [`v5.19.1`](https://github.com/java-native-access/jna/blob/HEAD/CHANGES.md#Release-5191) [Compare Source](java-native-access/jna@5.19.0...5.19.1) \============== ## Bug Fixes - [#​1730](java-native-access/jna#1730): Replace usage of `MethodHandle` with reflection to restore support for older Android releases - [@​matthiasblaesing](https://github.com/matthiasblaesing). ### [`v5.19.0`](https://github.com/java-native-access/jna/blob/HEAD/CHANGES.md#Release-5190) [Compare Source](java-native-access/jna@5.18.1...5.19.0) \============== ## Features - [#​1696](java-native-access/jna#1696): Add `LARGE_INTEGER.ByValue` to `LARGE_INTEGER` in `WinNT.java` - [@​baier233](https://github.com/baier233). - [#​1697](java-native-access/jna#1697): Add WlanApi module - [@​eranl](https://github.com/eranl). - [#​1718](java-native-access/jna#1718): Add `Cups` to `c.s.j.p.unix` providing CUPS printing system bindings for destinations, jobs, options, and server configuration - [@​dbwiddis](https://github.com/dbwiddis). - [#​1720](java-native-access/jna#1720): Add `groupCount` and `groupMasks` fields to `CACHE_RELATIONSHIP` in `c.s.j.p.win32.WinNT`, matching the updated Windows struct layout - [@​dbwiddis](https://github.com/dbwiddis). - [#​1719](java-native-access/jna#1719): Add `CoreGraphics` to `c.s.j.p.mac` with Quartz Window Services and Display Services bindings; implement `getAllWindows()` in `MacWindowUtils` - [@​dbwiddis](https://github.com/dbwiddis). - [#​1723](java-native-access/jna#1723): Add `ProcFdInfo`, `InSockInfo`, `TcpSockInfo`, `proc_pidfdinfo`, `statfs64`, and `vm_deallocate` to `c.s.j.p.mac.SystemB` - [@​dbwiddis](https://github.com/dbwiddis). - [#​1725](java-native-access/jna#1725): Add `BluetoothApis` to `c.s.j.p.win32` providing Bluetooth device and radio enumeration via `BluetoothFindFirstRadio`, `BluetoothFindFirstDevice`, and related functions - [@​dbwiddis](https://github.com/dbwiddis). ## Bug Fixes - [#​1644](java-native-access/jna#1644): Fix bug in VARDESC and TYPEDESC causing an illegal memory access - [@​lwahonen](https://github.com/lwahonen) - [#​1715](java-native-access/jna#1715): Fix `UdevDevice.getSysname()` calling `udev_device_get_syspath` instead of `udev_device_get_sysname` - [@​dbwiddis](https://github.com/dbwiddis). - [#​1721](java-native-access/jna#1721): Fix switched `serverName`/`domainName` arguments in `Netapi32Util#getDCName` - [@​dbwiddis](https://github.com/dbwiddis). - [#​1722](java-native-access/jna#1722): Fix `Advapi32#RegisterServiceCtrlHandler` using wrong `Handler` type - [@​dbwiddis](https://github.com/dbwiddis). - [#​1636](java-native-access/jna#1636): Drop hard dependency on java.lang.SecurityManager/java.security.AccessController - [@​matthiasblaesing](https://github.com/matthiasblaesing). - [#​1724](java-native-access/jna#1724): Fix `host_page_size` in `c.s.j.p.mac.SystemB` and `getxattr`/`setxattr`/`listxattr` in `c.s.j.p.mac.XAttr` using `long` instead of pointer-sized types for `size_t`/`ssize_t` parameters - [@​dbwiddis](https://github.com/dbwiddis). - [#​1727](java-native-access/jna#1727): Include DragonFlyBSD in `NativeLibrary` versioned library resolution, libc special-case loading, and 64-bit search paths - [@​dbwiddis](https://github.com/dbwiddis). - [#​1709](java-native-access/jna#1709): Rebuild native library for OpenBSD 7.9 x86-64, drop OpenBSD x86 - [@​matthiasblaesing](https://github.com/matthiasblaesing). </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 9am on tuesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE3NS4xIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> Reviewed-on: https://code.futo.org/harbor/harbor/pulls/1820 Reviewed-by: Mark Harding <[email protected]>
Adds macOS process/socket information structs and methods to
c.s.j.p.mac.SystemB.Most mappings have been in use by OSHI since 2020, finally catching up on my upstream contributions.
vm_deallocate(yes I had a memory leak for a decade) andstatfs64are recent additions.Changes
c.s.j.p.mac.SystemB:ProcFdInfoInSockInfoTcpSockInfoproc_pidfdinfo(),statfs64(),vm_deallocate()methodsPROC_PIDLISTFDS,PROC_PIDFDSOCKETINFO,PROX_FDTYPE_SOCKET,SOCKINFO_IN,SOCKINFO_TCP,TSI_T_NTIMERS,AF_INET,AF_INET6Reference headers
sys/proc_info.h:struct proc_fdinfo,struct in_sockinfo,struct tcp_sockinfo,PROC_PIDLISTFDS,PROC_PIDFDSOCKETINFO,PROX_FDTYPE_SOCKET,TSI_T_NTIMERS