Skip to content

Commit

Permalink
syscall, net: clean up socket stub for solaris
Browse files Browse the repository at this point in the history
Solaris doesn't have struct ip_mreqn, instead it uses struct ip_mreq
and struct group_req with struct sockaddr_storage.

Also fixes incorrect SockaddrDatalink.

Update #7399

LGTM=aram, iant
R=golang-codereviews, aram, gobot, iant
CC=golang-codereviews
https://golang.org/cl/73920043
  • Loading branch information
cixtor committed Mar 12, 2014
1 parent 42da29f commit ef6c21d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/pkg/net/sockoptip_bsd.go
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build darwin dragonfly freebsd nacl netbsd openbsd solaris
// +build darwin dragonfly freebsd nacl netbsd openbsd

package net

Expand Down
2 changes: 1 addition & 1 deletion src/pkg/net/sockoptip_posix.go
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows
// +build darwin dragonfly freebsd linux nacl netbsd openbsd windows

package net

Expand Down
39 changes: 39 additions & 0 deletions src/pkg/net/sockoptip_stub.go
@@ -0,0 +1,39 @@
// Copyright 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.

// +build solaris

package net

import "syscall"

func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error {
// See golang.org/issue/7399.
return syscall.EINVAL
}

func setIPv4MulticastLoopback(fd *netFD, v bool) error {
// See golang.org/issue/7399.
return syscall.EINVAL
}

func joinIPv4Group(fd *netFD, ifi *Interface, ip IP) error {
// See golang.org/issue/7399.
return syscall.EINVAL
}

func setIPv6MulticastInterface(fd *netFD, ifi *Interface) error {
// See golang.org/issue/7399.
return syscall.EINVAL
}

func setIPv6MulticastLoopback(fd *netFD, v bool) error {
// See golang.org/issue/7399.
return syscall.EINVAL
}

func joinIPv6Group(fd *netFD, ifi *Interface, ip IP) error {
// See golang.org/issue/7399.
return syscall.EINVAL
}
26 changes: 2 additions & 24 deletions src/pkg/syscall/syscall_solaris.go
Expand Up @@ -15,14 +15,13 @@ package syscall
import "unsafe"

type SockaddrDatalink struct {
Len uint8
Family uint8
Family uint16
Index uint16
Type uint8
Nlen uint8
Alen uint8
Slen uint8
Data [46]int8
Data [244]int8
raw RawSockaddrDatalink
}

Expand Down Expand Up @@ -77,12 +76,6 @@ func Pipe(p []int) (err error) {
return
}

type IPMreqn struct {
Multiaddr [4]byte /* in_addr */
Address [4]byte /* in_addr */
Ifindex int32
}

func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
if sa.Port < 0 || sa.Port > 0xFFFF {
return nil, 0, EINVAL
Expand Down Expand Up @@ -145,21 +138,6 @@ func Getsockname(fd int) (sa Sockaddr, err error) {
return anyToSockaddr(&rsa)
}

func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, err error) {
vallen := _Socklen(4)
err = getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
return value, err
}

func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
// TODO(dfc)
return nil, EINVAL
}

func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
}

// The const provides a compile-time constant so clients
// can adjust to whether there is a working Getwd and avoid
// even linking this function into the binary. See ../os/getwd.go.
Expand Down

0 comments on commit ef6c21d

Please sign in to comment.