Skip to content

Commit

Permalink
os/file_unix: add runtime function net.NewFile stub
Browse files Browse the repository at this point in the history
Signed-off-by: leongross <[email protected]>
  • Loading branch information
leongross committed Oct 11, 2024
1 parent 87c6e19 commit c66336b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/os/file_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package os
import (
"io"
"syscall"
_ "unsafe"
)

const DevNull = "/dev/null"
Expand Down Expand Up @@ -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)
}

0 comments on commit c66336b

Please sign in to comment.