Allows wasip1 guests to use arbitrarily nested pre-opens (#1536)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2023-06-27 10:02:57 +08:00
committed by GitHub
parent 451a1b63a0
commit 53ce5eea83
12 changed files with 218 additions and 1174 deletions

View File

@@ -839,11 +839,10 @@ func (c *moduleConfig) toSysContext() (sysCtx *internalsys.Context, err error) {
environ = append(environ, result)
}
var fs fsapi.FS
var fs []fsapi.FS
var guestPaths []string
if f, ok := c.fsConfig.(*fsConfig); ok {
if fs, err = f.toFS(); err != nil {
return
}
fs, guestPaths = f.preopens()
}
var listeners []*net.TCPListener
@@ -864,7 +863,7 @@ func (c *moduleConfig) toSysContext() (sysCtx *internalsys.Context, err error) {
c.walltime, c.walltimeResolution,
c.nanotime, c.nanotimeResolution,
c.nanosleep, c.osyield,
fs,
fs, guestPaths,
listeners,
)
}