github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/sysfs/nonblock_windows.go (about) 1 package sysfs 2 3 import ( 4 "io/fs" 5 "syscall" 6 7 "github.com/wasilibs/wazerox/experimental/sys" 8 ) 9 10 func setNonblock(fd uintptr, enable bool) sys.Errno { 11 // We invoke the syscall, but this is currently no-op. 12 return sys.UnwrapOSError(syscall.SetNonblock(syscall.Handle(fd), enable)) 13 } 14 15 func isNonblock(f *osFile) bool { 16 // On Windows, we support non-blocking reads only on named pipes. 17 isValid := false 18 st, errno := f.Stat() 19 if errno == 0 { 20 isValid = st.Mode&fs.ModeNamedPipe != 0 21 } 22 return isValid && f.flag&sys.O_NONBLOCK == sys.O_NONBLOCK 23 }