sysinfo: add Flags to Statfs_t if not already there
If there is no f_flags field in statfs_t then rename one of the
f_spare fields, as happened in Linux kernel version 2.6.36. This
fixes the build on CentOS 5.11. The CentOS kernel will hopefully not
fill in the f_spare field, so the resulting flags will be zero.
Change-Id: Icfa5ea067d4b296ce1b36a4abb357c106f180bf9
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165417
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 1273d9b..e0ae30f 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -1113,7 +1113,11 @@
# The statfs struct.
# Prefer largefile variant if available.
+# CentOS 5 does not have f_flags, so pull from f_spare.
statfs=`grep '^type _statfs64 ' gen-sysinfo.go || true`
+if ! echo "$statfs" | grep f_flags; then
+ statfs=`echo "$statfs" | sed -e 's/f_spare \[4+1\]\([^ ;]*\)/f_flags \1; f_spare [3+1]\1/'`
+fi
if test "$statfs" != ""; then
grep '^type _statfs64 ' gen-sysinfo.go
else