summaryrefslogtreecommitdiffstats
path: root/libgo/go/net/sock_unix.go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-16 06:54:42 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-16 06:54:42 +0000
commitf4ca453c9530ff24478cae090c9979b97fdd7411 (patch)
tree0e8fda573576bb4181dba29d0e88380a8c38fafd /libgo/go/net/sock_unix.go
parent84a4a7d4b2fecf754bc0b7fce55b05912a054ef4 (diff)
downloadppe42-gcc-f4ca453c9530ff24478cae090c9979b97fdd7411.tar.gz
ppe42-gcc-f4ca453c9530ff24478cae090c9979b97fdd7411.zip
libgo: Update to Go 1.1.1.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200974 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/net/sock_unix.go')
-rw-r--r--libgo/go/net/sock_unix.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/libgo/go/net/sock_unix.go b/libgo/go/net/sock_unix.go
new file mode 100644
index 00000000000..b0d6d4900f2
--- /dev/null
+++ b/libgo/go/net/sock_unix.go
@@ -0,0 +1,36 @@
+// Copyright 2009 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.
+
+// +build darwin freebsd linux netbsd openbsd
+
+package net
+
+import "syscall"
+
+func listenerSockaddr(s, f int, la syscall.Sockaddr, toAddr func(syscall.Sockaddr) Addr) (syscall.Sockaddr, error) {
+ a := toAddr(la)
+ if a == nil {
+ return la, nil
+ }
+ switch a := a.(type) {
+ case *TCPAddr, *UnixAddr:
+ if err := setDefaultListenerSockopts(s); err != nil {
+ return nil, err
+ }
+ case *UDPAddr:
+ if a.IP.IsMulticast() {
+ if err := setDefaultMulticastSockopts(s); err != nil {
+ return nil, err
+ }
+ switch f {
+ case syscall.AF_INET:
+ a.IP = IPv4zero
+ case syscall.AF_INET6:
+ a.IP = IPv6unspecified
+ }
+ return a.sockaddr(f)
+ }
+ }
+ return la, nil
+}
OpenPOWER on IntegriCloud