From c66336b0ab7ec87febaf7e098c77a49282df17f0 Mon Sep 17 00:00:00 2001 From: leongross Date: Fri, 11 Oct 2024 15:16:42 +0200 Subject: [PATCH] os/file_unix: add runtime function net.NewFile stub Signed-off-by: leongross --- src/os/file_unix.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/os/file_unix.go b/src/os/file_unix.go index efbd8ef672..76d35a62cc 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) +}