Skip to content

Commit

Permalink
Add partial support for future values of LOGICAL_PROCESSOR_RELATIONSH…
Browse files Browse the repository at this point in the history
…IP (#1327)

* Add partial support for future values of LOGICAL_PROCESSOR_RELATIONSHIP

* Map not fully implemented values to an UNKNOWN_RELATIONSHIP
  • Loading branch information
dbwiddis authored Mar 17, 2021
1 parent 7f4a33e commit 58bc0a0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Features
--------
* [#1313](https://github.com/java-native-access/jna/issues/1313): Normalize `RESOURCE_PREFIX` for darwin to `darwin-$arch` and split jnidispatch library per architecture - [@matthiasblaesing](https://github.com/matthiasblaesing).
* [#1318](https://github.com/java-native-access/jna/pull/1318): Add support for linux-risc64 - [@thentschel](https://github.com/thentschel).
* [#1327](https://github.com/java-native-access/jna/pull/1327): Add partial support for future values of `c.s.j.p.win32.WinNT.LOGICAL_PROCESSOR_RELATIONSHIP` enum present in Windows Insider builds - [@dbwiddis](https://github.com/dbwiddis).

Bug Fixes
---------
Expand Down
45 changes: 43 additions & 2 deletions contrib/platform/src/com/sun/jna/platform/win32/WinNT.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import com.sun.jna.PointerType;
import com.sun.jna.Structure;
import com.sun.jna.Structure.FieldOrder;
import com.sun.jna.platform.win32.WinNT.PSID;
import com.sun.jna.Union;
import com.sun.jna.ptr.ByReference;
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
Expand Down Expand Up @@ -3030,7 +3029,7 @@ public static SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX fromPointer(Pointer memory
result = new GROUP_RELATIONSHIP(memory);
break;
default:
throw new IllegalStateException("Unmapped relationship: " + relationship);
result = new UNKNOWN_RELATIONSHIP(memory);
}
result.read();
return result;
Expand Down Expand Up @@ -3253,6 +3252,24 @@ public void read() {
}
}

/**
* Represents information associated with a
* {@link LOGICAL_PROCESSOR_RELATIONSHIP} enum value which has not yet been
* mapped. Only the fields from {@link SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX}
* are populated.
*/
@FieldOrder({})
public static class UNKNOWN_RELATIONSHIP extends SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX {

public UNKNOWN_RELATIONSHIP() {
super();
}

public UNKNOWN_RELATIONSHIP(Pointer memory) {
super(memory);
}
}

/**
* Represents a processor group-specific affinity, such as the affinity of a
* thread.
Expand Down Expand Up @@ -3359,6 +3376,30 @@ public interface LOGICAL_PROCESSOR_RELATIONSHIP {
*/
int RelationGroup = 4;

/**
* <p>
* Upcoming value of this enum added for forward compatibility. Documentation
* will be added when available.
* </p>
*/
int RelationProcessorDie = 5;

/**
* <p>
* Upcoming value of this enum added for forward compatibility. Documentation
* will be added when available.
* </p>
*/
int RelationNumaNodeEx = 6;

/**
* <p>
* Upcoming value of this enum added for forward compatibility. Documentation
* will be added when available.
* </p>
*/
int RelationProcessorModule = 7;

/**
* <p>On input, retrieves information about all possible relation types. This value is not used on output.</p>
*
Expand Down

0 comments on commit 58bc0a0

Please sign in to comment.