stub out more types/funcs to compile against golang.org/x/net/internal/socket (#4037)

* stub out more types/funcs to compile against golang.org/x/net/internal/socket

These are changes need to compile github.com/domainr/dnsr/ with TinyGo.
See issue https://github.com/tinygo-org/net/issues/14.

These change are mostly to fix missing symbols in src/crypto/tls and
src/net.  Missing types and functions are cut-and-pasted from go1.21.4.
Functions are stubbed out returning errors.New("not implemented").

DNRS is compiled by running tinygo test:

   sfeldma@nuc:~/work/dnsr$ tinygo test -target=wasi

With this patch, and a corresponding patch for tinygo-org/net to fixup
src/net, you should get a clean compile.
This commit is contained in:
Scott Feldman
2023-12-17 06:32:53 -08:00
committed by GitHub
parent 731bd5cd1b
commit a511f18c64
4 changed files with 531 additions and 4 deletions
+25
View File
@@ -1,3 +1,28 @@
package syscall
import (
"errors"
"sync/atomic"
)
const (
MSG_DONTWAIT = 0x40
AF_INET = 0x2
AF_INET6 = 0xa
)
func Exit(code int)
type Rlimit struct {
Cur uint64
Max uint64
}
// origRlimitNofile, if not {0, 0}, is the original soft RLIMIT_NOFILE.
// When we can assume that we are bootstrapping with Go 1.19,
// this can be atomic.Pointer[Rlimit].
var origRlimitNofile atomic.Value // of Rlimit
func Setrlimit(resource int, rlim *Rlimit) error {
return errors.New("Setrlimit not implemented")
}