extracts FS interfaces into fsapi package and consolidates impls (#1477)
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>
This commit is contained in:
18
internal/sysfs/select_linux.go
Normal file
18
internal/sysfs/select_linux.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package sysfs
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/tetratelabs/wazero/internal/platform"
|
||||
)
|
||||
|
||||
// syscall_select invokes select on Unix (unless Darwin), with the given timeout Duration.
|
||||
func syscall_select(n int, r, w, e *platform.FdSet, timeout *time.Duration) (int, error) {
|
||||
var t *syscall.Timeval
|
||||
if timeout != nil {
|
||||
tv := syscall.NsecToTimeval(timeout.Nanoseconds())
|
||||
t = &tv
|
||||
}
|
||||
return syscall.Select(n, (*syscall.FdSet)(r), (*syscall.FdSet)(w), (*syscall.FdSet)(e), t)
|
||||
}
|
||||
Reference in New Issue
Block a user