WASI & darwin: support basic file io based on libc

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
Takeshi Yoneda
2021-03-18 12:53:32 +09:00
committed by Ron Evans
parent 6d3c11627c
commit 1406453350
16 changed files with 390 additions and 84 deletions
+5 -1
View File
@@ -1,8 +1,9 @@
// +build darwin linux,!baremetal,!wasi freebsd,!baremetal
// +build darwin linux,!baremetal freebsd,!baremetal
package os
import (
"io"
"syscall"
)
@@ -77,6 +78,9 @@ type unixFileHandle uintptr
func (f unixFileHandle) Read(b []byte) (n int, err error) {
n, err = syscall.Read(int(f), b)
err = handleSyscallError(err)
if n == 0 && err == nil {
err = io.EOF
}
return
}