]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "runtime: add padding to Linux kernel structures"
authorMichael Pratt <mpratt@google.com>
Mon, 4 Oct 2021 21:44:08 +0000 (21:44 +0000)
committerMichael Pratt <mpratt@google.com>
Mon, 4 Oct 2021 22:08:53 +0000 (22:08 +0000)
This reverts commit f0db7eae74ea235e9fbc2598252bfd46c1cc5510.

Reason for revert: Breaks linux-386 tests

Change-Id: Ia51fbf97460ab52920b67d6db6177ac2d6b0058e
Reviewed-on: https://go-review.googlesource.com/c/go/+/353432
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/runtime/defs_linux_386.go
src/runtime/defs_linux_amd64.go
src/runtime/defs_linux_arm.go
src/runtime/defs_linux_arm64.go
src/runtime/defs_linux_mips64x.go
src/runtime/defs_linux_mipsx.go
src/runtime/defs_linux_ppc64.go
src/runtime/defs_linux_ppc64le.go
src/runtime/defs_linux_riscv64.go
src/runtime/defs_linux_s390x.go
src/runtime/os_linux.go

index fd9b60c444f4c409b6024f4084bf207d08b7a141..d8b546cb4c7652a01f2e2a4011fcfc872e5169eb 100644 (file)
@@ -3,8 +3,6 @@
 
 package runtime
 
-import "internal/goarch"
-
 const (
        _EINTR  = 0x4
        _EAGAIN = 0xb
@@ -174,11 +172,6 @@ type siginfo struct {
        si_code  int32
        // below here is a union; si_addr is the only field we use
        si_addr uint32
-
-       // 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 stackt struct {
@@ -242,10 +235,6 @@ 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 {
index 29dabe08dd27450711818aab6ee628cfe21a8fbd..6afb67f77f474c5bf696b35506fa41da472b99b1 100644 (file)
@@ -3,8 +3,6 @@
 
 package runtime
 
-import "internal/goarch"
-
 const (
        _EINTR  = 0x4
        _EAGAIN = 0xb
@@ -136,11 +134,6 @@ 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 {
@@ -159,10 +152,6 @@ 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 {
index 3ed694064717b29e361a7649cb60de86fd57dde4..ec24d76326e2fb3944fbd7f9cf89e333bc13a3d8 100644 (file)
@@ -4,8 +4,6 @@
 
 package runtime
 
-import "internal/goarch"
-
 // Constants
 const (
        _EINTR  = 0x4
@@ -177,10 +175,6 @@ 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 siginfo struct {
@@ -189,11 +183,6 @@ type siginfo struct {
        si_code  int32
        // below here is a union; si_addr is the only field we use
        si_addr uint32
-
-       // 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 sigactiont struct {
index 6a126c4a154512c10894547b0ed7a5ccbb12f805..f9f175004bc72adc6d03e9b8b728161c76ee441a 100644 (file)
@@ -3,8 +3,6 @@
 
 package runtime
 
-import "internal/goarch"
-
 const (
        _EINTR  = 0x4
        _EAGAIN = 0xb
@@ -136,11 +134,6 @@ 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 {
@@ -159,10 +152,6 @@ 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 {
index 34e803331ceb3073378d8698a2be3ebc481dbac6..1743bbce4192c4bc756e470007b60f57afd371e5 100644 (file)
@@ -8,8 +8,6 @@
 
 package runtime
 
-import "internal/goarch"
-
 const (
        _EINTR  = 0x4
        _EAGAIN = 0xb
@@ -145,11 +143,6 @@ type siginfo struct {
        __pad0   [1]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 {
@@ -168,10 +161,6 @@ 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 {
index 7a7db7f18187ee7c52598aa73b5158c61651a322..e84d4979e1328c53a3934f0009cc5e10b5cf504d 100644 (file)
@@ -8,8 +8,6 @@
 
 package runtime
 
-import "internal/goarch"
-
 const (
        _EINTR  = 0x4
        _EAGAIN = 0xb
@@ -139,11 +137,6 @@ type siginfo struct {
        si_errno int32
        // below here is a union; si_addr is the only field we use
        si_addr uint32
-
-       // 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 {
@@ -162,10 +155,6 @@ 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 {
index 7971ca705892a4182dad28af8a94f3d0e98bb603..e0775e297434bc1302390567fc49387657c03f64 100644 (file)
@@ -3,8 +3,6 @@
 
 package runtime
 
-import "internal/goarch"
-
 const (
        _EINTR  = 0x4
        _EAGAIN = 0xb
@@ -137,11 +135,6 @@ 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 {
@@ -160,10 +153,6 @@ 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 {
index 7971ca705892a4182dad28af8a94f3d0e98bb603..e0775e297434bc1302390567fc49387657c03f64 100644 (file)
@@ -3,8 +3,6 @@
 
 package runtime
 
-import "internal/goarch"
-
 const (
        _EINTR  = 0x4
        _EAGAIN = 0xb
@@ -137,11 +135,6 @@ 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 {
@@ -160,10 +153,6 @@ 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 {
index 92f4563dd5247c3009a3ec80d81956187346a384..1052213a4c768483205f6cab987a390e6e5e38e5 100644 (file)
@@ -4,8 +4,6 @@
 
 package runtime
 
-import "internal/goarch"
-
 const (
        _EINTR  = 0x4
        _EAGAIN = 0xb
@@ -134,11 +132,6 @@ 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 {
@@ -157,10 +150,6 @@ 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 {
index 8a56ef0b8052d70efb58465fe27194eb5f4a0c2b..b072955d4a3e2625ab08ae002d161f5fd0c41c38 100644 (file)
@@ -4,8 +4,6 @@
 
 package runtime
 
-import "internal/goarch"
-
 const (
        _EINTR  = 0x4
        _EAGAIN = 0xb
@@ -133,11 +131,6 @@ 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 {
@@ -156,10 +149,6 @@ 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 {
index d5a5ff763bd0593867f1c760fd6b7eeba9620ee6..06773c21939404f28abc7140dd055064402edbda 100644 (file)
@@ -440,18 +440,6 @@ func pipe() (r, w int32, errno int32)
 func pipe2(flags int32) (r, w int32, errno int32)
 func setNonblock(fd int32)
 
-const (
-       _si_max_size    = 128
-       _sigev_max_size = 64
-)
-
-// Assert that the Go definitions of structures exchanged with the kernel are
-// the same size as what the kernel defines.
-var (
-       _ [_si_max_size]struct{}    = [unsafe.Sizeof(siginfo{})]struct{}{}
-       _ [_sigev_max_size]struct{} = [unsafe.Sizeof(sigevent{})]struct{}{}
-)
-
 //go:nosplit
 //go:nowritebarrierrec
 func setsig(i uint32, fn uintptr) {