From 2a3abc862a30fbb76db90bac333d8c4070a03df3 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 19 Jan 2018 05:09:43 +0000 Subject: [PATCH] mksysinfo: use rlimit64 if available when we use getrlimit64 This makes no difference on most systems, because renames the type appropriately anyhow, but apparently it makes a difference on AIX. Reviewed-on: https://go-review.googlesource.com/88076 From-SVN: r256877 --- gcc/go/gofrontend/MERGE | 2 +- libgo/Makefile.am | 2 +- libgo/Makefile.in | 2 +- libgo/mksysinfo.sh | 18 ++++++++++++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 9cc81888c8c..a66fe24dfe2 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -bce8720d4eb662f31026e9c7be6ce4d0aeb4ae3b +87525458bcd5ab4beb5b95e7d58e3dfdbc1bd478 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 16ccf9caa13..88be5dbb00a 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -674,7 +674,7 @@ s-errno: sysinfo.go: s-sysinfo; @true s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i - GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh + GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go $(STAMP) $@ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 7a02fa64029..471a047f831 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -3241,7 +3241,7 @@ s-errno: sysinfo.go: s-sysinfo; @true s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i - GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh + GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go $(STAMP) $@ diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index a384e401154..6f7cba72494 100755 --- a/libgo/mksysinfo.sh +++ b/libgo/mksysinfo.sh @@ -1120,8 +1120,16 @@ if test "$timex" != ""; then fi # The rlimit struct. -grep '^type _rlimit ' gen-sysinfo.go | \ - sed -e 's/_rlimit/Rlimit/' \ +# On systems that use syscall/libcall_posix_largefile.go, use rlimit64 +# if it exists. +rlimit="_rlimit" +if test "${GOOS}" = "aix" || test "${GOOS}" = "linux" || (test "${GOOS}" = "solaris" && (test "${GOARCH}" = "386" || test "${GOARCH}" = "sparc")); then + if grep '^type _rlimit64 ' gen-sysinfo.go > /dev/null 2>&1; then + rlimit="_rlimit64" + fi +fi +grep "^type ${rlimit} " gen-sysinfo.go | \ + sed -e "s/${rlimit}/Rlimit/" \ -e 's/rlim_cur/Cur/' \ -e 's/rlim_max/Max/' \ >> ${OUT} @@ -1130,7 +1138,13 @@ grep '^type _rlimit ' gen-sysinfo.go | \ grep '^const _RLIMIT_' gen-sysinfo.go | sed -e 's/^\(const \)_\(RLIMIT_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} grep '^const _RLIM_' gen-sysinfo.go | + grep -v '^const _RLIM_INFINITY ' | sed -e 's/^\(const \)_\(RLIM_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} +if test "${rlimit}" = "_rlimit64" && grep '^const _RLIM64_INFINITY ' gen-sysinfo.go > /dev/null 2>&1; then + echo 'const RLIM_INFINITY = _RLIM64_INFINITY' >> ${OUT} +elif grep '^const _RLIM_INFINITY ' gen-sysinfo-go; then + echo 'const RLIM_INFINITY = _RLIM_INFINITY' >> ${OUT} +fi # The sysinfo struct. grep '^type _sysinfo ' gen-sysinfo.go | \ -- 2.30.2