updated vendor
This commit is contained in:
+9
-8
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/tetratelabs/wazero/experimental/sys"
|
||||
"github.com/tetratelabs/wazero/internal/descriptor"
|
||||
"github.com/tetratelabs/wazero/internal/fsapi"
|
||||
socketapi "github.com/tetratelabs/wazero/internal/sock"
|
||||
"github.com/tetratelabs/wazero/internal/sysfs"
|
||||
)
|
||||
@@ -51,7 +50,7 @@ type FileEntry struct {
|
||||
FS sys.FS
|
||||
|
||||
// File is always non-nil.
|
||||
File fsapi.File
|
||||
File sys.File
|
||||
|
||||
// direntCache is nil until DirentCache was called.
|
||||
direntCache *DirentCache
|
||||
@@ -272,7 +271,7 @@ func (c *FSContext) OpenFile(fs sys.FS, path string, flag sys.Oflag, perm fs.Fil
|
||||
if f, errno := fs.OpenFile(path, flag, perm); errno != 0 {
|
||||
return 0, errno
|
||||
} else {
|
||||
fe := &FileEntry{FS: fs, File: fsapi.Adapt(f)}
|
||||
fe := &FileEntry{FS: fs, File: f}
|
||||
if path == "/" || path == "." {
|
||||
fe.Name = ""
|
||||
} else {
|
||||
@@ -329,12 +328,14 @@ func (c *FSContext) SockAccept(sockFD int32, nonblock bool) (int32, sys.Errno) {
|
||||
return 0, errno
|
||||
}
|
||||
|
||||
fe := &FileEntry{File: fsapi.Adapt(conn)}
|
||||
fe := &FileEntry{File: conn}
|
||||
|
||||
if nonblock {
|
||||
if errno = fe.File.SetNonblock(true); errno != 0 {
|
||||
_ = conn.Close()
|
||||
return 0, errno
|
||||
if pf, ok := fe.File.(sys.PollableFile); ok {
|
||||
if errno = pf.SetNonblock(true); errno != 0 {
|
||||
_ = conn.Close()
|
||||
return 0, errno
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,7 +413,7 @@ func (c *Context) InitFSContext(
|
||||
}
|
||||
|
||||
for _, tl := range tcpListeners {
|
||||
c.fsc.openedFiles.Insert(&FileEntry{IsPreopen: true, File: fsapi.Adapt(sysfs.NewTCPListenerFile(tl))})
|
||||
c.fsc.openedFiles.Insert(&FileEntry{IsPreopen: true, File: sysfs.NewTCPListenerFile(tl)})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
-16
@@ -2,7 +2,6 @@ package sys
|
||||
|
||||
import (
|
||||
experimentalsys "github.com/tetratelabs/wazero/experimental/sys"
|
||||
"github.com/tetratelabs/wazero/internal/fsapi"
|
||||
"github.com/tetratelabs/wazero/sys"
|
||||
)
|
||||
|
||||
@@ -134,18 +133,3 @@ func (d *lazyDir) Close() experimentalsys.Errno {
|
||||
}
|
||||
return f.Close()
|
||||
}
|
||||
|
||||
// IsNonblock implements the same method as documented on fsapi.File
|
||||
func (d *lazyDir) IsNonblock() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// SetNonblock implements the same method as documented on fsapi.File
|
||||
func (d *lazyDir) SetNonblock(bool) experimentalsys.Errno {
|
||||
return experimentalsys.EISDIR
|
||||
}
|
||||
|
||||
// Poll implements the same method as documented on fsapi.File
|
||||
func (d *lazyDir) Poll(fsapi.Pflag, int32) (ready bool, errno experimentalsys.Errno) {
|
||||
return false, experimentalsys.ENOSYS
|
||||
}
|
||||
|
||||
+16
-19
@@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
|
||||
experimentalsys "github.com/tetratelabs/wazero/experimental/sys"
|
||||
"github.com/tetratelabs/wazero/internal/fsapi"
|
||||
"github.com/tetratelabs/wazero/internal/sysfs"
|
||||
"github.com/tetratelabs/wazero/sys"
|
||||
)
|
||||
@@ -24,6 +23,19 @@ func (f *StdinFile) Read(buf []byte) (int, experimentalsys.Errno) {
|
||||
return n, experimentalsys.UnwrapOSError(err)
|
||||
}
|
||||
|
||||
// Poll implements the same method as documented on experimentalsys.Pollable
|
||||
func (f *StdinFile) Poll(flag experimentalsys.Pflag, timeoutMillis int32) (ready bool, errno experimentalsys.Errno) {
|
||||
if p, ok := f.Reader.(experimentalsys.Pollable); ok {
|
||||
return p.Poll(flag, timeoutMillis)
|
||||
}
|
||||
|
||||
if flag != experimentalsys.POLLIN {
|
||||
return false, experimentalsys.ENOTSUP
|
||||
}
|
||||
|
||||
return true, 0 // No poll support; assume always ready
|
||||
}
|
||||
|
||||
type writerFile struct {
|
||||
noopStdoutFile
|
||||
|
||||
@@ -48,9 +60,9 @@ func (noopStdinFile) Read([]byte) (int, experimentalsys.Errno) {
|
||||
return 0, 0 // Always EOF
|
||||
}
|
||||
|
||||
// Poll implements the same method as documented on fsapi.File
|
||||
func (noopStdinFile) Poll(flag fsapi.Pflag, timeoutMillis int32) (ready bool, errno experimentalsys.Errno) {
|
||||
if flag != fsapi.POLLIN {
|
||||
// Poll implements the same method as documented on experimentalsys.Pollable
|
||||
func (noopStdinFile) Poll(flag experimentalsys.Pflag, timeoutMillis int32) (ready bool, errno experimentalsys.Errno) {
|
||||
if flag != experimentalsys.POLLIN {
|
||||
return false, experimentalsys.ENOTSUP
|
||||
}
|
||||
return true, 0 // always ready to read nothing
|
||||
@@ -84,21 +96,6 @@ func (noopStdioFile) IsDir() (bool, experimentalsys.Errno) {
|
||||
// Close implements the same method as documented on sys.File
|
||||
func (noopStdioFile) Close() (errno experimentalsys.Errno) { return }
|
||||
|
||||
// IsNonblock implements the same method as documented on fsapi.File
|
||||
func (noopStdioFile) IsNonblock() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// SetNonblock implements the same method as documented on fsapi.File
|
||||
func (noopStdioFile) SetNonblock(bool) experimentalsys.Errno {
|
||||
return experimentalsys.ENOSYS
|
||||
}
|
||||
|
||||
// Poll implements the same method as documented on fsapi.File
|
||||
func (noopStdioFile) Poll(fsapi.Pflag, int32) (ready bool, errno experimentalsys.Errno) {
|
||||
return false, experimentalsys.ENOSYS
|
||||
}
|
||||
|
||||
func stdinFileEntry(r io.Reader) (*FileEntry, error) {
|
||||
if r == nil {
|
||||
return &FileEntry{Name: "stdin", IsPreopen: true, File: &noopStdinFile{}}, nil
|
||||
|
||||
Reference in New Issue
Block a user