aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-02-20 20:04:36 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-02-20 20:04:36 +0000
commitf46d686ef1acd844dd00b4f3c327bd42606efbea (patch)
treedff5156dfe573447879d9fd15abd7f5df573c922 /libgo/go
parentaa777e7a23c38690a205ece9ebee9d2d4ad23097 (diff)
downloadgcc-f46d686ef1acd844dd00b4f3c327bd42606efbea.zip
gcc-f46d686ef1acd844dd00b4f3c327bd42606efbea.tar.gz
gcc-f46d686ef1acd844dd00b4f3c327bd42606efbea.tar.bz2
re PR go/56171 (syscall FAILs on Solaris)
PR go/56171 syscall: Solaris fixes for passing file descriptor. From Rainer Orth. From-SVN: r196180
Diffstat (limited to 'libgo/go')
-rw-r--r--libgo/go/syscall/sockcmsg_unix.go10
-rw-r--r--libgo/go/syscall/socket.go24
-rw-r--r--libgo/go/syscall/socket_posix.go31
-rw-r--r--libgo/go/syscall/socket_xnet.go32
4 files changed, 72 insertions, 25 deletions
diff --git a/libgo/go/syscall/sockcmsg_unix.go b/libgo/go/syscall/sockcmsg_unix.go
index fc83df1..951bc18 100644
--- a/libgo/go/syscall/sockcmsg_unix.go
+++ b/libgo/go/syscall/sockcmsg_unix.go
@@ -8,7 +8,10 @@
package syscall
-import "unsafe"
+import (
+ "runtime"
+ "unsafe"
+)
// Round the length of a raw sockaddr up to align it propery.
func cmsgAlignOf(salen int) int {
@@ -18,6 +21,11 @@ func cmsgAlignOf(salen int) int {
if darwinAMD64 {
salign = 4
}
+ // NOTE: Solaris always uses 32-bit alignment,
+ // cf. _CMSG_DATA_ALIGNMENT in <sys/socket.h>.
+ if runtime.GOOS == "solaris" {
+ salign = 4
+ }
if salen == 0 {
return salign
}
diff --git a/libgo/go/syscall/socket.go b/libgo/go/syscall/socket.go
index 3aa92012..a625eb6 100644
--- a/libgo/go/syscall/socket.go
+++ b/libgo/go/syscall/socket.go
@@ -177,9 +177,6 @@ func Getpeername(fd int) (sa Sockaddr, err error) {
return anyToSockaddr(&rsa)
}
-//sys bind(fd int, sa *RawSockaddrAny, len Socklen_t) (err error)
-//bind(fd _C_int, sa *RawSockaddrAny, len Socklen_t) _C_int
-
func Bind(fd int, sa Sockaddr) (err error) {
ptr, n, err := sa.sockaddr()
if err != nil {
@@ -188,9 +185,6 @@ func Bind(fd int, sa Sockaddr) (err error) {
return bind(fd, ptr, n)
}
-//sys connect(s int, addr *RawSockaddrAny, addrlen Socklen_t) (err error)
-//connect(s _C_int, addr *RawSockaddrAny, addrlen Socklen_t) _C_int
-
func Connect(fd int, sa Sockaddr) (err error) {
ptr, n, err := sa.sockaddr()
if err != nil {
@@ -199,9 +193,6 @@ func Connect(fd int, sa Sockaddr) (err error) {
return connect(fd, ptr, n)
}
-//sysnb socket(domain int, typ int, proto int) (fd int, err error)
-//socket(domain _C_int, typ _C_int, protocol _C_int) _C_int
-
func Socket(domain, typ, proto int) (fd int, err error) {
if domain == AF_INET6 && SocketDisableIPv6 {
return -1, EAFNOSUPPORT
@@ -210,9 +201,6 @@ func Socket(domain, typ, proto int) (fd int, err error) {
return
}
-//sysnb socketpair(domain int, typ int, proto int, fd *[2]_C_int) (err error)
-//socketpair(domain _C_int, typ _C_int, protocol _C_int, fd *[2]_C_int) _C_int
-
func Socketpair(domain, typ, proto int) (fd [2]int, err error) {
var fdx [2]_C_int
err = socketpair(domain, typ, proto, &fdx)
@@ -223,9 +211,6 @@ func Socketpair(domain, typ, proto int) (fd [2]int, err error) {
return
}
-//sys getsockopt(s int, level int, name int, val uintptr, vallen *Socklen_t) (err error)
-//getsockopt(s _C_int, level _C_int, name _C_int, val *byte, vallen *Socklen_t) _C_int
-
func GetsockoptByte(fd, level, opt int) (value byte, err error) {
var n byte
vallen := Socklen_t(1)
@@ -326,9 +311,6 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
return
}
-//sys sendto(s int, buf []byte, flags int, to *RawSockaddrAny, tolen Socklen_t) (err error)
-//sendto(s _C_int, buf *byte, len Size_t, flags _C_int, to *RawSockaddrAny, tolen Socklen_t) Ssize_t
-
func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) {
ptr, n, err := to.sockaddr()
if err != nil {
@@ -337,9 +319,6 @@ func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) {
return sendto(fd, p, flags, ptr, n)
}
-//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
-//recvmsg(s _C_int, msg *Msghdr, flags _C_int) Ssize_t
-
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
var msg Msghdr
var rsa RawSockaddrAny
@@ -374,9 +353,6 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
return
}
-//sys sendmsg(s int, msg *Msghdr, flags int) (err error)
-//sendmsg(s _C_int, msg *Msghdr, flags _C_int) Ssize_t
-
func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
var ptr *RawSockaddrAny
var salen Socklen_t
diff --git a/libgo/go/syscall/socket_posix.go b/libgo/go/syscall/socket_posix.go
new file mode 100644
index 0000000..06d7dab
--- /dev/null
+++ b/libgo/go/syscall/socket_posix.go
@@ -0,0 +1,31 @@
+// socket_posix.go -- Socket handling for generic POSIX systems.
+
+// Copyright 2013 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.
+
+package syscall
+
+//sys bind(fd int, sa *RawSockaddrAny, len Socklen_t) (err error)
+//bind(fd _C_int, sa *RawSockaddrAny, len Socklen_t) _C_int
+
+//sys connect(s int, addr *RawSockaddrAny, addrlen Socklen_t) (err error)
+//connect(s _C_int, addr *RawSockaddrAny, addrlen Socklen_t) _C_int
+
+//sysnb socket(domain int, typ int, proto int) (fd int, err error)
+//socket(domain _C_int, typ _C_int, protocol _C_int) _C_int
+
+//sysnb socketpair(domain int, typ int, proto int, fd *[2]_C_int) (err error)
+//socketpair(domain _C_int, typ _C_int, protocol _C_int, fd *[2]_C_int) _C_int
+
+//sys getsockopt(s int, level int, name int, val uintptr, vallen *Socklen_t) (err error)
+//getsockopt(s _C_int, level _C_int, name _C_int, val *byte, vallen *Socklen_t) _C_int
+
+//sys sendto(s int, buf []byte, flags int, to *RawSockaddrAny, tolen Socklen_t) (err error)
+//sendto(s _C_int, buf *byte, len Size_t, flags _C_int, to *RawSockaddrAny, tolen Socklen_t) Ssize_t
+
+//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
+//recvmsg(s _C_int, msg *Msghdr, flags _C_int) Ssize_t
+
+//sys sendmsg(s int, msg *Msghdr, flags int) (err error)
+//sendmsg(s _C_int, msg *Msghdr, flags _C_int) Ssize_t
diff --git a/libgo/go/syscall/socket_xnet.go b/libgo/go/syscall/socket_xnet.go
new file mode 100644
index 0000000..8f86c62
--- /dev/null
+++ b/libgo/go/syscall/socket_xnet.go
@@ -0,0 +1,32 @@
+// socket_xnet.go -- Socket handling specific to Solaris.
+// Enforce use of XPG 4.2 versions of socket functions.
+
+// Copyright 2013 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.
+
+package syscall
+
+//sys bind(fd int, sa *RawSockaddrAny, len Socklen_t) (err error)
+//__xnet_bind(fd _C_int, sa *RawSockaddrAny, len Socklen_t) _C_int
+
+//sys connect(s int, addr *RawSockaddrAny, addrlen Socklen_t) (err error)
+//__xnet_connect(s _C_int, addr *RawSockaddrAny, addrlen Socklen_t) _C_int
+
+//sysnb socket(domain int, typ int, proto int) (fd int, err error)
+//__xnet_socket(domain _C_int, typ _C_int, protocol _C_int) _C_int
+
+//sysnb socketpair(domain int, typ int, proto int, fd *[2]_C_int) (err error)
+//__xnet_socketpair(domain _C_int, typ _C_int, protocol _C_int, fd *[2]_C_int) _C_int
+
+//sys getsockopt(s int, level int, name int, val uintptr, vallen *Socklen_t) (err error)
+//__xnet_getsockopt(s _C_int, level _C_int, name _C_int, val *byte, vallen *Socklen_t) _C_int
+
+//sys sendto(s int, buf []byte, flags int, to *RawSockaddrAny, tolen Socklen_t) (err error)
+//__xnet_sendto(s _C_int, buf *byte, len Size_t, flags _C_int, to *RawSockaddrAny, tolen Socklen_t) Ssize_t
+
+//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
+//__xnet_recvmsg(s _C_int, msg *Msghdr, flags _C_int) Ssize_t
+
+//sys sendmsg(s int, msg *Msghdr, flags int) (err error)
+//__xnet_sendmsg(s _C_int, msg *Msghdr, flags _C_int) Ssize_t