re PR go/52586 (libgo fails to build for mips*64-linux-gnu (reference to undefined name 'SYS_GETDENTS64'))
PR go/52586 mksysinfo, syscall: Make sure SYS_GETDENTS64 is defined. Fixes build on MIPS GNU/Linux. From-SVN: r186986
This commit is contained in:
parent
b944e97a92
commit
81b9589421
2 changed files with 13 additions and 1 deletions
|
@ -203,7 +203,11 @@ func Getdents(fd int, buf []byte) (n int, err error) {
|
||||||
p = (*byte)(unsafe.Pointer(&_zero))
|
p = (*byte)(unsafe.Pointer(&_zero))
|
||||||
}
|
}
|
||||||
Entersyscall()
|
Entersyscall()
|
||||||
r1, _, errno := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(len(buf)))
|
s := SYS_GETDENTS64
|
||||||
|
if s == 0 {
|
||||||
|
s = SYS_GETDENTS
|
||||||
|
}
|
||||||
|
r1, _, errno := Syscall(uintptr(s), uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(len(buf)))
|
||||||
n = int(r1)
|
n = int(r1)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
err = errno
|
err = errno
|
||||||
|
|
|
@ -224,6 +224,14 @@ grep '^const _SYS_' gen-sysinfo.go | \
|
||||||
echo "const $sup = _$sys" >> ${OUT}
|
echo "const $sup = _$sys" >> ${OUT}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# The GNU/Linux support wants to use SYS_GETDENTS64 if available.
|
||||||
|
if ! grep '^const SYS_GETDENTS ' ${OUT} >/dev/null 2>&1; then
|
||||||
|
echo "const SYS_GETDENTS = 0" >> ${OUT}
|
||||||
|
fi
|
||||||
|
if ! grep '^const SYS_GETDENTS64 ' ${OUT} >/dev/null 2>&1; then
|
||||||
|
echo "const SYS_GETDENTS64 = 0" >> ${OUT}
|
||||||
|
fi
|
||||||
|
|
||||||
# Stat constants.
|
# Stat constants.
|
||||||
grep '^const _S_' gen-sysinfo.go | \
|
grep '^const _S_' gen-sysinfo.go | \
|
||||||
sed -e 's/^\(const \)_\(S_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
|
sed -e 's/^\(const \)_\(S_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
|
||||||
|
|
Loading…
Add table
Reference in a new issue