libgo: Try to guess the right type for select bits in mksysinfo.

From-SVN: r171858
This commit is contained in:
Ian Lance Taylor 2011-04-01 22:53:54 +00:00
parent 15a03a11ce
commit 4ac7fcaac0
4 changed files with 15 additions and 4 deletions

2
libgo/configure vendored
View File

@ -14228,7 +14228,7 @@ no)
;;
esac
for ac_header in sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h
for ac_header in sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"

View File

@ -417,7 +417,7 @@ no)
;;
esac
AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h)
AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h)
AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
AC_CHECK_FUNCS(srandom random strerror_r strsignal wait4)

View File

@ -73,6 +73,9 @@ cat > sysinfo.c <<EOF
#if defined(HAVE_SYS_UTSNAME_H)
#include <sys/utsname.h>
#endif
#if defined(HAVE_SYS_SELECT_H)
#include <sys/select.h>
#endif
#include <unistd.h>
EOF
@ -438,4 +441,12 @@ grep '^type _ip_mreq ' gen-sysinfo.go | \
-e 's/_in_addr/[4]byte/g' \
>> ${OUT}
# Try to guess the type to use for fd_set.
fd_set=`grep '^type _fd_set ' gen-sysinfo.go || true`
fds_bits_type="_C_long"
if test "$fd_set" != ""; then
fds_bits_type=`echo $fd_set | sed -e 's/.*[]]\([^;]*\); }$/\1/'`
fi
echo "type fds_bits_type $fds_bits_type" >> ${OUT}
exit $?

View File

@ -181,10 +181,10 @@ func Gettimeofday(tv *Timeval) (errno int) {
return;
}
const nfdbits = unsafe.Sizeof(_C_long) * 8
const nfdbits = unsafe.Sizeof(fds_bits_type) * 8
type FdSet_t struct {
Fds_bits [(FD_SETSIZE + nfdbits - 1) / nfdbits]_C_long
Fds_bits [(FD_SETSIZE + nfdbits - 1) / nfdbits]fds_bits_type
}
func FDSet(fd int, set *FdSet_t) {