Skip to content

Commit 01dac8b

Browse files
leongrossdeadprogram
authored andcommitted
os/file_unix: add runtime function net.NewFile stub
Signed-off-by: leongross <[email protected]>
1 parent ac5f84e commit 01dac8b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/os/file_unix.go

+15
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ package os
1212
import (
1313
"io"
1414
"syscall"
15+
_ "unsafe"
1516
)
1617

1718
const DevNull = "/dev/null"
@@ -223,3 +224,17 @@ func newUnixDirent(parent, name string, typ FileMode) (DirEntry, error) {
223224
ude.info = info
224225
return ude, nil
225226
}
227+
228+
// Since internal/poll is not available, we need to stub this out.
229+
// Big go requires the option to add the fd to the polling system.
230+
//
231+
//go:linkname net_newUnixFile net.newUnixFile
232+
func net_newUnixFile(fd int, name string) *File {
233+
if fd < 0 {
234+
panic("invalid FD")
235+
}
236+
237+
// see src/os/file_unix.go:162 newFile for the original implementation.
238+
// return newFile(fd, name, kindSock, true)
239+
return NewFile(uintptr(fd), name)
240+
}

0 commit comments

Comments
 (0)