aboutsummaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/sys/unix/mkpost.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-02-13 01:17:35 +0100
committerDimitri Sokolyuk <demon@dim13.org>2018-02-13 01:17:35 +0100
commitc32d9bf24c3b670c3a56ea55aeefb6232f3d4ec8 (patch)
treef9891ff5b851d40c2f48c8e73e36e32197bfcc89 /vendor/golang.org/x/sys/unix/mkpost.go
parent886201867ac7383535c08d81dbabc6c9c77fe855 (diff)
switch to subcommands
Diffstat (limited to 'vendor/golang.org/x/sys/unix/mkpost.go')
-rw-r--r--vendor/golang.org/x/sys/unix/mkpost.go19
1 files changed, 14 insertions, 5 deletions
diff --git a/vendor/golang.org/x/sys/unix/mkpost.go b/vendor/golang.org/x/sys/unix/mkpost.go
index d3ff659..23590bd 100644
--- a/vendor/golang.org/x/sys/unix/mkpost.go
+++ b/vendor/golang.org/x/sys/unix/mkpost.go
@@ -56,14 +56,23 @@ func main() {
removeFieldsRegex := regexp.MustCompile(`X__glibc\S*`)
b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
+ // Convert [65]int8 to [65]byte in Utsname members to simplify
+ // conversion to string; see golang.org/issue/20753
+ convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`)
+ b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte"))
+
+ // Remove spare fields (e.g. in Statx_t)
+ spareFieldsRegex := regexp.MustCompile(`X__spare\S*`)
+ b = spareFieldsRegex.ReplaceAll(b, []byte("_"))
+
+ // Remove cgo padding fields
+ removePaddingFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`)
+ b = removePaddingFieldsRegex.ReplaceAll(b, []byte("_"))
+
// We refuse to export private fields on s390x
if goarch == "s390x" && goos == "linux" {
- // Remove cgo padding fields
- removeFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`)
- b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
-
// Remove padding, hidden, or unused fields
- removeFieldsRegex = regexp.MustCompile(`X_\S+`)
+ removeFieldsRegex = regexp.MustCompile(`\bX_\S+`)
b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
}