github.com/tetratelabs/wazero@v1.2.1/internal/sysfs/select_linux.go (about)

     1  package sysfs
     2  
     3  import (
     4  	"syscall"
     5  	"time"
     6  
     7  	"github.com/tetratelabs/wazero/internal/platform"
     8  )
     9  
    10  // syscall_select invokes select on Unix (unless Darwin), with the given timeout Duration.
    11  func syscall_select(n int, r, w, e *platform.FdSet, timeout *time.Duration) (int, error) {
    12  	var t *syscall.Timeval
    13  	if timeout != nil {
    14  		tv := syscall.NsecToTimeval(timeout.Nanoseconds())
    15  		t = &tv
    16  	}
    17  	return syscall.Select(n, (*syscall.FdSet)(r), (*syscall.FdSet)(w), (*syscall.FdSet)(e), t)
    18  }