Files
anyhttp/fd_unix.go
Balakrishnan Balasubramanian 80808310ce Make sure the library compiles for windows
systemd sockets are not applicable for windows. However compilation
should not fail on windows
2025-07-17 20:53:10 -04:00

20 lines
292 B
Go

//go:build unix
package anyhttp
import (
"net"
"os"
"syscall"
)
func makeFdListener(fd int, name string) (net.Listener, error) {
fdFile := os.NewFile(uintptr(fd), name)
l, err := net.FileListener(fdFile)
if err != nil {
return nil, err
}
syscall.CloseOnExec(fd)
return l, nil
}