diff mbox series

libgo patch committed: Use rlimit64 when we use getrlimit64

Message ID CAOyqgcXezX6fAxADFFbqUrrhJO42CtHHLpQ7bMC5uQDo96=V0A@mail.gmail.com
State New
Headers show
Series libgo patch committed: Use rlimit64 when we use getrlimit64 | expand

Commit Message

Ian Lance Taylor Jan. 19, 2018, 5:10 a.m. UTC
This libgo patch changes the syscall package to use the rlimit64 type,
if available, when we use getrlimit64.  This makes no difference on
most systems, because <sys/resource.h> renames the type appropriately
anyhow, but apparently it makes a difference on AIX.  Bootstrapped and
ran Go testsuite on x86_64-pc-linux-gnu, and got a confirmation that
this fixes the problem on AIX.  Committed to mainline.

Ian
diff mbox series

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 256875)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -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.
Index: libgo/Makefile.am
===================================================================
--- libgo/Makefile.am	(revision 256794)
+++ libgo/Makefile.am	(working copy)
@@ -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) $@
 
Index: libgo/mksysinfo.sh
===================================================================
--- libgo/mksysinfo.sh	(revision 256875)
+++ libgo/mksysinfo.sh	(working copy)
@@ -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 | \