poll.go

 1//go:build windows || (linux && !tinygo) || darwin
 2
 3package sysfs
 4
 5import (
 6	"github.com/tetratelabs/wazero/experimental/sys"
 7	"github.com/tetratelabs/wazero/internal/fsapi"
 8)
 9
10// poll implements `Poll` as documented on sys.File via a file descriptor.
11func poll(fd uintptr, flag fsapi.Pflag, timeoutMillis int32) (ready bool, errno sys.Errno) {
12	if flag != fsapi.POLLIN {
13		return false, sys.ENOTSUP
14	}
15	fds := []pollFd{newPollFd(fd, _POLLIN, 0)}
16	count, errno := _poll(fds, timeoutMillis)
17	return count > 0, errno
18}