summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-09-25 23:48:18 +0000
committergVisor bot <gvisor-bot@google.com>2019-09-25 23:48:18 +0000
commitbf8a45ee0966b102081833e859135ea2f7aea7cc (patch)
treeb5d3f2d5b8cdb480df02e6c5a5641a681d4ace77 /pkg
parent38a7d3675851376a176b90d4480f4d70d1448d83 (diff)
parentdd0e5eedaeb21582820856cbe68eb2a625f395aa (diff)
Merge release-20190806.1-195-gdd0e5ee (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/fd/fd.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/fd/fd.go b/pkg/fd/fd.go
index 83bcfe220..7691b477b 100644
--- a/pkg/fd/fd.go
+++ b/pkg/fd/fd.go
@@ -22,6 +22,8 @@ import (
"runtime"
"sync/atomic"
"syscall"
+
+ "gvisor.dev/gvisor/pkg/unet"
)
// ReadWriter implements io.ReadWriter, io.ReaderAt, and io.WriterAt for fd. It
@@ -185,6 +187,12 @@ func OpenAt(dir *FD, path string, flags int, mode uint32) (*FD, error) {
return New(f), nil
}
+// DialUnix connects to a Unix Domain Socket and return the file descriptor.
+func DialUnix(path string) (*FD, error) {
+ socket, err := unet.Connect(path, false)
+ return New(socket.FD()), err
+}
+
// Close closes the file descriptor contained in the FD.
//
// Close is safe to call multiple times, but will return an error after the