1
0
mirror of https://github.com/golang/go synced 2024-11-17 00:14:50 -07:00

syscall: export X__ifi_pad and X_f on s390x and riscv64

This brings the exported field names on these GOARCHes
in line with the other supported linux platforms.

Fixes #57313.

Change-Id: I2107a7116ba60dc0c0a27f776318e3eb69e51682
Reviewed-on: https://go-review.googlesource.com/c/go/+/457557
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
This commit is contained in:
Bryan C. Mills 2022-12-14 14:36:46 -05:00 committed by Gopher Robot
parent a37672bb7b
commit 01636cf3fd
3 changed files with 16 additions and 10 deletions

View File

@ -40,15 +40,21 @@ func main() {
re = regexp.MustCompile("Pad_cgo[A-Za-z0-9_]*")
s = re.ReplaceAllString(s, "_")
// We want to keep X__val in Fsid. Hide it and restore it later.
// We want to keep the X_ fields that are already consistently exported
// for the other linux GOARCH settings.
// Hide them and restore later.
s = strings.Replace(s, "X__val", "MKPOSTFSIDVAL", 1)
s = strings.Replace(s, "X__ifi_pad", "MKPOSTIFIPAD", 1)
s = strings.Replace(s, "X_f", "MKPOSTSYSINFOTF", 1)
// Replace other unwanted fields with blank identifiers.
re = regexp.MustCompile("X_[A-Za-z0-9_]*")
s = re.ReplaceAllString(s, "_")
// Restore X__val in Fsid.
// Restore preserved fields.
s = strings.Replace(s, "MKPOSTFSIDVAL", "X__val", 1)
s = strings.Replace(s, "MKPOSTIFIPAD", "X__ifi_pad", 1)
s = strings.Replace(s, "MKPOSTSYSINFOTF", "X_f", 1)
// Force the type of RawSockaddr.Data to [14]int8 to match
// the existing gccgo API.

View File

@ -566,7 +566,7 @@ type Sysinfo_t struct {
Totalhigh uint64
Freehigh uint64
Unit uint32
_ [0]uint8
X_f [0]uint8
_ [4]byte
}

View File

@ -449,12 +449,12 @@ type RtAttr struct {
}
type IfInfomsg struct {
Family uint8
_ uint8
Type uint16
Index int32
Flags uint32
Change uint32
Family uint8
X__ifi_pad uint8
Type uint16
Index int32
Flags uint32
Change uint32
}
type IfAddrmsg struct {
@ -564,7 +564,7 @@ type Sysinfo_t struct {
Totalhigh uint64
Freehigh uint64
Unit uint32
_ [0]uint8
X_f [0]uint8
_ [4]byte
}