Skip to content

Commit

Permalink
further restrict net package usage
Browse files Browse the repository at this point in the history
Signed-off-by: leongross <leon.gross@9elements.com>
  • Loading branch information
leongross committed Oct 28, 2024
1 parent 513f947 commit e1f18b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions loader/goroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,19 @@ func needsSyscallPackage(buildTags []string) bool {

// linuxNetworking returns whether the unmodified go linux net stack should be used
// until the full rework of the net package is done.
// To ensure the correct build target, check for the following tags:
// linux && !baremetal && !nintendoswitch && !tinygo.wasm
func linuxNetworking(buildTags []string) bool {
targetLinux := false
for _, tag := range buildTags {
if tag == "linux" {
return true
targetLinux = true
}
if tag == "baremetal" || tag == "nintendoswitch" || tag == "tinygo.wasm" {
return false
}
}
return false
return targetLinux
}

// The boolean indicates whether to merge the subdirs.
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/netpoll.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ func poll_runtime_pollSetDeadline(pd *pollDesc, d int64, mode int) {
//go:linkname poll_runtime_pollOpen internal/poll.runtime_pollOpen
func poll_runtime_pollOpen(fd uintptr) (*pollDesc, int) {
// println("poll_runtime_pollOpen not implemented", fd)
return &pollDesc{runtimeCtx: uintptr(0xdeadbeef)}, pollNoError
return &pollDesc{runtimeCtx: uintptr(0x1337)}, pollNoError
}
2 changes: 1 addition & 1 deletion src/syscall/forklock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build tinygo && linux && !wasip1 && !wasip2 && !darwin
//go:build tinygo && linux && !wasip1 && !wasip2 && !darwin && !baremetal

package syscall

Expand Down

0 comments on commit e1f18b2

Please sign in to comment.