diff options
author | 2025-03-09 17:47:56 +0100 | |
---|---|---|
committer | 2025-03-10 01:59:49 +0100 | |
commit | 3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch) | |
tree | f61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go | |
parent | [chore] update URLs to forked source (diff) | |
download | gotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz |
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go')
-rw-r--r-- | vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go deleted file mode 100644 index 703df42fc..000000000 --- a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go +++ /dev/null @@ -1,80 +0,0 @@ -//go:build windows - -package sysfs - -import ( - "net" - "syscall" - "unsafe" - - "github.com/tetratelabs/wazero/experimental/sys" - "github.com/tetratelabs/wazero/internal/fsapi" - socketapi "github.com/tetratelabs/wazero/internal/sock" -) - -const ( - // MSG_PEEK is the flag PEEK for syscall.Recvfrom on Windows. - // This constant is not exported on this platform. - MSG_PEEK = 0x2 - // _FIONBIO is the flag to set the O_NONBLOCK flag on socket handles using ioctlsocket. - _FIONBIO = 0x8004667e -) - -var ( - // modws2_32 is WinSock. - modws2_32 = syscall.NewLazyDLL("ws2_32.dll") - // procrecvfrom exposes recvfrom from WinSock. - procrecvfrom = modws2_32.NewProc("recvfrom") - // procioctlsocket exposes ioctlsocket from WinSock. - procioctlsocket = modws2_32.NewProc("ioctlsocket") -) - -func newTCPListenerFile(tl *net.TCPListener) socketapi.TCPSock { - return newDefaultTCPListenerFile(tl) -} - -// recvfrom exposes the underlying syscall in Windows. -// -// Note: since we are only using this to expose MSG_PEEK, -// we do not need really need all the parameters that are actually -// allowed in WinSock. -// We ignore `from *sockaddr` and `fromlen *int`. -func recvfrom(s uintptr, buf []byte, flags int32) (n int, errno sys.Errno) { - var _p0 *byte - if len(buf) > 0 { - _p0 = &buf[0] - } - r0, _, e1 := syscall.SyscallN( - procrecvfrom.Addr(), - s, - uintptr(unsafe.Pointer(_p0)), - uintptr(len(buf)), - uintptr(flags), - 0, // from *sockaddr (optional) - 0) // fromlen *int (optional) - return int(r0), sys.UnwrapOSError(e1) -} - -func setNonblockSocket(fd uintptr, enabled bool) sys.Errno { - opt := uint64(0) - if enabled { - opt = 1 - } - // ioctlsocket(fd, FIONBIO, &opt) - _, _, errno := syscall.SyscallN( - procioctlsocket.Addr(), - uintptr(fd), - uintptr(_FIONBIO), - uintptr(unsafe.Pointer(&opt))) - return sys.UnwrapOSError(errno) -} - -func _pollSock(conn syscall.Conn, flag fsapi.Pflag, timeoutMillis int32) (bool, sys.Errno) { - if flag != fsapi.POLLIN { - return false, sys.ENOTSUP - } - n, errno := syscallConnControl(conn, func(fd uintptr) (int, sys.Errno) { - return _poll([]pollFd{newPollFd(fd, _POLLIN, 0)}, timeoutMillis) - }) - return n > 0, errno -} |