windows: use GOARCH-specific JOBOBJECT_BASIC_LIMIT_INFORMATION
The Windows compilers appear to align JOBOBJECT_BASIC_LIMIT_INFORMATION
to an 8-byte boundary, which on 32-bit systems means adding 32 bits of
padding. Unfortunately we can't always add a padding field, because
no padding is required on a 64-bit system. So use different versions
of the struct for different targets.
Fixes golang/go#41001
Change-Id: I38d14edfd3f3a80da22825455f20e1f7de136638
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251197
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Marc-Antoine Ruel <maruel@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
diff --git a/windows/types_windows.go b/windows/types_windows.go
index 809fff0..da1652e 100644
--- a/windows/types_windows.go
+++ b/windows/types_windows.go
@@ -1584,18 +1584,6 @@
JOB_OBJECT_LIMIT_WORKINGSET = 0x00000001
)
-type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
- PerProcessUserTimeLimit int64
- PerJobUserTimeLimit int64
- LimitFlags uint32
- MinimumWorkingSetSize uintptr
- MaximumWorkingSetSize uintptr
- ActiveProcessLimit uint32
- Affinity uintptr
- PriorityClass uint32
- SchedulingClass uint32
-}
-
type IO_COUNTERS struct {
ReadOperationCount uint64
WriteOperationCount uint64
diff --git a/windows/types_windows_386.go b/windows/types_windows_386.go
index fe0ddd0..8bce3e2 100644
--- a/windows/types_windows_386.go
+++ b/windows/types_windows_386.go
@@ -20,3 +20,16 @@
Port uint16
Proto *byte
}
+
+type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
+ PerProcessUserTimeLimit int64
+ PerJobUserTimeLimit int64
+ LimitFlags uint32
+ MinimumWorkingSetSize uintptr
+ MaximumWorkingSetSize uintptr
+ ActiveProcessLimit uint32
+ Affinity uintptr
+ PriorityClass uint32
+ SchedulingClass uint32
+ _ uint32 // pad to 8 byte boundary
+}
diff --git a/windows/types_windows_amd64.go b/windows/types_windows_amd64.go
index 7e154c2..fdddc0c 100644
--- a/windows/types_windows_amd64.go
+++ b/windows/types_windows_amd64.go
@@ -20,3 +20,15 @@
Proto *byte
Port uint16
}
+
+type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
+ PerProcessUserTimeLimit int64
+ PerJobUserTimeLimit int64
+ LimitFlags uint32
+ MinimumWorkingSetSize uintptr
+ MaximumWorkingSetSize uintptr
+ ActiveProcessLimit uint32
+ Affinity uintptr
+ PriorityClass uint32
+ SchedulingClass uint32
+}
diff --git a/windows/types_windows_arm.go b/windows/types_windows_arm.go
index 74571e3..321872c 100644
--- a/windows/types_windows_arm.go
+++ b/windows/types_windows_arm.go
@@ -20,3 +20,16 @@
Port uint16
Proto *byte
}
+
+type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
+ PerProcessUserTimeLimit int64
+ PerJobUserTimeLimit int64
+ LimitFlags uint32
+ MinimumWorkingSetSize uintptr
+ MaximumWorkingSetSize uintptr
+ ActiveProcessLimit uint32
+ Affinity uintptr
+ PriorityClass uint32
+ SchedulingClass uint32
+ _ uint32 // pad to 8 byte boundary
+}