diff options
author | leongross <[email protected]> | 2024-10-11 15:16:42 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-10-18 18:37:49 +0100 |
commit | 01dac8ba8e3efb801f560987bfe11b7882c342ca (patch) | |
tree | c3a83470641da51faa9b55066eaa8c857f9cd384 /src | |
parent | ac5f84e3d7b837643507fbd2b5af44b81a61af2e (diff) | |
download | tinygo-01dac8ba8e3efb801f560987bfe11b7882c342ca.tar.gz tinygo-01dac8ba8e3efb801f560987bfe11b7882c342ca.zip |
os/file_unix: add runtime function net.NewFile stub
Signed-off-by: leongross <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/os/file_unix.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/os/file_unix.go b/src/os/file_unix.go index efbd8ef67..76d35a62c 100644 --- a/src/os/file_unix.go +++ b/src/os/file_unix.go @@ -12,6 +12,7 @@ package os import ( "io" "syscall" + _ "unsafe" ) const DevNull = "/dev/null" @@ -223,3 +224,17 @@ func newUnixDirent(parent, name string, typ FileMode) (DirEntry, error) { ude.info = info 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) +} |