From 01636cf3fd35787cf6df449414d5db00b3e89692 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 14 Dec 2022 14:36:46 -0500 Subject: [PATCH] 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 Run-TryBot: Bryan Mills Reviewed-by: Tobias Klauser Reviewed-by: Ian Lance Taylor Auto-Submit: Bryan Mills --- src/syscall/mkpost.go | 10 ++++++++-- src/syscall/ztypes_linux_riscv64.go | 2 +- src/syscall/ztypes_linux_s390x.go | 14 +++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/syscall/mkpost.go b/src/syscall/mkpost.go index 4f81b81b57..48d3511f54 100644 --- a/src/syscall/mkpost.go +++ b/src/syscall/mkpost.go @@ -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. diff --git a/src/syscall/ztypes_linux_riscv64.go b/src/syscall/ztypes_linux_riscv64.go index 6ee71ebbdc..f6b9cede0e 100644 --- a/src/syscall/ztypes_linux_riscv64.go +++ b/src/syscall/ztypes_linux_riscv64.go @@ -566,7 +566,7 @@ type Sysinfo_t struct { Totalhigh uint64 Freehigh uint64 Unit uint32 - _ [0]uint8 + X_f [0]uint8 _ [4]byte } diff --git a/src/syscall/ztypes_linux_s390x.go b/src/syscall/ztypes_linux_s390x.go index 91f5ceff20..b67877f065 100644 --- a/src/syscall/ztypes_linux_s390x.go +++ b/src/syscall/ztypes_linux_s390x.go @@ -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 } -- 2.48.1