From e0c6998df7e52453d088b8dd1eb22ee43ba6b718 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 27 Aug 2020 14:35:50 -0700 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Marc-Antoine Ruel Reviewed-by: Alex Brainman --- windows/types_windows.go | 12 ------------ windows/types_windows_386.go | 13 +++++++++++++ windows/types_windows_amd64.go | 12 ++++++++++++ windows/types_windows_arm.go | 13 +++++++++++++ 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/windows/types_windows.go b/windows/types_windows.go index 809fff0b..da1652e7 100644 --- a/windows/types_windows.go +++ b/windows/types_windows.go @@ -1584,18 +1584,6 @@ const ( 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 fe0ddd03..8bce3e2f 100644 --- a/windows/types_windows_386.go +++ b/windows/types_windows_386.go @@ -20,3 +20,16 @@ type Servent struct { 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 7e154c2d..fdddc0c7 100644 --- a/windows/types_windows_amd64.go +++ b/windows/types_windows_amd64.go @@ -20,3 +20,15 @@ type Servent struct { 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 74571e36..321872c3 100644 --- a/windows/types_windows_arm.go +++ b/windows/types_windows_arm.go @@ -20,3 +20,16 @@ type Servent struct { 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 +}