Skip to content

Commit

Permalink
Revert "runtime: add padding to Linux kernel structures"
Browse files Browse the repository at this point in the history
This reverts commit f0db7ea.

Reason for revert: Breaks linux-386 tests

Change-Id: Ia51fbf97460ab52920b67d6db6177ac2d6b0058e
Reviewed-on: https://go-review.googlesource.com/c/go/+/353432
Trust: Michael Pratt <[email protected]>
Run-TryBot: Michael Pratt <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Bryan C. Mills <[email protected]>
  • Loading branch information
prattmic committed Oct 4, 2021
1 parent d9952ff commit 7ee4c16
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 122 deletions.
11 changes: 0 additions & 11 deletions src/runtime/defs_linux_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

package runtime

import "internal/goarch"

const (
_EINTR = 0x4
_EAGAIN = 0xb
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions src/runtime/defs_linux_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

package runtime

import "internal/goarch"

const (
_EINTR = 0x4
_EAGAIN = 0xb
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions src/runtime/defs_linux_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

package runtime

import "internal/goarch"

// Constants
const (
_EINTR = 0x4
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions src/runtime/defs_linux_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

package runtime

import "internal/goarch"

const (
_EINTR = 0x4
_EAGAIN = 0xb
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions src/runtime/defs_linux_mips64x.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

package runtime

import "internal/goarch"

const (
_EINTR = 0x4
_EAGAIN = 0xb
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions src/runtime/defs_linux_mipsx.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

package runtime

import "internal/goarch"

const (
_EINTR = 0x4
_EAGAIN = 0xb
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions src/runtime/defs_linux_ppc64.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

package runtime

import "internal/goarch"

const (
_EINTR = 0x4
_EAGAIN = 0xb
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions src/runtime/defs_linux_ppc64le.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

package runtime

import "internal/goarch"

const (
_EINTR = 0x4
_EAGAIN = 0xb
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions src/runtime/defs_linux_riscv64.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

package runtime

import "internal/goarch"

const (
_EINTR = 0x4
_EAGAIN = 0xb
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions src/runtime/defs_linux_s390x.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

package runtime

import "internal/goarch"

const (
_EINTR = 0x4
_EAGAIN = 0xb
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
12 changes: 0 additions & 12 deletions src/runtime/os_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7ee4c16

Please sign in to comment.