From: Ian Lance Taylor Date: Fri, 1 Apr 2011 22:53:54 +0000 (+0000) Subject: libgo: Try to guess the right type for select bits in mksysinfo. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4ac7fcaac05916bfbf58851691f9e19e288181aa;p=gcc.git libgo: Try to guess the right type for select bits in mksysinfo. From-SVN: r171858 --- diff --git a/libgo/configure b/libgo/configure index 1c70b860262..30d1cdcd5cb 100644 --- a/libgo/configure +++ b/libgo/configure @@ -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" diff --git a/libgo/configure.ac b/libgo/configure.ac index f7fa3aad281..cf0c17ff0a4 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -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) diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index ab0efe531db..77d699e75a5 100755 --- a/libgo/mksysinfo.sh +++ b/libgo/mksysinfo.sh @@ -73,6 +73,9 @@ cat > sysinfo.c < #endif +#if defined(HAVE_SYS_SELECT_H) +#include +#endif #include 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 $? diff --git a/libgo/syscalls/sysfile_posix.go b/libgo/syscalls/sysfile_posix.go index d0700574111..a16ba4aba60 100644 --- a/libgo/syscalls/sysfile_posix.go +++ b/libgo/syscalls/sysfile_posix.go @@ -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) {