~ubuntu-branches/ubuntu/trusty/golang/trusty

« back to all changes in this revision

Viewing changes to src/pkg/net/unixsock_plan9.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
// Use of this source code is governed by a BSD-style
3
3
// license that can be found in the LICENSE file.
4
4
 
5
 
// Unix domain sockets stubs for Plan 9
6
 
 
7
5
package net
8
6
 
9
7
import (
 
8
        "os"
10
9
        "syscall"
11
10
        "time"
12
11
)
13
12
 
14
 
// UnixConn is an implementation of the Conn interface
15
 
// for connections to Unix domain sockets.
16
 
type UnixConn bool
17
 
 
18
 
// Implementation of the Conn interface - see Conn for documentation.
19
 
 
20
 
// Read implements the Conn Read method.
21
 
func (c *UnixConn) Read(b []byte) (n int, err error) {
22
 
        return 0, syscall.EPLAN9
23
 
}
24
 
 
25
 
// Write implements the Conn Write method.
26
 
func (c *UnixConn) Write(b []byte) (n int, err error) {
27
 
        return 0, syscall.EPLAN9
28
 
}
29
 
 
30
 
// Close closes the Unix domain connection.
31
 
func (c *UnixConn) Close() error {
32
 
        return syscall.EPLAN9
33
 
}
34
 
 
35
 
// LocalAddr returns the local network address, a *UnixAddr.
36
 
// Unlike in other protocols, LocalAddr is usually nil for dialed connections.
37
 
func (c *UnixConn) LocalAddr() Addr {
38
 
        return nil
39
 
}
40
 
 
41
 
// RemoteAddr returns the remote network address, a *UnixAddr.
42
 
// Unlike in other protocols, RemoteAddr is usually nil for connections
43
 
// accepted by a listener.
44
 
func (c *UnixConn) RemoteAddr() Addr {
45
 
        return nil
46
 
}
47
 
 
48
 
// SetDeadline implements the Conn SetDeadline method.
49
 
func (c *UnixConn) SetDeadline(t time.Time) error {
50
 
        return syscall.EPLAN9
51
 
}
52
 
 
53
 
// SetReadDeadline implements the Conn SetReadDeadline method.
54
 
func (c *UnixConn) SetReadDeadline(t time.Time) error {
55
 
        return syscall.EPLAN9
56
 
}
57
 
 
58
 
// SetWriteDeadline implements the Conn SetWriteDeadline method.
59
 
func (c *UnixConn) SetWriteDeadline(t time.Time) error {
60
 
        return syscall.EPLAN9
 
13
// UnixConn is an implementation of the Conn interface for connections
 
14
// to Unix domain sockets.
 
15
type UnixConn struct {
 
16
        conn
 
17
}
 
18
 
 
19
// ReadFromUnix reads a packet from c, copying the payload into b.  It
 
20
// returns the number of bytes copied into b and the source address of
 
21
// the packet.
 
22
//
 
23
// ReadFromUnix can be made to time out and return an error with
 
24
// Timeout() == true after a fixed time limit; see SetDeadline and
 
25
// SetReadDeadline.
 
26
func (c *UnixConn) ReadFromUnix(b []byte) (int, *UnixAddr, error) {
 
27
        return 0, nil, syscall.EPLAN9
61
28
}
62
29
 
63
30
// ReadFrom implements the PacketConn ReadFrom method.
64
 
func (c *UnixConn) ReadFrom(b []byte) (n int, addr Addr, err error) {
65
 
        err = syscall.EPLAN9
66
 
        return
 
31
func (c *UnixConn) ReadFrom(b []byte) (int, Addr, error) {
 
32
        return 0, nil, syscall.EPLAN9
 
33
}
 
34
 
 
35
// ReadMsgUnix reads a packet from c, copying the payload into b and
 
36
// the associated out-of-band data into oob.  It returns the number of
 
37
// bytes copied into b, the number of bytes copied into oob, the flags
 
38
// that were set on the packet, and the source address of the packet.
 
39
func (c *UnixConn) ReadMsgUnix(b, oob []byte) (n, oobn, flags int, addr *UnixAddr, err error) {
 
40
        return 0, 0, 0, nil, syscall.EPLAN9
 
41
}
 
42
 
 
43
// WriteToUnix writes a packet to addr via c, copying the payload from b.
 
44
//
 
45
// WriteToUnix can be made to time out and return an error with
 
46
// Timeout() == true after a fixed time limit; see SetDeadline and
 
47
// SetWriteDeadline.  On packet-oriented connections, write timeouts
 
48
// are rare.
 
49
func (c *UnixConn) WriteToUnix(b []byte, addr *UnixAddr) (int, error) {
 
50
        return 0, syscall.EPLAN9
67
51
}
68
52
 
69
53
// WriteTo implements the PacketConn WriteTo method.
70
 
func (c *UnixConn) WriteTo(b []byte, addr Addr) (n int, err error) {
71
 
        err = syscall.EPLAN9
72
 
        return
 
54
func (c *UnixConn) WriteTo(b []byte, addr Addr) (int, error) {
 
55
        return 0, syscall.EPLAN9
 
56
}
 
57
 
 
58
// WriteMsgUnix writes a packet to addr via c, copying the payload
 
59
// from b and the associated out-of-band data from oob.  It returns
 
60
// the number of payload and out-of-band bytes written.
 
61
func (c *UnixConn) WriteMsgUnix(b, oob []byte, addr *UnixAddr) (n, oobn int, err error) {
 
62
        return 0, 0, syscall.EPLAN9
 
63
}
 
64
 
 
65
// CloseRead shuts down the reading side of the Unix domain connection.
 
66
// Most callers should just use Close.
 
67
func (c *UnixConn) CloseRead() error {
 
68
        return syscall.EPLAN9
 
69
}
 
70
 
 
71
// CloseWrite shuts down the writing side of the Unix domain connection.
 
72
// Most callers should just use Close.
 
73
func (c *UnixConn) CloseWrite() error {
 
74
        return syscall.EPLAN9
73
75
}
74
76
 
75
77
// DialUnix connects to the remote address raddr on the network net,
76
 
// which must be "unix" or "unixgram".  If laddr is not nil, it is used
77
 
// as the local address for the connection.
78
 
func DialUnix(net string, laddr, raddr *UnixAddr) (c *UnixConn, err error) {
79
 
        return nil, syscall.EPLAN9
80
 
}
81
 
 
82
 
// UnixListener is a Unix domain socket listener.
83
 
// Clients should typically use variables of type Listener
84
 
// instead of assuming Unix domain sockets.
85
 
type UnixListener bool
86
 
 
87
 
// ListenUnix announces on the Unix domain socket laddr and returns a Unix listener.
88
 
// Net must be "unix" (stream sockets).
89
 
func ListenUnix(net string, laddr *UnixAddr) (l *UnixListener, err error) {
90
 
        return nil, syscall.EPLAN9
91
 
}
92
 
 
93
 
// Accept implements the Accept method in the Listener interface;
94
 
// it waits for the next call and returns a generic Conn.
95
 
func (l *UnixListener) Accept() (c Conn, err error) {
96
 
        return nil, syscall.EPLAN9
97
 
}
98
 
 
99
 
// Close stops listening on the Unix address.
100
 
// Already accepted connections are not closed.
 
78
// which must be "unix", "unixgram" or "unixpacket".  If laddr is not
 
79
// nil, it is used as the local address for the connection.
 
80
func DialUnix(net string, laddr, raddr *UnixAddr) (*UnixConn, error) {
 
81
        return dialUnix(net, laddr, raddr, noDeadline)
 
82
}
 
83
 
 
84
func dialUnix(net string, laddr, raddr *UnixAddr, deadline time.Time) (*UnixConn, error) {
 
85
        return nil, syscall.EPLAN9
 
86
}
 
87
 
 
88
// UnixListener is a Unix domain socket listener.  Clients should
 
89
// typically use variables of type Listener instead of assuming Unix
 
90
// domain sockets.
 
91
type UnixListener struct{}
 
92
 
 
93
// ListenUnix announces on the Unix domain socket laddr and returns a
 
94
// Unix listener.  The network net must be "unix" or "unixpacket".
 
95
func ListenUnix(net string, laddr *UnixAddr) (*UnixListener, error) {
 
96
        return nil, syscall.EPLAN9
 
97
}
 
98
 
 
99
// AcceptUnix accepts the next incoming call and returns the new
 
100
// connection and the remote address.
 
101
func (l *UnixListener) AcceptUnix() (*UnixConn, error) {
 
102
        return nil, syscall.EPLAN9
 
103
}
 
104
 
 
105
// Accept implements the Accept method in the Listener interface; it
 
106
// waits for the next call and returns a generic Conn.
 
107
func (l *UnixListener) Accept() (Conn, error) {
 
108
        return nil, syscall.EPLAN9
 
109
}
 
110
 
 
111
// Close stops listening on the Unix address.  Already accepted
 
112
// connections are not closed.
101
113
func (l *UnixListener) Close() error {
102
114
        return syscall.EPLAN9
103
115
}
104
116
 
105
117
// Addr returns the listener's network address.
106
118
func (l *UnixListener) Addr() Addr { return nil }
 
119
 
 
120
// SetDeadline sets the deadline associated with the listener.
 
121
// A zero time value disables the deadline.
 
122
func (l *UnixListener) SetDeadline(t time.Time) error {
 
123
        return syscall.EPLAN9
 
124
}
 
125
 
 
126
// File returns a copy of the underlying os.File, set to blocking
 
127
// mode.  It is the caller's responsibility to close f when finished.
 
128
// Closing l does not affect f, and closing f does not affect l.
 
129
//
 
130
// The returned os.File's file descriptor is different from the
 
131
// connection's.  Attempting to change properties of the original
 
132
// using this duplicate may or may not have the desired effect.
 
133
func (l *UnixListener) File() (*os.File, error) {
 
134
        return nil, syscall.EPLAN9
 
135
}
 
136
 
 
137
// ListenUnixgram listens for incoming Unix datagram packets addressed
 
138
// to the local address laddr.  The network net must be "unixgram".
 
139
// The returned connection's ReadFrom and WriteTo methods can be used
 
140
// to receive and send packets with per-packet addressing.
 
141
func ListenUnixgram(net string, laddr *UnixAddr) (*UnixConn, error) {
 
142
        return nil, syscall.EPLAN9
 
143
}