@@ -1214,6 +1214,20 @@
endif # !LIBGO_IS_SOLARIS
endif # !LIBGO_IS_LINUX
+# Define for struct fd_set.
+if LIBGO_IS_SOLARIS
+if LIBGO_IS_386
+syscall_fdset_file = syscalls/sysfile_fdset32.go
+else # !LIBGO_IS_386
+if LIBGO_IS_SPARC
+syscall_fdset_file = syscalls/sysfile_fdset32.go
+else # !LIBGO_IS_386 && !LIBGO_IS_SPARC
+syscall_fdset_file = syscalls/sysfile_fdset64.go
+endif # !LIBGO_IS_386 && !LIBGO_IS_SPARC
+endif # !LIBGO_IS_386 && !LIBGO_IS_SPARC
+else # !LIBGO_IS_SOLARIS
+syscall_fdset_file = syscalls/sysfile_fdset64.go
+endif # !LIBGO_IS_SOLARIS
# Define ForkExec, PtraceForkExec, Exec, and Waitpid.
if LIBGO_IS_RTEMS
@@ -1307,6 +1321,7 @@
syscalls/syscall_$(GOOS).go \
$(GO_SYSCALLS_SYSCALL_OS_ARCH_FILE) \
syscalls/sysfile_posix.go \
+ $(syscall_fdset_file) \
sysinfo.go \
syscall_arch.go
go_syscall_c_files = \
@@ -0,0 +1,35 @@
+// sysfile_fdset.go -- POSIX fd_set handling for 32-bit fds_bits.
+
+// Copyright 2010, 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Support for struct fd_set.
+
+package syscall
+
+type FdSet_t struct {
+ Fds_bits [(FD_SETSIZE + 31) / 32]int32;
+}
+
+func FDSet(fd int, set *FdSet_t) {
+ set.Fds_bits[fd / 32] |= (1 << (uint)(fd % 32))
+}
+
+func FDClr(fd int, set *FdSet_t) {
+ set.Fds_bits[fd / 32] &= ^(1 << (uint)(fd % 32))
+}
+
+func FDIsSet(fd int, set *FdSet_t) bool {
+ if set.Fds_bits[fd / 32] & (1 << (uint)(fd % 32)) != 0 {
+ return true
+ } else {
+ return false
+ }
+}
+
+func FDZero(set *FdSet_t) {
+ for i := 0; i < ((FD_SETSIZE + 63) / 32); i++ {
+ set.Fds_bits[i] = 0
+ }
+}
@@ -0,0 +1,35 @@
+// sysfile_fdset.go -- POSIX fd_set handling for 64-bit fds_bits.
+
+// Copyright 2010, 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Support for struct fd_set.
+
+package syscall
+
+type FdSet_t struct {
+ Fds_bits [(FD_SETSIZE + 63) / 64]int64;
+}
+
+func FDSet(fd int, set *FdSet_t) {
+ set.Fds_bits[fd / 64] |= (1 << (uint)(fd % 64))
+}
+
+func FDClr(fd int, set *FdSet_t) {
+ set.Fds_bits[fd / 64] &= ^(1 << (uint)(fd % 64))
+}
+
+func FDIsSet(fd int, set *FdSet_t) bool {
+ if set.Fds_bits[fd / 64] & (1 << (uint)(fd % 64)) != 0 {
+ return true
+ } else {
+ return false
+ }
+}
+
+func FDZero(set *FdSet_t) {
+ for i := 0; i < ((FD_SETSIZE + 63) / 64); i++ {
+ set.Fds_bits[i] = 0
+ }
+}
@@ -181,32 +181,6 @@
return;
}
-type FdSet_t struct {
- Fds_bits [(FD_SETSIZE + 63) / 64]int64;
-}
-
-func FDSet(fd int, set *FdSet_t) {
- set.Fds_bits[fd / 64] |= (1 << (uint)(fd % 64))
-}
-
-func FDClr(fd int, set *FdSet_t) {
- set.Fds_bits[fd / 64] &= ^(1 << (uint)(fd % 64))
-}
-
-func FDIsSet(fd int, set *FdSet_t) bool {
- if set.Fds_bits[fd / 64] & (1 << (uint)(fd % 64)) != 0 {
- return true
- } else {
- return false
- }
-}
-
-func FDZero(set *FdSet_t) {
- for i := 0; i < ((FD_SETSIZE + 63) / 64); i++ {
- set.Fds_bits[i] = 0
- }
-}
-
func Select(nfds int, r *FdSet_t, w *FdSet_t, e *FdSet_t, timeout *Timeval) (n int, errno int) {
n = libc_select(nfds, (*byte)(unsafe.Pointer(r)),
(*byte)(unsafe.Pointer(e)),