forked from tetratelabs/wazero
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit f834753 Author: Gaukas Wang <[email protected]> Date: Thu Dec 28 12:50:37 2023 -0700 fix: failed nonblocking file fd_write subscription Modify to bypass the on-purpose failing for now. More heavy modification is needed to fully address the underlying issue. commit f29a67b Author: Gaukas Wang <[email protected]> Date: Thu Dec 28 12:43:45 2023 -0700 feat: api.Module insert file/socket commit faa3b83 Author: Gaukas Wang <[email protected]> Date: Thu Dec 28 12:33:26 2023 -0700 feat: CompiledModule dump imports and exports commit d8e5ce2 Author: Gaukas Wang <[email protected]> Date: Thu Dec 28 12:29:09 2023 -0700 update: README badge Point the badge to our fork instead. commit 911ea31 Author: Gaukas Wang <[email protected]> Date: Thu Dec 28 12:27:59 2023 -0700 fix: disable a certain upstream CI This CI won't pass anyways due to spec test.
- Loading branch information
Showing
12 changed files
with
209 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2023 The WATER Authors. All rights reserved. | ||
// Use of this source code is governed by Apache 2 license | ||
// that can be found in the LICENSE file. | ||
|
||
package api | ||
|
||
import ( | ||
"net" | ||
"os" | ||
) | ||
|
||
type WATERModuleExtension interface { | ||
InsertTCPConn(*net.TCPConn) (key int32, ok bool) | ||
InsertTCPListener(*net.TCPListener) (key int32, ok bool) | ||
InsertOSFile(*os.File) (key int32, ok bool) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2023 The WATER Authors. All rights reserved. | ||
// Use of this source code is governed by Apache 2 license | ||
// that can be found in the LICENSE file. | ||
|
||
package wazerotest | ||
|
||
import ( | ||
"net" | ||
"os" | ||
) | ||
|
||
// TODO: implement the extended functions | ||
|
||
func (m *Module) InsertTCPConn(*net.TCPConn) (key int32, ok bool) { | ||
return 0, false | ||
} | ||
|
||
func (m *Module) InsertTCPListener(*net.TCPListener) (key int32, ok bool) { | ||
return 0, false | ||
} | ||
|
||
func (m *Module) InsertOSFile(*os.File) (key int32, ok bool) { | ||
return 0, false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2023 The WATER Authors. All rights reserved. | ||
// Use of this source code is governed by Apache 2 license | ||
// that can be found in the LICENSE file. | ||
|
||
package sys | ||
|
||
import ( | ||
"net" | ||
"os" | ||
|
||
"github.com/tetratelabs/wazero/internal/fsapi" | ||
"github.com/tetratelabs/wazero/internal/sysfs" | ||
) | ||
|
||
func (c *Context) InsertTCPConn(conn *net.TCPConn) (key int32, ok bool) { | ||
return c.fsc.openedFiles.Insert(&FileEntry{ | ||
IsPreopen: true, | ||
File: fsapi.Adapt(sysfs.NewTCPConnFile(conn)), | ||
}) | ||
} | ||
|
||
func (c *Context) InsertTCPListener(listener *net.TCPListener) (key int32, ok bool) { | ||
return c.fsc.openedFiles.Insert(&FileEntry{ | ||
IsPreopen: true, | ||
File: fsapi.Adapt(sysfs.NewTCPListenerFile(listener)), | ||
}) | ||
} | ||
|
||
func (c *Context) InsertOSFile(file *os.File) (key int32, ok bool) { | ||
return c.fsc.openedFiles.Insert(&FileEntry{ | ||
IsPreopen: true, | ||
File: sysfs.NewOSFile(file.Name(), 0, 0, file), // TODO: fix flag and perm | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package sysfs | ||
|
||
import ( | ||
"io/fs" | ||
"os" | ||
|
||
experimentalsys "github.com/tetratelabs/wazero/experimental/sys" | ||
"github.com/tetratelabs/wazero/internal/fsapi" | ||
) | ||
|
||
func NewOSFile(path string, flag experimentalsys.Oflag, perm fs.FileMode, f *os.File) fsapi.File { | ||
return newOsFile(path, flag, perm, f) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package sysfs | ||
|
||
import ( | ||
"net" | ||
|
||
socketapi "github.com/tetratelabs/wazero/internal/sock" | ||
) | ||
|
||
// NewTCPConnFile creates a socketapi.TCPSock for a given *net.TCPConn. | ||
func NewTCPConnFile(tc *net.TCPConn) socketapi.TCPConn { | ||
return newTcpConn(tc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2023 The WATER Authors. All rights reserved. | ||
// Use of this source code is governed by Apache 2 license | ||
// that can be found in the LICENSE file. | ||
|
||
package wasm | ||
|
||
import ( | ||
"net" | ||
"os" | ||
) | ||
|
||
func (m *ModuleInstance) InsertTCPConn(conn *net.TCPConn) (key int32, ok bool) { | ||
return m.Sys.InsertTCPConn(conn) | ||
} | ||
|
||
func (m *ModuleInstance) InsertTCPListener(lis *net.TCPListener) (key int32, ok bool) { | ||
return m.Sys.InsertTCPListener(lis) | ||
} | ||
|
||
func (m *ModuleInstance) InsertOSFile(f *os.File) (key int32, ok bool) { | ||
return m.Sys.InsertOSFile(f) | ||
} |