mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-21 12:59:04 +00:00
os/file_unix: add runtime function net.NewFile stub
Signed-off-by: leongross <leon.gross@9elements.com>
This commit is contained in:
@@ -12,6 +12,7 @@ package os
|
|||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
_ "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const DevNull = "/dev/null"
|
const DevNull = "/dev/null"
|
||||||
@@ -223,3 +224,17 @@ func newUnixDirent(parent, name string, typ FileMode) (DirEntry, error) {
|
|||||||
ude.info = info
|
ude.info = info
|
||||||
return ude, nil
|
return ude, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since internal/poll is not available, we need to stub this out.
|
||||||
|
// Big go requires the option to add the fd to the polling system.
|
||||||
|
//
|
||||||
|
//go:linkname net_newUnixFile net.newUnixFile
|
||||||
|
func net_newUnixFile(fd int, name string) *File {
|
||||||
|
if fd < 0 {
|
||||||
|
panic("invalid FD")
|
||||||
|
}
|
||||||
|
|
||||||
|
// see src/os/file_unix.go:162 newFile for the original implementation.
|
||||||
|
// return newFile(fd, name, kindSock, true)
|
||||||
|
return NewFile(uintptr(fd), name)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user