Files
wazero/internal/sysfs/poll.go
Crypt Keeper 8d3874d3c8 fsapi: migrates PollRead to Poll with Pflag (#1599)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Co-authored-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-07-30 10:56:17 +08:00

19 lines
506 B
Go

//go:build windows || linux || darwin
package sysfs
import (
"github.com/tetratelabs/wazero/experimental/sys"
"github.com/tetratelabs/wazero/internal/fsapi"
)
// poll implements `Poll` as documented on fsapi.File via a file descriptor.
func poll(fd uintptr, flag fsapi.Pflag, timeoutMillis int32) (ready bool, errno sys.Errno) {
if flag != fsapi.POLLIN {
return false, sys.ENOTSUP
}
fds := []pollFd{newPollFd(fd, _POLLIN, 0)}
count, errno := _poll(fds, timeoutMillis)
return count > 0, errno
}