aboutsummaryrefslogtreecommitdiff
path: root/libpod/oci_conmon_attach_linux.go
blob: f1aa89d3e97536022eef341101ee05ef8b9542ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package libpod

import (
	"fmt"
	"net"

	"golang.org/x/sys/unix"
)

func openUnixSocket(path string) (*net.UnixConn, error) {
	fd, err := unix.Open(path, unix.O_PATH, 0)
	if err != nil {
		return nil, err
	}
	defer unix.Close(fd)
	return net.DialUnix("unixpacket", nil, &net.UnixAddr{Name: fmt.Sprintf("/proc/self/fd/%d", fd), Net: "unixpacket"})
}