github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/sysfs/poll.go (about)

     1  //go:build windows || (linux && !tinygo) || darwin
     2  
     3  package sysfs
     4  
     5  import (
     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.
    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  }