aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/defs_linux_ppc64.go
diff options
context:
space:
mode:
authorRhys Hiltner <rhys@justin.tv>2021-09-29 17:35:27 -0700
committerMichael Pratt <mpratt@google.com>2021-10-04 21:10:16 +0000
commitf0db7eae74ea235e9fbc2598252bfd46c1cc5510 (patch)
tree049a87ed3f3bc9264c5942d99818e371371a5c72 /src/runtime/defs_linux_ppc64.go
parente8a85e90aca4adb472c66f8c42f6d4a41b8cca99 (diff)
downloadgo-f0db7eae74ea235e9fbc2598252bfd46c1cc5510.tar.xz
runtime: add padding to Linux kernel structures
Go exchanges siginfo and sigevent structures with the kernel. They contain unions, but Go's use is limited to the first few fields. Pad out the rest so the size Go sees is the same as what the Linux kernel sees. This is a follow-up to CL 342052 which added the sigevent struct without padding. It updates the siginfo struct as well so there are no bad examples in the defs_linux_*.go files. Change-Id: Id991d4a57826677dd7e6cc30ad113fa3b321cddf Reviewed-on: https://go-review.googlesource.com/c/go/+/353136 Run-TryBot: Rhys Hiltner <rhys@justin.tv> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Trust: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/defs_linux_ppc64.go')
-rw-r--r--src/runtime/defs_linux_ppc64.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/defs_linux_ppc64.go b/src/runtime/defs_linux_ppc64.go
index e0775e2974..7971ca7058 100644
--- a/src/runtime/defs_linux_ppc64.go
+++ b/src/runtime/defs_linux_ppc64.go
@@ -3,6 +3,8 @@
package runtime
+import "internal/goarch"
+
const (
_EINTR = 0x4
_EAGAIN = 0xb
@@ -135,6 +137,11 @@ type siginfo struct {
si_code int32
// below here is a union; si_addr is the only field we use
si_addr uint64
+
+ // Pad struct to the max size in the kernel. Account for the 3 32-bit
+ // fields, the alignment to this architecture's pointer size, and the final
+ // pointer-length field.
+ _ [_si_max_size - (3*4 + (1-4/goarch.PtrSize)*4 + 1*goarch.PtrSize)]byte
}
type itimerspec struct {
@@ -153,6 +160,10 @@ type sigevent struct {
notify int32
// below here is a union; sigev_notify_thread_id is the only field we use
sigev_notify_thread_id int32
+
+ // Pad struct to the max size in the kernel. Account for the pointer-length
+ // field and the 3 32-bit fields.
+ _ [_sigev_max_size - (1*goarch.PtrSize + 3*4)]byte
}
type epollevent struct {