github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/sysfs/poll.go (about)

     1  //go:build windows || linux || darwin
     2  
     3  package sysfs
     4  
     5  import (
     6  	"github.com/bananabytelabs/wazero/experimental/sys"
     7  	"github.com/bananabytelabs/wazero/internal/fsapi"
     8  )
     9  
    10  // poll implements `Poll` as documented on sys.File via a file descriptor.
    11  func 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  }