...
1
2
3 package sysfs
4
5 import (
6 "syscall"
7
8 "github.com/tetratelabs/wazero/experimental/sys"
9 )
10
11 const (
12 nonBlockingFileReadSupported = true
13 nonBlockingFileWriteSupported = true
14 )
15
16 func rmdir(path string) sys.Errno {
17 err := syscall.Rmdir(path)
18 return sys.UnwrapOSError(err)
19 }
20
21
22 func readFd(fd uintptr, buf []byte) (int, sys.Errno) {
23 if len(buf) == 0 {
24 return 0, 0
25 }
26 n, err := syscall.Read(int(fd), buf)
27 errno := sys.UnwrapOSError(err)
28 return n, errno
29 }
30
31
32 func writeFd(fd uintptr, buf []byte) (int, sys.Errno) {
33 if len(buf) == 0 {
34 return 0, 0
35 }
36 n, err := syscall.Write(int(fd), buf)
37 errno := sys.UnwrapOSError(err)
38 return n, errno
39 }
40
View as plain text