gcc/libgo/go/net/sock_solaris.go
Ian Lance Taylor b685de12d2 re PR go/52583 (Several new go testsuite failues on Solaris)
PR go/52583

net: Solaris fixes.

In particular fix fd_select.go to handle the case where a file
descriptor is closed by one goroutine while another goroutine
is waiting for it.

From-SVN: r186801
2012-04-25 04:26:12 +00:00

48 lines
935 B
Go

// Copyright 2012 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 solaris
// Sockets for Solaris
package net
import (
"syscall"
)
func maxListenerBacklog() int {
// The kernel does not track the limit.
return syscall.SOMAXCONN
}
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 v := a.(type) {
case *TCPAddr, *UnixAddr:
err := setDefaultListenerSockopts(s)
if err != nil {
return nil, err
}
case *UDPAddr:
if v.IP.IsMulticast() {
err := setDefaultMulticastSockopts(s)
if err != nil {
return nil, err
}
switch f {
case syscall.AF_INET:
v.IP = IPv4zero
case syscall.AF_INET6:
v.IP = IPv6unspecified
}
return v.sockaddr(f)
}
}
return la, nil
}