libgo: define SO_RCVTIMEO on 32-bit GNU/Linux

Fixes golang/go#42872

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273892
This commit is contained in:
Ian Lance Taylor 2020-11-29 10:16:27 -08:00
parent 5ba975e668
commit e848a83f46
3 changed files with 13 additions and 1 deletions

View file

@ -1,4 +1,4 @@
45461eeba1db1a3b4194dc8ecc331c0e92f5ad4c be1738f1fff0e817d921ed568791f9b0585a6982
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.

View file

@ -194,6 +194,7 @@ fi
# Networking constants. # Networking constants.
egrep '^const _(AF|ARPHRD|ETH|IN|SOCK|SOL|SO|IPPROTO|TCP|IP|IPV6)_' gen-sysinfo.go | egrep '^const _(AF|ARPHRD|ETH|IN|SOCK|SOL|SO|IPPROTO|TCP|IP|IPV6)_' gen-sysinfo.go |
grep -v '_val =' |
sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
grep '^const _SOMAXCONN' gen-sysinfo.go | grep '^const _SOMAXCONN' gen-sysinfo.go |
sed -e 's/^\(const \)_\(SOMAXCONN[^= ]*\)\(.*\)$/\1\2 = _\2/' \ sed -e 's/^\(const \)_\(SOMAXCONN[^= ]*\)\(.*\)$/\1\2 = _\2/' \
@ -213,6 +214,14 @@ for m in SOCK_CLOEXEC SOCK_NONBLOCK; do
fi fi
done done
# On 32-bit GNU/Linux the expression for SO_RCVTIMEO is too complicated
# for -fdump-go-spec.
if ! grep '^const SO_RCVTIMEO ' ${OUT} >/dev/null 2>&1; then
if grep '^const _SO_RCVTIMEO_val' ${OUT} >/dev/null 2>&1; then
echo 'const SO_RCVTIMEO = _SO_RCVTIMEO_val' >> ${OUT}
fi
fi
# The syscall package requires AF_LOCAL. # The syscall package requires AF_LOCAL.
if ! grep '^const AF_LOCAL ' ${OUT} >/dev/null 2>&1; then if ! grep '^const AF_LOCAL ' ${OUT} >/dev/null 2>&1; then
if grep '^const AF_UNIX ' ${OUT} >/dev/null 2>&1; then if grep '^const AF_UNIX ' ${OUT} >/dev/null 2>&1; then

View file

@ -337,6 +337,9 @@ enum {
#ifdef BIOCVERSION #ifdef BIOCVERSION
BIOCVERSION_val = BIOCVERSION, BIOCVERSION_val = BIOCVERSION,
#endif #endif
#ifdef SO_RCVTIMEO
SO_RCVTIMEO_val = SO_RCVTIMEO,
#endif
}; };
// SIOCGIFMTU can't be added in the above enum as it might // SIOCGIFMTU can't be added in the above enum as it might