Commit 312bce6e authored by Mikio Hara's avatar Mikio Hara

internal/socket: make not implemented errors more descriptive

Change-Id: I7c1447849dc664ae54229345f2fce8f59204ecdf
Reviewed-on: https://go-review.googlesource.com/c/150117Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 617fbc82
...@@ -7,12 +7,10 @@ ...@@ -7,12 +7,10 @@
package socket package socket
import "errors"
func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
...@@ -7,12 +7,10 @@ ...@@ -7,12 +7,10 @@
package socket package socket
import "errors"
func (c *Conn) recvMsg(m *Message, flags int) error { func (c *Conn) recvMsg(m *Message, flags int) error {
return errors.New("not implemented") return errNotImplemented
} }
func (c *Conn) sendMsg(m *Message, flags int) error { func (c *Conn) sendMsg(m *Message, flags int) error {
return errors.New("not implemented") return errNotImplemented
} }
...@@ -6,20 +6,18 @@ ...@@ -6,20 +6,18 @@
package socket package socket
import "errors"
func (c *Conn) recvMsg(m *Message, flags int) error { func (c *Conn) recvMsg(m *Message, flags int) error {
return errors.New("not implemented") return errNotImplemented
} }
func (c *Conn) sendMsg(m *Message, flags int) error { func (c *Conn) sendMsg(m *Message, flags int) error {
return errors.New("not implemented") return errNotImplemented
} }
func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
...@@ -9,9 +9,12 @@ package socket // import "golang.org/x/net/internal/socket" ...@@ -9,9 +9,12 @@ package socket // import "golang.org/x/net/internal/socket"
import ( import (
"errors" "errors"
"net" "net"
"runtime"
"unsafe" "unsafe"
) )
var errNotImplemented = errors.New("not implemented on " + runtime.GOOS + "/" + runtime.GOARCH)
// An Option represents a sticky socket option. // An Option represents a sticky socket option.
type Option struct { type Option struct {
Level int // level Level int // level
......
...@@ -6,12 +6,10 @@ ...@@ -6,12 +6,10 @@
package socket package socket
import "errors"
func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package socket package socket
import ( import (
"errors"
"runtime" "runtime"
"syscall" "syscall"
"unsafe" "unsafe"
...@@ -63,9 +62,9 @@ func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { ...@@ -63,9 +62,9 @@ func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
} }
func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
package socket package socket
import ( import (
"errors"
"net" "net"
"runtime" "runtime"
"unsafe" "unsafe"
...@@ -36,29 +35,29 @@ func marshalInetAddr(ip net.IP, port int, zone string) []byte { ...@@ -36,29 +35,29 @@ func marshalInetAddr(ip net.IP, port int, zone string) []byte {
} }
func parseInetAddr(b []byte, network string) (net.Addr, error) { func parseInetAddr(b []byte, network string) (net.Addr, error) {
return nil, errors.New("not implemented") return nil, errNotImplemented
} }
func getsockopt(s uintptr, level, name int, b []byte) (int, error) { func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func setsockopt(s uintptr, level, name int, b []byte) error { func setsockopt(s uintptr, level, name int, b []byte) error {
return errors.New("not implemented") return errNotImplemented
} }
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package socket package socket
import ( import (
"errors"
"syscall" "syscall"
"unsafe" "unsafe"
) )
...@@ -54,17 +53,17 @@ func setsockopt(s uintptr, level, name int, b []byte) error { ...@@ -54,17 +53,17 @@ func setsockopt(s uintptr, level, name int, b []byte) error {
} }
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
return 0, errors.New("not implemented") return 0, errNotImplemented
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment