aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-04-01 22:53:54 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-04-01 22:53:54 +0000
commit4ac7fcaac05916bfbf58851691f9e19e288181aa (patch)
tree7a2eaa2a2e05514cc9e4637814d3b7776ae4ac18 /libgo
parent15a03a11ceae0d0423ce6d762842f89a0c8feadd (diff)
downloadgcc-4ac7fcaac05916bfbf58851691f9e19e288181aa.zip
gcc-4ac7fcaac05916bfbf58851691f9e19e288181aa.tar.gz
gcc-4ac7fcaac05916bfbf58851691f9e19e288181aa.tar.bz2
libgo: Try to guess the right type for select bits in mksysinfo.
From-SVN: r171858
Diffstat (limited to 'libgo')
-rw-r--r--libgo/configure2
-rw-r--r--libgo/configure.ac2
-rwxr-xr-xlibgo/mksysinfo.sh11
-rw-r--r--libgo/syscalls/sysfile_posix.go4
4 files changed, 15 insertions, 4 deletions
diff --git a/libgo/configure b/libgo/configure
index 1c70b86..30d1cdc 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 f7fa3aa..cf0c17f 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 ab0efe5..77d699e 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -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 $?
diff --git a/libgo/syscalls/sysfile_posix.go b/libgo/syscalls/sysfile_posix.go
index d070057..a16ba4a 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) {