adds experimental sys.Errno to begin decoupling from the syscall package (#1582)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2023-07-17 08:13:29 +08:00
committed by GitHub
parent 1dafce0b2a
commit 2f8dd23097
94 changed files with 1591 additions and 1374 deletions

View File

@@ -3,8 +3,8 @@ package sysfs
import (
"net"
"os"
"syscall"
experimentalsys "github.com/tetratelabs/wazero/experimental/sys"
"github.com/tetratelabs/wazero/internal/fsapi"
socketapi "github.com/tetratelabs/wazero/internal/sock"
"github.com/tetratelabs/wazero/sys"
@@ -24,14 +24,14 @@ type baseSockFile struct {
var _ fsapi.File = (*baseSockFile)(nil)
// IsDir implements the same method as documented on File.IsDir
func (*baseSockFile) IsDir() (bool, syscall.Errno) {
func (*baseSockFile) IsDir() (bool, experimentalsys.Errno) {
// We need to override this method because WASI-libc prestats the FD
// and the default impl returns ENOSYS otherwise.
return false, 0
}
// Stat implements the same method as documented on File.Stat
func (f *baseSockFile) Stat() (fs sys.Stat_t, errno syscall.Errno) {
func (f *baseSockFile) Stat() (fs sys.Stat_t, errno experimentalsys.Errno) {
// The mode is not really important, but it should be neither a regular file nor a directory.
fs.Mode = os.ModeIrregular
return