Skip to content

Commit

Permalink
go: syscall: export X__ifi_pad and X_f on s390x and riscv64
Browse files Browse the repository at this point in the history
Commit: 01636cf3fd35787cf6df449414d5db00b3e89692
  • Loading branch information
Bryan C. Mills authored and sourcegraph-bot committed Jan 25, 2023
1 parent c4c8c42 commit 40cd578
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
10 changes: 8 additions & 2 deletions go/src/syscall/mkpost.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion go/src/syscall/ztypes_linux_riscv64.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ type Sysinfo_t struct {
Totalhigh uint64
Freehigh uint64
Unit uint32
_ [0]uint8
X_f [0]uint8
_ [4]byte
}

Expand Down
14 changes: 7 additions & 7 deletions go/src/syscall/ztypes_linux_s390x.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -564,7 +564,7 @@ type Sysinfo_t struct {
Totalhigh uint64
Freehigh uint64
Unit uint32
_ [0]uint8
X_f [0]uint8
_ [4]byte
}

Expand Down

0 comments on commit 40cd578

Please sign in to comment.