github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/sysfs/sock_unsupported.go (about) 1 //go:build !linux && !darwin && !windows 2 3 package sysfs 4 5 import ( 6 "net" 7 "syscall" 8 9 "github.com/bananabytelabs/wazero/experimental/sys" 10 experimentalsys "github.com/bananabytelabs/wazero/experimental/sys" 11 "github.com/bananabytelabs/wazero/internal/fsapi" 12 socketapi "github.com/bananabytelabs/wazero/internal/sock" 13 ) 14 15 // MSG_PEEK is a filler value. 16 const MSG_PEEK = 0x2 17 18 func newTCPListenerFile(tl *net.TCPListener) socketapi.TCPSock { 19 return &unsupportedSockFile{} 20 } 21 22 type unsupportedSockFile struct { 23 baseSockFile 24 } 25 26 // Accept implements the same method as documented on socketapi.TCPSock 27 func (f *unsupportedSockFile) Accept() (socketapi.TCPConn, sys.Errno) { 28 return nil, sys.ENOSYS 29 } 30 31 func _pollSock(conn syscall.Conn, flag fsapi.Pflag, timeoutMillis int32) (bool, sys.Errno) { 32 return false, sys.ENOTSUP 33 } 34 35 func setNonblockSocket(fd uintptr, enabled bool) sys.Errno { 36 return sys.ENOTSUP 37 } 38 39 func readSocket(fd uintptr, buf []byte) (int, sys.Errno) { 40 return -1, sys.ENOTSUP 41 } 42 43 func writeSocket(fd uintptr, buf []byte) (int, sys.Errno) { 44 return -1, sys.ENOTSUP 45 } 46 47 func recvfrom(fd uintptr, buf []byte, flags int32) (n int, errno sys.Errno) { 48 return -1, sys.ENOTSUP 49 } 50 51 // syscallConnControl extracts a syscall.RawConn from the given syscall.Conn and applies 52 // the given fn to a file descriptor, returning an integer or a nonzero syscall.Errno on failure. 53 // 54 // syscallConnControl streamlines the pattern of extracting the syscall.Rawconn, 55 // invoking its syscall.RawConn.Control method, then handling properly the errors that may occur 56 // within fn or returned by syscall.RawConn.Control itself. 57 func syscallConnControl(conn syscall.Conn, fn func(fd uintptr) (int, experimentalsys.Errno)) (n int, errno sys.Errno) { 58 return -1, sys.ENOTSUP 59 }