From: Ian Lance Taylor <iant@google.com>
To: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Cc: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com
Subject: Re: [libgo] Account for 32-bit fds_bits on Solaris 2
Date: Fri, 01 Apr 2011 22:54:00 -0000 [thread overview]
Message-ID: <mcrei5llh14.fsf@google.com> (raw)
In-Reply-To: <ydd39m2if1w.fsf@manam.CeBiTec.Uni-Bielefeld.DE> (Rainer Orth's message of "Fri, 01 Apr 2011 09:52:43 +0200")
[-- Attachment #1: Type: text/plain, Size: 931 bytes --]
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> Ian Lance Taylor <iant@google.com> writes:
>
>> Thanks. I'm going to try gambling that every uses the type "long" for
>> the fds_bits array. If so, I think this patch will work. Bootstrapped
>> and ran Go testsuite on x86_64-unknown-linux-gnu (forcing the use of
>> select). Committed to mainline.
>
> I fear you lost ;-)
>
> * On Solaris, it's always long (i.e. either 32 or 64-bit).
>
> * On IRIX 6.5, it's long for 32-bit and int for 64-bit (i.e. always
> 32-bit), while 64-bit long is 64-bit.
>
> * On Tru64 UNIX V5.1, it's always int (i.e. 32-bit), while long is
> 64-bit.
>
> This has to be system-dependent, I fear.
Bother.
OK, for my next attempt I committed the appended patch, in which
mksysinfo tries to guess the right type to use. Let me know where this
fails. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.
Ian
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1744 bytes --]
diff -r fa0bb5137d66 libgo/configure.ac
--- a/libgo/configure.ac Thu Mar 31 22:09:27 2011 -0700
+++ b/libgo/configure.ac Fri Apr 01 15:47:05 2011 -0700
@@ -417,7 +417,7 @@
;;
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 -r fa0bb5137d66 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh Thu Mar 31 22:09:27 2011 -0700
+++ b/libgo/mksysinfo.sh Fri Apr 01 15:47:05 2011 -0700
@@ -73,6 +73,9 @@
#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 @@
-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 -r fa0bb5137d66 libgo/syscalls/sysfile_posix.go
--- a/libgo/syscalls/sysfile_posix.go Thu Mar 31 22:09:27 2011 -0700
+++ b/libgo/syscalls/sysfile_posix.go Fri Apr 01 15:47:05 2011 -0700
@@ -181,10 +181,10 @@
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) {
prev parent reply other threads:[~2011-04-01 22:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-31 15:50 Rainer Orth
2011-03-31 16:05 ` Ian Lance Taylor
2011-03-31 16:12 ` Rainer Orth
2011-03-31 20:09 ` Richard Henderson
2011-03-31 20:12 ` Ian Lance Taylor
2011-03-31 20:53 ` Ian Lance Taylor
2011-04-01 7:53 ` Rainer Orth
2011-04-01 22:54 ` Ian Lance Taylor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mcrei5llh14.fsf@google.com \
--to=iant@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gofrontend-dev@googlegroups.com \
--cc=ro@CeBiTec.Uni-Bielefeld.DE \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).