diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
commit | 519725bb3c075ee2462c929f5997cb068e18466a (patch) | |
tree | 5b162e8488ad147a645048c073577821b4a2bee9 /src/pkg/net/unixsock_posix.go | |
parent | 842623c5dd2819d980ca9c58048d6bc6ed82475f (diff) | |
download | golang-upstream-weekly/2012.03.22.tar.gz |
Imported Upstream version 2012.03.22upstream-weekly/2012.03.22
Diffstat (limited to 'src/pkg/net/unixsock_posix.go')
-rw-r--r-- | src/pkg/net/unixsock_posix.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/pkg/net/unixsock_posix.go b/src/pkg/net/unixsock_posix.go index 3a94cf5c5..37a2b1e09 100644 --- a/src/pkg/net/unixsock_posix.go +++ b/src/pkg/net/unixsock_posix.go @@ -59,7 +59,7 @@ func unixSocket(net string, laddr, raddr *UnixAddr, mode string) (fd *netFD, err f = sockaddrToUnixpacket } - fd, err = socket(net, syscall.AF_UNIX, sotype, 0, la, ra, f) + fd, err = socket(net, syscall.AF_UNIX, sotype, 0, false, la, ra, f) if err != nil { goto Error } @@ -208,8 +208,8 @@ func (c *UnixConn) SetWriteBuffer(bytes int) error { } // ReadFromUnix reads a packet from c, copying the payload into b. -// It returns the number of bytes copied into b and the return address -// that was on the packet. +// It returns the number of bytes copied into b and the source address +// of the packet. // // ReadFromUnix can be made to time out and return // an error with Timeout() == true after a fixed time limit; @@ -264,6 +264,11 @@ func (c *UnixConn) WriteTo(b []byte, addr Addr) (n int, err error) { return c.WriteToUnix(b, a) } +// ReadMsgUnix reads a packet from c, copying the payload into b +// and the associated out-of-band data into oob. +// It returns the number of bytes copied into b, the number of +// bytes copied into oob, the flags that were set on the packet, +// and the source address of the packet. func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAddr, err error) { if !c.ok() { return 0, 0, 0, nil, syscall.EINVAL @@ -276,6 +281,9 @@ func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAdd return } +// WriteMsgUnix writes a packet to addr via c, copying the payload from b +// and the associated out-of-band data from oob. It returns the number +// of payload and out-of-band bytes written. func (c *UnixConn) WriteMsgUnix(b, oob []byte, addr *UnixAddr) (n, oobn int, err error) { if !c.ok() { return 0, 0, syscall.EINVAL |