This commit adds the js/wasm architecture to the net package.
The net package is not supported by js/wasm, but a simple fake
networking is available so tests of other packages that require
basic TCP sockets can pass. The tests of the net package itself
are mostly disabled.
Updates #18892
Change-Id: Id287200c39f0a3e23d20ef17260ca15ccdcca032
Reviewed-on: https://go-review.googlesource.com/109995
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
// 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
+// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
package poll
// This file implements API tests across platforms and will never have a build
// tag.
+// +build !js
+
package net
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// 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 js,wasm linux nacl netbsd openbsd solaris windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// 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 netbsd openbsd solaris
+// +build darwin dragonfly freebsd js linux netbsd openbsd solaris
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
"io"
"os"
"syscall"
+ "time"
)
// Network file descriptor.
func setWriteBuffer(fd *netFD, bytes int) error {
return syscall.EPLAN9
}
+
+func (fd *netFD) SetDeadline(t time.Time) error {
+ return fd.pfd.SetDeadline(t)
+}
+
+func (fd *netFD) SetReadDeadline(t time.Time) error {
+ return fd.pfd.SetReadDeadline(t)
+}
+
+func (fd *netFD) SetWriteDeadline(t time.Time) error {
+ return fd.pfd.SetWriteDeadline(t)
+}
"runtime"
"sync/atomic"
"syscall"
+ "time"
)
// Network file descriptor.
return os.NewFile(uintptr(ns), fd.name()), nil
}
+
+func (fd *netFD) SetDeadline(t time.Time) error {
+ return fd.pfd.SetDeadline(t)
+}
+
+func (fd *netFD) SetReadDeadline(t time.Time) error {
+ return fd.pfd.SetReadDeadline(t)
+}
+
+func (fd *netFD) SetWriteDeadline(t time.Time) error {
+ return fd.pfd.SetWriteDeadline(t)
+}
"os"
"runtime"
"syscall"
+ "time"
"unsafe"
)
// TODO: Implement this
return nil, syscall.EWINDOWS
}
+
+func (fd *netFD) SetDeadline(t time.Time) error {
+ return fd.pfd.SetDeadline(t)
+}
+
+func (fd *netFD) SetReadDeadline(t time.Time) error {
+ return fd.pfd.SetReadDeadline(t)
+}
+
+func (fd *netFD) SetWriteDeadline(t time.Time) error {
+ return fd.pfd.SetWriteDeadline(t)
+}
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build nacl
+// +build nacl js,wasm
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// 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
+// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
package net
}
func TestEnvOverride(t *testing.T) {
+ check(t)
cgifile, _ := filepath.Abs("testdata/test.cgi")
var perl string
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build nacl
+// +build nacl js,wasm
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !plan9
+// +build !js,!plan9
package socktest_test
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !plan9,!windows
+// +build !js,!plan9,!windows
package socktest_test
// 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
+// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
package socktest
// 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
+// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
package socktest
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// 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 js,wasm linux nacl netbsd openbsd solaris windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// 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 js,wasm linux nacl netbsd openbsd solaris windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !plan9
+// +build !js,!plan9
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build nacl
+// +build nacl js,wasm
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !nacl,!plan9,!windows
+// +build !js,!nacl,!plan9,!windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build nacl plan9 windows
+// +build js,wasm nacl plan9 windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !plan9
+// +build !js,!plan9
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
if !c.ok() {
return syscall.EINVAL
}
- if err := c.fd.pfd.SetDeadline(t); err != nil {
+ if err := c.fd.SetDeadline(t); err != nil {
return &OpError{Op: "set", Net: c.fd.net, Source: nil, Addr: c.fd.laddr, Err: err}
}
return nil
if !c.ok() {
return syscall.EINVAL
}
- if err := c.fd.pfd.SetReadDeadline(t); err != nil {
+ if err := c.fd.SetReadDeadline(t); err != nil {
return &OpError{Op: "set", Net: c.fd.net, Source: nil, Addr: c.fd.laddr, Err: err}
}
return nil
if !c.ok() {
return syscall.EINVAL
}
- if err := c.fd.pfd.SetWriteDeadline(t); err != nil {
+ if err := c.fd.SetWriteDeadline(t); err != nil {
return &OpError{Op: "set", Net: c.fd.net, Source: nil, Addr: c.fd.laddr, Err: err}
}
return nil
--- /dev/null
+// Copyright 2018 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.
+
+// Fake networking for js/wasm. It is intended to allow tests of other package to pass.
+
+// +build js,wasm
+
+package net
+
+import (
+ "context"
+ "internal/poll"
+ "io"
+ "os"
+ "sync"
+ "syscall"
+ "time"
+)
+
+var listenersMu sync.Mutex
+var listeners = make(map[string]*netFD)
+
+var portCounterMu sync.Mutex
+var portCounter = 0
+
+func nextPort() int {
+ portCounterMu.Lock()
+ defer portCounterMu.Unlock()
+ portCounter++
+ return portCounter
+}
+
+// Network file descriptor.
+type netFD struct {
+ r *bufferedPipe
+ w *bufferedPipe
+ incoming chan *netFD
+
+ closedMu sync.Mutex
+ closed bool
+
+ // immutable until Close
+ listener bool
+ family int
+ sotype int
+ net string
+ laddr Addr
+ raddr Addr
+
+ // unused
+ pfd poll.FD
+ isConnected bool
+}
+
+// socket returns a network file descriptor that is ready for
+// asynchronous I/O using the network poller.
+func socket(ctx context.Context, net string, family, sotype, proto int, ipv6only bool, laddr, raddr sockaddr, ctrlFn func(string, string, syscall.RawConn) error) (*netFD, error) {
+ fd := &netFD{family: family, sotype: sotype, net: net}
+
+ if laddr != nil && raddr == nil { // listener
+ l := laddr.(*TCPAddr)
+ fd.laddr = &TCPAddr{
+ IP: l.IP,
+ Port: nextPort(),
+ Zone: l.Zone,
+ }
+ fd.listener = true
+ fd.incoming = make(chan *netFD, 1024)
+ listenersMu.Lock()
+ listeners[fd.laddr.(*TCPAddr).String()] = fd
+ listenersMu.Unlock()
+ return fd, nil
+ }
+
+ fd.laddr = &TCPAddr{
+ IP: IPv4(127, 0, 0, 1),
+ Port: nextPort(),
+ }
+ fd.raddr = raddr
+ fd.r = newBufferedPipe(65536)
+ fd.w = newBufferedPipe(65536)
+
+ fd2 := &netFD{family: fd.family, sotype: sotype, net: net}
+ fd2.laddr = fd.raddr
+ fd2.raddr = fd.laddr
+ fd2.r = fd.w
+ fd2.w = fd.r
+ listenersMu.Lock()
+ l, ok := listeners[fd.raddr.(*TCPAddr).String()]
+ if !ok {
+ listenersMu.Unlock()
+ return nil, syscall.ECONNREFUSED
+ }
+ l.incoming <- fd2
+ listenersMu.Unlock()
+
+ return fd, nil
+}
+
+func (fd *netFD) Read(p []byte) (n int, err error) {
+ return fd.r.Read(p)
+}
+
+func (fd *netFD) Write(p []byte) (nn int, err error) {
+ return fd.w.Write(p)
+}
+
+func (fd *netFD) Close() error {
+ fd.closedMu.Lock()
+ if fd.closed {
+ fd.closedMu.Unlock()
+ return nil
+ }
+ fd.closed = true
+ fd.closedMu.Unlock()
+
+ if fd.listener {
+ listenersMu.Lock()
+ delete(listeners, fd.laddr.String())
+ close(fd.incoming)
+ fd.listener = false
+ listenersMu.Unlock()
+ return nil
+ }
+
+ fd.r.Close()
+ fd.w.Close()
+ return nil
+}
+
+func (fd *netFD) closeRead() error {
+ fd.r.Close()
+ return nil
+}
+
+func (fd *netFD) closeWrite() error {
+ fd.w.Close()
+ return nil
+}
+
+func (fd *netFD) accept() (*netFD, error) {
+ c, ok := <-fd.incoming
+ if !ok {
+ return nil, syscall.EINVAL
+ }
+ return c, nil
+}
+
+func (fd *netFD) SetDeadline(t time.Time) error {
+ fd.r.SetReadDeadline(t)
+ fd.w.SetWriteDeadline(t)
+ return nil
+}
+
+func (fd *netFD) SetReadDeadline(t time.Time) error {
+ fd.r.SetReadDeadline(t)
+ return nil
+}
+
+func (fd *netFD) SetWriteDeadline(t time.Time) error {
+ fd.w.SetWriteDeadline(t)
+ return nil
+}
+
+func newBufferedPipe(softLimit int) *bufferedPipe {
+ p := &bufferedPipe{softLimit: softLimit}
+ p.rCond.L = &p.mu
+ p.wCond.L = &p.mu
+ return p
+}
+
+type bufferedPipe struct {
+ softLimit int
+ mu sync.Mutex
+ buf []byte
+ closed bool
+ rCond sync.Cond
+ wCond sync.Cond
+ rDeadline time.Time
+ wDeadline time.Time
+}
+
+func (p *bufferedPipe) Read(b []byte) (int, error) {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+
+ for {
+ if p.closed && len(p.buf) == 0 {
+ return 0, io.EOF
+ }
+ if !p.rDeadline.IsZero() {
+ d := time.Until(p.rDeadline)
+ if d <= 0 {
+ return 0, syscall.EAGAIN
+ }
+ time.AfterFunc(d, p.rCond.Broadcast)
+ }
+ if len(p.buf) > 0 {
+ break
+ }
+ p.rCond.Wait()
+ }
+
+ n := copy(b, p.buf)
+ p.buf = p.buf[n:]
+ p.wCond.Broadcast()
+ return n, nil
+}
+
+func (p *bufferedPipe) Write(b []byte) (int, error) {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+
+ for {
+ if p.closed {
+ return 0, syscall.ENOTCONN
+ }
+ if !p.wDeadline.IsZero() {
+ d := time.Until(p.wDeadline)
+ if d <= 0 {
+ return 0, syscall.EAGAIN
+ }
+ time.AfterFunc(d, p.wCond.Broadcast)
+ }
+ if len(p.buf) <= p.softLimit {
+ break
+ }
+ p.wCond.Wait()
+ }
+
+ p.buf = append(p.buf, b...)
+ p.rCond.Broadcast()
+ return len(b), nil
+}
+
+func (p *bufferedPipe) Close() {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+
+ p.closed = true
+ p.rCond.Broadcast()
+ p.wCond.Broadcast()
+}
+
+func (p *bufferedPipe) SetReadDeadline(t time.Time) {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+
+ p.rDeadline = t
+ p.rCond.Broadcast()
+}
+
+func (p *bufferedPipe) SetWriteDeadline(t time.Time) {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+
+ p.wDeadline = t
+ p.wCond.Broadcast()
+}
+
+func sysSocket(family, sotype, proto int) (int, error) {
+ return 0, syscall.ENOSYS
+}
+
+func (fd *netFD) readFrom(p []byte) (n int, sa syscall.Sockaddr, err error) {
+ return 0, nil, syscall.ENOSYS
+}
+
+func (fd *netFD) readMsg(p []byte, oob []byte) (n, oobn, flags int, sa syscall.Sockaddr, err error) {
+ return 0, 0, 0, nil, syscall.ENOSYS
+}
+
+func (fd *netFD) writeTo(p []byte, sa syscall.Sockaddr) (n int, err error) {
+ return 0, syscall.ENOSYS
+}
+
+func (fd *netFD) writeMsg(p []byte, oob []byte, sa syscall.Sockaddr) (n int, oobn int, err error) {
+ return 0, 0, syscall.ENOSYS
+}
+
+func (fd *netFD) dup() (f *os.File, err error) {
+ return nil, syscall.ENOSYS
+}
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// This file implements API tests across platforms and will never have a build
// tag.
+// +build !js
+
package net
import (
// 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 netbsd openbsd solaris nacl
+// +build darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris nacl
// Read system port mappings from /etc/services
// This file implements API tests across platforms and will never have a build
// tag.
+// +build !js
+
package net
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build nacl plan9
+// +build js,wasm nacl plan9
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build darwin nacl netbsd openbsd
+// +build darwin js,wasm nacl netbsd openbsd
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
`
func TestTLSClient(t *testing.T) {
- if runtime.GOOS == "freebsd" && runtime.GOARCH == "amd64" {
+ if (runtime.GOOS == "freebsd" && runtime.GOARCH == "amd64") || runtime.GOOS == "js" {
testenv.SkipFlaky(t, 19229)
}
ln := newLocalListener(t)
"syscall"
)
-// A sockaddr represents a TCP, UDP, IP or Unix network endpoint
-// address that can be converted into a syscall.Sockaddr.
-type sockaddr interface {
- Addr
-
- // family returns the platform-dependent address family
- // identifier.
- family() int
-
- // isWildcard reports whether the address is a wildcard
- // address.
- isWildcard() bool
-
- // sockaddr returns the address converted into a syscall
- // sockaddr type that implements syscall.Sockaddr
- // interface. It returns a nil interface when the address is
- // nil.
- sockaddr(family int) (syscall.Sockaddr, error)
-
- // toLocal maps the zero address to a local system address (127.0.0.1 or ::1)
- toLocal(net string) sockaddr
-}
-
// socket returns a network file descriptor that is ready for
// asynchronous I/O using the network poller.
func socket(ctx context.Context, net string, family, sotype, proto int, ipv6only bool, laddr, raddr sockaddr, ctrlFn func(string, string, syscall.RawConn) error) (fd *netFD, err error) {
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build nacl solaris
+// +build nacl js,wasm solaris
package net
--- /dev/null
+// Copyright 2018 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 dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
+
+package net
+
+import (
+ "syscall"
+)
+
+// A sockaddr represents a TCP, UDP, IP or Unix network endpoint
+// address that can be converted into a syscall.Sockaddr.
+type sockaddr interface {
+ Addr
+
+ // family returns the platform-dependent address family
+ // identifier.
+ family() int
+
+ // isWildcard reports whether the address is a wildcard
+ // address.
+ isWildcard() bool
+
+ // sockaddr returns the address converted into a syscall
+ // sockaddr type that implements syscall.Sockaddr
+ // interface. It returns a nil interface when the address is
+ // nil.
+ sockaddr(family int) (syscall.Sockaddr, error)
+
+ // toLocal maps the zero address to a local system address (127.0.0.1 or ::1)
+ toLocal(net string) sockaddr
+}
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build nacl
+// +build nacl js,wasm
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build nacl
+// +build nacl js,wasm
package net
// 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 js,wasm linux nacl netbsd openbsd solaris windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !plan9,!windows
+// +build !js,!plan9,!windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build nacl
+// +build nacl js,wasm
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// 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 js,wasm linux nacl netbsd openbsd solaris windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// 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 js,wasm linux nacl netbsd openbsd solaris windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !nacl,!plan9,!windows
+// +build !js,!nacl,!plan9,!windows
package net
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build !js
+
package net
import (
// 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 js,wasm linux nacl netbsd openbsd solaris windows
package runtime
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Fake network poller for NaCl.
-// Should never be used, because NaCl network connections do not honor "SetNonblock".
+// Fake network poller for NaCl and wasm/js.
+// Should never be used, because NaCl and wasm/js network connections do not honor "SetNonblock".
+
+// +build nacl js,wasm
package runtime
--- /dev/null
+// Copyright 2018 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.
+
+// js/wasm uses fake networking directly implemented in the net package.
+// This file only exists to make the compiler happy.
+
+// +build js,wasm
+
+package syscall
+
+const (
+ AF_UNSPEC = iota
+ AF_UNIX
+ AF_INET
+ AF_INET6
+)
+
+const (
+ SOCK_STREAM = 1 + iota
+ SOCK_DGRAM
+ SOCK_RAW
+ SOCK_SEQPACKET
+)
+
+const (
+ IPPROTO_IP = 0
+ IPPROTO_IPV4 = 4
+ IPPROTO_IPV6 = 0x29
+ IPPROTO_TCP = 6
+ IPPROTO_UDP = 0x11
+)
+
+const (
+ _ = iota
+ IPV6_V6ONLY
+ SOMAXCONN
+ SO_ERROR
+)
+
+type Sockaddr interface {
+}
+
+type SockaddrInet4 struct {
+ Port int
+ Addr [4]byte
+}
+
+type SockaddrInet6 struct {
+ Port int
+ ZoneId uint32
+ Addr [16]byte
+}
+
+type SockaddrUnix struct {
+ Name string
+}
+
+func Socket(proto, sotype, unused int) (fd int, err error) {
+ return 0, ENOSYS
+}
+
+func Bind(fd int, sa Sockaddr) error {
+ return ENOSYS
+}
+
+func StopIO(fd int) error {
+ return ENOSYS
+}
+
+func Listen(fd int, backlog int) error {
+ return ENOSYS
+}
+
+func Accept(fd int) (newfd int, sa Sockaddr, err error) {
+ return 0, nil, ENOSYS
+}
+
+func Connect(fd int, sa Sockaddr) error {
+ return ENOSYS
+}
+
+func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
+ return 0, nil, ENOSYS
+}
+
+func Sendto(fd int, p []byte, flags int, to Sockaddr) error {
+ return ENOSYS
+}
+
+func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn, recvflags int, from Sockaddr, err error) {
+ return 0, 0, 0, nil, ENOSYS
+}
+
+func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
+ return 0, ENOSYS
+}
+
+func GetsockoptInt(fd, level, opt int) (value int, err error) {
+ return 0, ENOSYS
+}
+
+func SetsockoptInt(fd, level, opt int, value int) error {
+ return nil
+}
+
+func SetReadDeadline(fd int, t int64) error {
+ return ENOSYS
+}
+
+func SetWriteDeadline(fd int, t int64) error {
+ return ENOSYS
+}
+
+func Shutdown(fd int, how int) error {
+ return ENOSYS
+}
+
+func SetNonblock(fd int, nonblocking bool) error {
+ return nil
+}