tunnel/tunnel.go: add SetPcapFd()
celzero/rethink-app#1309
PoC: Lanius-collaris/playground1
func GoHello(fd int32) int64{
out:=os.NewFile(uintptr(fd), "")
defer out.Close()
str:=fmt.Sprintf("hello from golang, pid: %d\n", os.Getpid())
len,_:=out.Write([]byte(str))
return int64(len)
}
Passing a SAF fd to tunnel.SetPcapFd works?
Did this ever work? If so, we'd prefer passing FD instead. In our tests, it never did (not this particular code but the one we wrote when we first impl this feature).
I have not tested on real rethink-app, but the PoC works whether I pass mode w or mode wa to openFileDescriptor().
Could you tell me the commit id of your test? Maybe I can find why it doesn't work.
That code isn't public, I'm afraid. The current code (passing filepath instead of fd) works, so we will leave it as-is, as there are other complications with passing the fd around (such as double-close & use-after-close, since both Kotlinland & Goland may think they own the fd).