mksysinfo: use rlimit64 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.
    
    Reviewed-on: https://go-review.googlesource.com/88076

From-SVN: r256877
This commit is contained in:
Ian Lance Taylor 2018-01-19 05:09:43 +00:00
parent 5d15877758
commit 2a3abc862a
4 changed files with 19 additions and 5 deletions

View File

@ -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.

View File

@ -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) $@

View File

@ -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) $@

View File

@ -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 | \