Browse Source

go.net/ipv4: fix build on dragonfly, plan9, solaris

LGTM=aram, r
R=golang-codereviews, 0intro, gobot, dave, aram, r
CC=golang-codereviews
https://golang.org/cl/49430047
Mikio Hara 12 years ago
parent
commit
f3b815baac
6 changed files with 32 additions and 34 deletions
  1. 4 4
      ipv4/control_stub.go
  2. 11 12
      ipv4/dgramopt_stub.go
  3. 6 8
      ipv4/genericopt_stub.go
  4. 1 0
      ipv4/helper.go
  5. 6 6
      ipv4/helper_stub.go
  6. 4 4
      ipv4/sockopt_stub.go

+ 4 - 4
ipv4/control_plan9.go → ipv4/control_stub.go

@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package ipv4
+// +build dragonfly plan9 solaris
 
-import "syscall"
+package ipv4
 
 func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
 	// TODO(mikio): Implement this
-	return syscall.EPLAN9
+	return errOpNoSupport
 }
 
 func newControlMessage(opt *rawOpt) []byte {
@@ -18,7 +18,7 @@ func newControlMessage(opt *rawOpt) []byte {
 
 func parseControlMessage(b []byte) (*ControlMessage, error) {
 	// TODO(mikio): Implement this
-	return nil, syscall.EPLAN9
+	return nil, errOpNoSupport
 }
 
 func marshalControlMessage(cm *ControlMessage) []byte {

+ 11 - 12
ipv4/dgramopt_plan9.go → ipv4/dgramopt_stub.go

@@ -2,49 +2,48 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build dragonfly plan9 solaris
+
 package ipv4
 
-import (
-	"net"
-	"syscall"
-)
+import "net"
 
 func (c *dgramOpt) MulticastTTL() (int, error) {
 	// TODO(mikio): Implement this
-	return 0, syscall.EPLAN9
+	return 0, errOpNoSupport
 }
 
 func (c *dgramOpt) SetMulticastTTL(ttl int) error {
 	// TODO(mikio): Implement this
-	return syscall.EPLAN9
+	return errOpNoSupport
 }
 
 func (c *dgramOpt) MulticastInterface() (*net.Interface, error) {
 	// TODO(mikio): Implement this
-	return nil, syscall.EPLAN9
+	return nil, errOpNoSupport
 }
 
 func (c *dgramOpt) SetMulticastInterface(ifi *net.Interface) error {
 	// TODO(mikio): Implement this
-	return syscall.EPLAN9
+	return errOpNoSupport
 }
 
 func (c *dgramOpt) MulticastLoopback() (bool, error) {
 	// TODO(mikio): Implement this
-	return false, syscall.EPLAN9
+	return false, errOpNoSupport
 }
 
 func (c *dgramOpt) SetMulticastLoopback(on bool) error {
 	// TODO(mikio): Implement this
-	return syscall.EPLAN9
+	return errOpNoSupport
 }
 
 func (c *dgramOpt) JoinGroup(ifi *net.Interface, grp net.Addr) error {
 	// TODO(mikio): Implement this
-	return syscall.EPLAN9
+	return errOpNoSupport
 }
 
 func (c *dgramOpt) LeaveGroup(ifi *net.Interface, grp net.Addr) error {
 	// TODO(mikio): Implement this
-	return syscall.EPLAN9
+	return errOpNoSupport
 }

+ 6 - 8
ipv4/genericopt_plan9.go → ipv4/genericopt_stub.go

@@ -2,28 +2,26 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package ipv4
+// +build dragonfly plan9 solaris
 
-import (
-	"syscall"
-)
+package ipv4
 
 func (c *genericOpt) TOS() (int, error) {
 	// TODO(mikio): Implement this
-	return 0, syscall.EPLAN9
+	return 0, errOpNoSupport
 }
 
 func (c *genericOpt) SetTOS(tos int) error {
 	// TODO(mikio): Implement this
-	return syscall.EPLAN9
+	return errOpNoSupport
 }
 
 func (c *genericOpt) TTL() (int, error) {
 	// TODO(mikio): Implement this
-	return 0, syscall.EPLAN9
+	return 0, errOpNoSupport
 }
 
 func (c *genericOpt) SetTTL(ttl int) error {
 	// TODO(mikio): Implement this
-	return syscall.EPLAN9
+	return errOpNoSupport
 }

+ 1 - 0
ipv4/helper.go

@@ -10,6 +10,7 @@ import (
 )
 
 var (
+	errOpNoSupport              = errors.New("operation not supported")
 	errNoSuchInterface          = errors.New("no such interface")
 	errNoSuchMulticastInterface = errors.New("no such multicast interface")
 )

+ 6 - 6
ipv4/helper_plan9.go → ipv4/helper_stub.go

@@ -2,26 +2,26 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package ipv4
+// +build dragonfly plan9 solaris
 
-import "syscall"
+package ipv4
 
 func (c *genericOpt) sysfd() (int, error) {
 	// TODO(mikio): Implement this
-	return 0, syscall.EPLAN9
+	return 0, errOpNoSupport
 }
 
 func (c *dgramOpt) sysfd() (int, error) {
 	// TODO(mikio): Implement this
-	return 0, syscall.EPLAN9
+	return 0, errOpNoSupport
 }
 
 func (c *payloadHandler) sysfd() (int, error) {
 	// TODO(mikio): Implement this
-	return 0, syscall.EPLAN9
+	return 0, errOpNoSupport
 }
 
 func (c *packetHandler) sysfd() (int, error) {
 	// TODO(mikio): Implement this
-	return 0, syscall.EPLAN9
+	return 0, errOpNoSupport
 }

+ 4 - 4
ipv4/sockopt_plan9.go → ipv4/sockopt_stub.go

@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package ipv4
+// +build dragonfly plan9 solaris
 
-import "syscall"
+package ipv4
 
 func ipv4HeaderPrepend(fd int) (bool, error) {
 	// TODO(mikio): Implement this
-	return false, syscall.EPLAN9
+	return false, errOpNoSupport
 }
 
 func setIPv4HeaderPrepend(fd int, v bool) error {
 	// TODO(mikio): Implement this
-	return syscall.EPLAN9
+	return errOpNoSupport
 }