Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
d6665bc3
Commit
d6665bc3
authored
Sep 26, 2012
by
Mikio Hara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: fix plan 9 build
R=golang-dev, lucio.dere, fshahriar CC=golang-dev
https://golang.org/cl/6562046
parent
74a7cc9b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
258 additions
and
100 deletions
+258
-100
src/pkg/net/iprawsock_plan9.go
src/pkg/net/iprawsock_plan9.go
+67
-30
src/pkg/net/ipsock_plan9.go
src/pkg/net/ipsock_plan9.go
+29
-3
src/pkg/net/tcpsock_plan9.go
src/pkg/net/tcpsock_plan9.go
+11
-12
src/pkg/net/udpsock_plan9.go
src/pkg/net/udpsock_plan9.go
+35
-17
src/pkg/net/unixsock_plan9.go
src/pkg/net/unixsock_plan9.go
+116
-38
No files found.
src/pkg/net/iprawsock_plan9.go
View file @
d6665bc3
...
@@ -7,14 +7,37 @@
...
@@ -7,14 +7,37 @@
package
net
package
net
import
(
import
(
"os"
"syscall"
"syscall"
"time"
"time"
)
)
// IPConn is the implementation of the Conn and PacketConn
// IPConn is the implementation of the Conn and PacketConn
interfaces
//
interfaces
for IP network connections.
// for IP network connections.
type
IPConn
bool
type
IPConn
bool
// Implementation of the Conn interface - see Conn for documentation.
// Read implements the Conn Read method.
func
(
c
*
IPConn
)
Read
(
b
[]
byte
)
(
int
,
error
)
{
return
0
,
syscall
.
EPLAN9
}
// Write implements the Conn Write method.
func
(
c
*
IPConn
)
Write
(
b
[]
byte
)
(
int
,
error
)
{
return
0
,
syscall
.
EPLAN9
}
// LocalAddr returns the local network address.
func
(
c
*
IPConn
)
LocalAddr
()
Addr
{
return
nil
}
// RemoteAddr returns the remote network address.
func
(
c
*
IPConn
)
RemoteAddr
()
Addr
{
return
nil
}
// SetDeadline implements the Conn SetDeadline method.
// SetDeadline implements the Conn SetDeadline method.
func
(
c
*
IPConn
)
SetDeadline
(
t
time
.
Time
)
error
{
func
(
c
*
IPConn
)
SetDeadline
(
t
time
.
Time
)
error
{
return
syscall
.
EPLAN9
return
syscall
.
EPLAN9
...
@@ -30,16 +53,23 @@ func (c *IPConn) SetWriteDeadline(t time.Time) error {
...
@@ -30,16 +53,23 @@ func (c *IPConn) SetWriteDeadline(t time.Time) error {
return
syscall
.
EPLAN9
return
syscall
.
EPLAN9
}
}
// Implementation of the Conn interface - see Conn for documentation.
// SetReadBuffer sets the size of the operating system's receive
// buffer associated with the connection.
func
(
c
*
IPConn
)
SetReadBuffer
(
bytes
int
)
error
{
return
syscall
.
EPLAN9
}
// Read implements the Conn Read method.
// SetWriteBuffer sets the size of the operating system's transmit
func
(
c
*
IPConn
)
Read
(
b
[]
byte
)
(
int
,
error
)
{
// buffer associated with the connection.
return
0
,
syscall
.
EPLAN9
func
(
c
*
IPConn
)
SetWriteBuffer
(
bytes
int
)
error
{
return
syscall
.
EPLAN9
}
}
// Write implements the Conn Write method.
// File returns a copy of the underlying os.File, set to blocking
func
(
c
*
IPConn
)
Write
(
b
[]
byte
)
(
int
,
error
)
{
// mode. It is the caller's responsibility to close f when finished.
return
0
,
syscall
.
EPLAN9
// Closing c does not affect f, and closing f does not affect c.
func
(
c
*
IPConn
)
File
()
(
f
*
os
.
File
,
err
error
)
{
return
nil
,
syscall
.
EPLAN9
}
}
// Close closes the IP connection.
// Close closes the IP connection.
...
@@ -47,16 +77,6 @@ func (c *IPConn) Close() error {
...
@@ -47,16 +77,6 @@ func (c *IPConn) Close() error {
return
syscall
.
EPLAN9
return
syscall
.
EPLAN9
}
}
// LocalAddr returns the local network address.
func
(
c
*
IPConn
)
LocalAddr
()
Addr
{
return
nil
}
// RemoteAddr returns the remote network address, a *IPAddr.
func
(
c
*
IPConn
)
RemoteAddr
()
Addr
{
return
nil
}
// IP-specific methods.
// IP-specific methods.
// ReadFromIP reads an IP packet from c, copying the payload into b.
// ReadFromIP reads an IP packet from c, copying the payload into b.
...
@@ -75,12 +95,21 @@ func (c *IPConn) ReadFrom(b []byte) (int, Addr, error) {
...
@@ -75,12 +95,21 @@ func (c *IPConn) ReadFrom(b []byte) (int, Addr, error) {
return
0
,
nil
,
syscall
.
EPLAN9
return
0
,
nil
,
syscall
.
EPLAN9
}
}
// WriteToIP writes an IP packet to addr via c, copying the payload from b.
// ReadMsgIP reads a packet from c, copying the payload into b and the
// associdated 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
*
IPConn
)
ReadMsgIP
(
b
,
oob
[]
byte
)
(
n
,
oobn
,
flags
int
,
addr
*
IPAddr
,
err
error
)
{
return
0
,
0
,
0
,
nil
,
syscall
.
EPLAN9
}
// WriteToIP writes an IP packet to addr via c, copying the payload
// from b.
//
//
// WriteToIP can be made to time out and return
// WriteToIP can be made to time out and return
an error with
//
an error with Timeout() == true after a fixed time limit;
//
Timeout() == true after a fixed time limit; see SetDeadline and
//
see SetDeadline and SetWriteDeadline.
//
SetWriteDeadline. On packet-oriented connections, write timeouts
//
On packet-oriented connections, write timeouts
are rare.
// are rare.
func
(
c
*
IPConn
)
WriteToIP
(
b
[]
byte
,
addr
*
IPAddr
)
(
int
,
error
)
{
func
(
c
*
IPConn
)
WriteToIP
(
b
[]
byte
,
addr
*
IPAddr
)
(
int
,
error
)
{
return
0
,
syscall
.
EPLAN9
return
0
,
syscall
.
EPLAN9
}
}
...
@@ -90,16 +119,24 @@ func (c *IPConn) WriteTo(b []byte, addr Addr) (int, error) {
...
@@ -90,16 +119,24 @@ func (c *IPConn) WriteTo(b []byte, addr Addr) (int, error) {
return
0
,
syscall
.
EPLAN9
return
0
,
syscall
.
EPLAN9
}
}
// DialIP connects to the remote address raddr on the network protocol netProto,
// WriteMsgIP writes a packet to addr via c, copying the payload from
// which must be "ip", "ip4", or "ip6" followed by a colon and a protocol number or name.
// b and the associated out-of-band data from oob. It returns the
// number of payload and out-of-band bytes written.
func
(
c
*
IPConn
)
WriteMsgIP
(
b
,
oob
[]
byte
,
addr
*
IPAddr
)
(
n
,
oobn
int
,
err
error
)
{
return
0
,
0
,
syscall
.
EPLAN9
}
// DialIP connects to the remote address raddr on the network protocol
// netProto, which must be "ip", "ip4", or "ip6" followed by a colon
// and a protocol number or name.
func
DialIP
(
netProto
string
,
laddr
,
raddr
*
IPAddr
)
(
*
IPConn
,
error
)
{
func
DialIP
(
netProto
string
,
laddr
,
raddr
*
IPAddr
)
(
*
IPConn
,
error
)
{
return
nil
,
syscall
.
EPLAN9
return
nil
,
syscall
.
EPLAN9
}
}
// ListenIP listens for incoming IP packets addressed to the
// ListenIP listens for incoming IP packets addressed to the
local
//
local address laddr. The returned connection c's ReadFrom
//
address laddr. The returned connection c's ReadFrom and WriteTo
//
and WriteTo methods can be used to receive and send IP
//
methods can be used to receive and send IP packets with per-packet
//
packets with per-packet
addressing.
// addressing.
func
ListenIP
(
netProto
string
,
laddr
*
IPAddr
)
(
*
IPConn
,
error
)
{
func
ListenIP
(
netProto
string
,
laddr
*
IPAddr
)
(
*
IPConn
,
error
)
{
return
nil
,
syscall
.
EPLAN9
return
nil
,
syscall
.
EPLAN9
}
}
src/pkg/net/ipsock_plan9.go
View file @
d6665bc3
...
@@ -17,9 +17,9 @@ import (
...
@@ -17,9 +17,9 @@ import (
// /sys/include/ape/sys/socket.h:/SOMAXCONN
// /sys/include/ape/sys/socket.h:/SOMAXCONN
var
listenerBacklog
=
5
var
listenerBacklog
=
5
// probeIPv6Stack returns two boolean values. If the first boolean
value is
// probeIPv6Stack returns two boolean values. If the first boolean
//
true, kernel supports basic IPv6 functionality. If the second
//
value is true, kernel supports basic IPv6 functionality. If the
// boolean value is true, kernel supports IPv6 IPv4-mapping.
//
second
boolean value is true, kernel supports IPv6 IPv4-mapping.
func
probeIPv6Stack
()
(
supportsIPv6
,
supportsIPv4map
bool
)
{
func
probeIPv6Stack
()
(
supportsIPv6
,
supportsIPv4map
bool
)
{
return
false
,
false
return
false
,
false
}
}
...
@@ -166,6 +166,25 @@ func (c *plan9Conn) SetWriteDeadline(t time.Time) error {
...
@@ -166,6 +166,25 @@ func (c *plan9Conn) SetWriteDeadline(t time.Time) error {
return
syscall
.
EPLAN9
return
syscall
.
EPLAN9
}
}
// SetReadBuffer sets the size of the operating system's receive
// buffer associated with the connection.
func
(
c
*
plan9Conn
)
SetReadBuffer
(
bytes
int
)
error
{
return
syscall
.
EPLAN9
}
// SetWriteBuffer sets the size of the operating system's transmit
// buffer associated with the connection.
func
(
c
*
plan9Conn
)
SetWriteBuffer
(
bytes
int
)
error
{
return
syscall
.
EPLAN9
}
// File returns a copy of the underlying os.File, set to blocking
// mode. It is the caller's responsibility to close f when finished.
// Closing c does not affect f, and closing f does not affect c.
func
(
c
*
plan9Conn
)
File
()
(
f
*
os
.
File
,
err
error
)
{
return
nil
,
syscall
.
EPLAN9
}
func
startPlan9
(
net
string
,
addr
Addr
)
(
ctl
*
os
.
File
,
dest
,
proto
,
name
string
,
err
error
)
{
func
startPlan9
(
net
string
,
addr
Addr
)
(
ctl
*
os
.
File
,
dest
,
proto
,
name
string
,
err
error
)
{
var
(
var
(
ip
IP
ip
IP
...
@@ -306,3 +325,10 @@ func (l *plan9Listener) Addr() Addr { return l.laddr }
...
@@ -306,3 +325,10 @@ func (l *plan9Listener) Addr() Addr { return l.laddr }
func
(
l
*
plan9Listener
)
SetDeadline
(
t
time
.
Time
)
error
{
func
(
l
*
plan9Listener
)
SetDeadline
(
t
time
.
Time
)
error
{
return
syscall
.
EPLAN9
return
syscall
.
EPLAN9
}
}
// File returns a copy of the underlying os.File, set to blocking
// mode. It is the caller's responsibility to close f when finished.
// Closing l does not affect f, and closing f does not affect l.
func
(
l
*
plan9Listener
)
File
()
(
f
*
os
.
File
,
err
error
)
{
return
nil
,
syscall
.
EPLAN9
}
src/pkg/net/tcpsock_plan9.go
View file @
d6665bc3
...
@@ -2,14 +2,14 @@
...
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// TCP for Plan 9
// TCP
sockets
for Plan 9
package
net
package
net
import
"syscall"
import
"syscall"
// TCPConn is an implementation of the Conn interface
// TCPConn is an implementation of the Conn interface
for TCP network
//
for TCP network
connections.
// connections.
type
TCPConn
struct
{
type
TCPConn
struct
{
plan9Conn
plan9Conn
}
}
...
@@ -33,8 +33,8 @@ func (c *TCPConn) CloseWrite() error {
...
@@ -33,8 +33,8 @@ func (c *TCPConn) CloseWrite() error {
}
}
// DialTCP connects to the remote address raddr on the network net,
// DialTCP connects to the remote address raddr on the network net,
// which must be "tcp", "tcp4", or "tcp6". If laddr is not nil, it is
used
// which must be "tcp", "tcp4", or "tcp6". If laddr is not nil, it is
// as the local address for the connection.
//
used
as the local address for the connection.
func
DialTCP
(
net
string
,
laddr
,
raddr
*
TCPAddr
)
(
c
*
TCPConn
,
err
error
)
{
func
DialTCP
(
net
string
,
laddr
,
raddr
*
TCPAddr
)
(
c
*
TCPConn
,
err
error
)
{
switch
net
{
switch
net
{
case
"tcp"
,
"tcp4"
,
"tcp6"
:
case
"tcp"
,
"tcp4"
,
"tcp6"
:
...
@@ -51,9 +51,8 @@ func DialTCP(net string, laddr, raddr *TCPAddr) (c *TCPConn, err error) {
...
@@ -51,9 +51,8 @@ func DialTCP(net string, laddr, raddr *TCPAddr) (c *TCPConn, err error) {
return
&
TCPConn
{
*
c1
},
nil
return
&
TCPConn
{
*
c1
},
nil
}
}
// TCPListener is a TCP network listener.
// TCPListener is a TCP network listener. Clients should typically
// Clients should typically use variables of type Listener
// use variables of type Listener instead of assuming TCP.
// instead of assuming TCP.
type
TCPListener
struct
{
type
TCPListener
struct
{
plan9Listener
plan9Listener
}
}
...
@@ -69,10 +68,10 @@ func (l *TCPListener) Close() error {
...
@@ -69,10 +68,10 @@ func (l *TCPListener) Close() error {
return
l
.
ctl
.
Close
()
return
l
.
ctl
.
Close
()
}
}
// ListenTCP announces on the TCP address laddr and returns a TCP
listener.
// ListenTCP announces on the TCP address laddr and returns a TCP
//
Net must be "tcp", "tcp4", or "tcp6".
//
listener. Net must be "tcp", "tcp4", or "tcp6". If laddr has a
//
If laddr has a port of 0, it means to listen on some available port.
//
port of 0, it means to listen on some available port. The caller
//
The caller
can use l.Addr() to retrieve the chosen address.
// can use l.Addr() to retrieve the chosen address.
func
ListenTCP
(
net
string
,
laddr
*
TCPAddr
)
(
l
*
TCPListener
,
err
error
)
{
func
ListenTCP
(
net
string
,
laddr
*
TCPAddr
)
(
l
*
TCPListener
,
err
error
)
{
switch
net
{
switch
net
{
case
"tcp"
,
"tcp4"
,
"tcp6"
:
case
"tcp"
,
"tcp4"
,
"tcp6"
:
...
...
src/pkg/net/udpsock_plan9.go
View file @
d6665bc3
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
// UDP for Plan 9
// UDP
sockets
for Plan 9
package
net
package
net
...
@@ -24,8 +24,9 @@ type UDPConn struct {
...
@@ -24,8 +24,9 @@ type UDPConn struct {
// It returns the number of bytes copied into b and the return address
// It returns the number of bytes copied into b and the return address
// that was on the packet.
// that was on the packet.
//
//
// ReadFromUDP can be made to time out and return an error with Timeout() == true
// ReadFromUDP can be made to time out and return an error with
// after a fixed time limit; see SetDeadline and SetReadDeadline.
// Timeout() == true after a fixed time limit; see SetDeadline and
// SetReadDeadline.
func
(
c
*
UDPConn
)
ReadFromUDP
(
b
[]
byte
)
(
n
int
,
addr
*
UDPAddr
,
err
error
)
{
func
(
c
*
UDPConn
)
ReadFromUDP
(
b
[]
byte
)
(
n
int
,
addr
*
UDPAddr
,
err
error
)
{
if
!
c
.
ok
()
{
if
!
c
.
ok
()
{
return
0
,
nil
,
syscall
.
EINVAL
return
0
,
nil
,
syscall
.
EINVAL
...
@@ -59,12 +60,22 @@ func (c *UDPConn) ReadFrom(b []byte) (n int, addr Addr, err error) {
...
@@ -59,12 +60,22 @@ func (c *UDPConn) ReadFrom(b []byte) (n int, addr Addr, err error) {
return
c
.
ReadFromUDP
(
b
)
return
c
.
ReadFromUDP
(
b
)
}
}
// WriteToUDP writes a UDP packet to addr via c, copying the payload from b.
// ReadMsgUDP reads a packet from c, copying the payload into b and
// the associdated 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
*
UDPConn
)
ReadMsgUDP
(
b
,
oob
[]
byte
)
(
n
,
oobn
,
flags
int
,
addr
*
UDPAddr
,
err
error
)
{
return
0
,
0
,
0
,
nil
,
syscall
.
EPLAN9
}
// WriteToUDP writes a UDP packet to addr via c, copying the payload
// from b.
//
//
// WriteToUDP can be made to time out and return
// WriteToUDP can be made to time out and return
an error with
//
an error with Timeout() == true after a fixed time limit;
//
Timeout() == true after a fixed time limit; see SetDeadline and
//
see SetDeadline and SetWriteDeadline.
//
SetWriteDeadline. On packet-oriented connections, write timeouts
//
On packet-oriented connections, write timeouts
are rare.
// are rare.
func
(
c
*
UDPConn
)
WriteToUDP
(
b
[]
byte
,
addr
*
UDPAddr
)
(
n
int
,
err
error
)
{
func
(
c
*
UDPConn
)
WriteToUDP
(
b
[]
byte
,
addr
*
UDPAddr
)
(
n
int
,
err
error
)
{
if
!
c
.
ok
()
{
if
!
c
.
ok
()
{
return
0
,
syscall
.
EINVAL
return
0
,
syscall
.
EINVAL
...
@@ -100,9 +111,16 @@ func (c *UDPConn) WriteTo(b []byte, addr Addr) (n int, err error) {
...
@@ -100,9 +111,16 @@ func (c *UDPConn) WriteTo(b []byte, addr Addr) (n int, err error) {
return
c
.
WriteToUDP
(
b
,
a
)
return
c
.
WriteToUDP
(
b
,
a
)
}
}
// WriteMsgUDP 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
*
UDPConn
)
WriteMsgUDP
(
b
,
oob
[]
byte
,
addr
*
UDPAddr
)
(
n
,
oobn
int
,
err
error
)
{
return
0
,
0
,
syscall
.
EPLAN9
}
// DialUDP connects to the remote address raddr on the network net,
// DialUDP connects to the remote address raddr on the network net,
// which must be "udp", "udp4", or "udp6". If laddr is not nil, it is
used
// which must be "udp", "udp4", or "udp6". If laddr is not nil, it is
// as the local address for the connection.
//
used
as the local address for the connection.
func
DialUDP
(
net
string
,
laddr
,
raddr
*
UDPAddr
)
(
c
*
UDPConn
,
err
error
)
{
func
DialUDP
(
net
string
,
laddr
,
raddr
*
UDPAddr
)
(
c
*
UDPConn
,
err
error
)
{
switch
net
{
switch
net
{
case
"udp"
,
"udp4"
,
"udp6"
:
case
"udp"
,
"udp4"
,
"udp6"
:
...
@@ -147,10 +165,10 @@ func unmarshalUDPHeader(b []byte) (*udpHeader, []byte) {
...
@@ -147,10 +165,10 @@ func unmarshalUDPHeader(b []byte) (*udpHeader, []byte) {
return
h
,
b
return
h
,
b
}
}
// ListenUDP listens for incoming UDP packets addressed to the
// ListenUDP listens for incoming UDP packets addressed to the
local
//
local address laddr. The returned connection c's ReadFrom
//
address laddr. The returned connection c's ReadFrom and WriteTo
//
and WriteTo methods can be used to receive and send UDP
//
methods can be used to receive and send UDP packets with per-packet
//
packets with per-packet
addressing.
// addressing.
func
ListenUDP
(
net
string
,
laddr
*
UDPAddr
)
(
c
*
UDPConn
,
err
error
)
{
func
ListenUDP
(
net
string
,
laddr
*
UDPAddr
)
(
c
*
UDPConn
,
err
error
)
{
switch
net
{
switch
net
{
case
"udp"
,
"udp4"
,
"udp6"
:
case
"udp"
,
"udp4"
,
"udp6"
:
...
@@ -172,9 +190,9 @@ func ListenUDP(net string, laddr *UDPAddr) (c *UDPConn, err error) {
...
@@ -172,9 +190,9 @@ func ListenUDP(net string, laddr *UDPAddr) (c *UDPConn, err error) {
}
}
// ListenMulticastUDP listens for incoming multicast UDP packets
// ListenMulticastUDP listens for incoming multicast UDP packets
// addressed to the group address gaddr on ifi, which specifies
// addressed to the group address gaddr on ifi, which specifies
the
//
the interface to join. ListenMulticastUDP uses defaul
t
//
interface to join. ListenMulticastUDP uses default multicas
t
//
multicast
interface if ifi is nil.
// interface if ifi is nil.
func
ListenMulticastUDP
(
net
string
,
ifi
*
Interface
,
gaddr
*
UDPAddr
)
(
*
UDPConn
,
error
)
{
func
ListenMulticastUDP
(
net
string
,
ifi
*
Interface
,
gaddr
*
UDPAddr
)
(
*
UDPConn
,
error
)
{
return
nil
,
syscall
.
EPLAN9
return
nil
,
syscall
.
EPLAN9
}
}
src/pkg/net/unixsock_plan9.go
View file @
d6665bc3
...
@@ -7,40 +7,33 @@
...
@@ -7,40 +7,33 @@
package
net
package
net
import
(
import
(
"os"
"syscall"
"syscall"
"time"
"time"
)
)
// UnixConn is an implementation of the Conn interface
// UnixConn is an implementation of the Conn interface
for connections
//
for connections
to Unix domain sockets.
// to Unix domain sockets.
type
UnixConn
bool
type
UnixConn
bool
// Implementation of the Conn interface - see Conn for documentation.
// Implementation of the Conn interface - see Conn for documentation.
// Read implements the Conn Read method.
// Read implements the Conn Read method.
func
(
c
*
UnixConn
)
Read
(
b
[]
byte
)
(
n
int
,
err
error
)
{
func
(
c
*
UnixConn
)
Read
(
b
[]
byte
)
(
int
,
error
)
{
return
0
,
syscall
.
EPLAN9
return
0
,
syscall
.
EPLAN9
}
}
// Write implements the Conn Write method.
// Write implements the Conn Write method.
func
(
c
*
UnixConn
)
Write
(
b
[]
byte
)
(
n
int
,
err
error
)
{
func
(
c
*
UnixConn
)
Write
(
b
[]
byte
)
(
int
,
error
)
{
return
0
,
syscall
.
EPLAN9
return
0
,
syscall
.
EPLAN9
}
}
// Close closes the Unix domain connection.
// LocalAddr returns the local network address.
func
(
c
*
UnixConn
)
Close
()
error
{
return
syscall
.
EPLAN9
}
// LocalAddr returns the local network address, a *UnixAddr.
// Unlike in other protocols, LocalAddr is usually nil for dialed connections.
func
(
c
*
UnixConn
)
LocalAddr
()
Addr
{
func
(
c
*
UnixConn
)
LocalAddr
()
Addr
{
return
nil
return
nil
}
}
// RemoteAddr returns the remote network address, a *UnixAddr.
// RemoteAddr returns the remote network address.
// Unlike in other protocols, RemoteAddr is usually nil for connections
// accepted by a listener.
func
(
c
*
UnixConn
)
RemoteAddr
()
Addr
{
func
(
c
*
UnixConn
)
RemoteAddr
()
Addr
{
return
nil
return
nil
}
}
...
@@ -60,59 +53,144 @@ func (c *UnixConn) SetWriteDeadline(t time.Time) error {
...
@@ -60,59 +53,144 @@ func (c *UnixConn) SetWriteDeadline(t time.Time) error {
return
syscall
.
EPLAN9
return
syscall
.
EPLAN9
}
}
// SetReadBuffer sets the size of the operating system's receive
// buffer associated with the connection.
func
(
c
*
UnixConn
)
SetReadBuffer
(
bytes
int
)
error
{
return
syscall
.
EPLAN9
}
// SetWriteBuffer sets the size of the operating system's transmit
// buffer associated with the connection.
func
(
c
*
UnixConn
)
SetWriteBuffer
(
bytes
int
)
error
{
return
syscall
.
EPLAN9
}
// File returns a copy of the underlying os.File, set to blocking
// mode. It is the caller's responsibility to close f when finished.
// Closing c does not affect f, and closing f does not affect c.
func
(
c
*
UnixConn
)
File
()
(
f
*
os
.
File
,
err
error
)
{
return
nil
,
syscall
.
EPLAN9
}
// Close closes the Unix domain connection.
func
(
c
*
UnixConn
)
Close
()
error
{
return
syscall
.
EPLAN9
}
// ReadFromUnix reads a packet from c, copying the payload into b. 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; see SetDeadline and
// SetReadDeadline.
func
(
c
*
UnixConn
)
ReadFromUnix
(
b
[]
byte
)
(
int
,
*
UnixAddr
,
error
)
{
return
0
,
nil
,
syscall
.
EPLAN9
}
// ReadFrom implements the PacketConn ReadFrom method.
// ReadFrom implements the PacketConn ReadFrom method.
func
(
c
*
UnixConn
)
ReadFrom
(
b
[]
byte
)
(
n
int
,
addr
Addr
,
err
error
)
{
func
(
c
*
UnixConn
)
ReadFrom
(
b
[]
byte
)
(
int
,
Addr
,
error
)
{
err
=
syscall
.
EPLAN9
return
0
,
nil
,
syscall
.
EPLAN9
return
}
// 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
)
{
return
0
,
0
,
0
,
nil
,
syscall
.
EPLAN9
}
// WriteToUnix writes a packet to addr via c, copying the payload from b.
//
// WriteToUnix can be made to time out and return an error with
// Timeout() == true after a fixed time limit; see SetDeadline and
// SetWriteDeadline. On packet-oriented connections, write timeouts
// are rare.
func
(
c
*
UnixConn
)
WriteToUnix
(
b
[]
byte
,
addr
*
UnixAddr
)
(
int
,
error
)
{
return
0
,
syscall
.
EPLAN9
}
}
// WriteTo implements the PacketConn WriteTo method.
// WriteTo implements the PacketConn WriteTo method.
func
(
c
*
UnixConn
)
WriteTo
(
b
[]
byte
,
addr
Addr
)
(
n
int
,
err
error
)
{
func
(
c
*
UnixConn
)
WriteTo
(
b
[]
byte
,
addr
Addr
)
(
int
,
error
)
{
err
=
syscall
.
EPLAN9
return
0
,
syscall
.
EPLAN9
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
)
{
return
0
,
0
,
syscall
.
EPLAN9
}
}
// CloseRead shuts down the reading side of the Unix domain
connection.
// CloseRead shuts down the reading side of the Unix domain
// Most callers should just use Close.
//
connection.
Most callers should just use Close.
func
(
c
*
UnixConn
)
CloseRead
()
error
{
func
(
c
*
UnixConn
)
CloseRead
()
error
{
return
syscall
.
EPLAN9
return
syscall
.
EPLAN9
}
}
// CloseWrite shuts down the writing side of the Unix domain
connection.
// CloseWrite shuts down the writing side of the Unix domain
// Most callers should just use Close.
//
connection.
Most callers should just use Close.
func
(
c
*
UnixConn
)
CloseWrite
()
error
{
func
(
c
*
UnixConn
)
CloseWrite
()
error
{
return
syscall
.
EPLAN9
return
syscall
.
EPLAN9
}
}
// DialUnix connects to the remote address raddr on the network net,
// DialUnix connects to the remote address raddr on the network net,
// which must be "unix" or "unixgram". If laddr is not nil, it is
used
// which must be "unix" or "unixgram". If laddr is not nil, it is
// as the local address for the connection.
//
used
as the local address for the connection.
func
DialUnix
(
net
string
,
laddr
,
raddr
*
UnixAddr
)
(
c
*
UnixConn
,
err
error
)
{
func
DialUnix
(
net
string
,
laddr
,
raddr
*
UnixAddr
)
(
*
UnixConn
,
error
)
{
return
nil
,
syscall
.
EPLAN9
return
nil
,
syscall
.
EPLAN9
}
}
// UnixListener is a Unix domain socket listener.
// UnixListener is a Unix domain socket listener.
Clients should
//
Clients should typically use variables of type Listener
//
typically use variables of type Listener instead of assuming Unix
//
instead of assuming Unix
domain sockets.
// domain sockets.
type
UnixListener
bool
type
UnixListener
bool
// ListenUnix announces on the Unix domain socket laddr and returns a Unix listener.
// ListenUnix announces on the Unix domain socket laddr and returns a
// Net must be "unix" (stream sockets).
// Unix listener. Net must be "unix" (stream sockets).
func
ListenUnix
(
net
string
,
laddr
*
UnixAddr
)
(
l
*
UnixListener
,
err
error
)
{
func
ListenUnix
(
net
string
,
laddr
*
UnixAddr
)
(
*
UnixListener
,
error
)
{
return
nil
,
syscall
.
EPLAN9
}
// AcceptUnix accepts the next incoming call and returns the new
// connection and the remote address.
func
(
l
*
UnixListener
)
AcceptUnix
()
(
*
UnixConn
,
error
)
{
return
nil
,
syscall
.
EPLAN9
return
nil
,
syscall
.
EPLAN9
}
}
// Accept implements the Accept method in the Listener interface;
// Accept implements the Accept method in the Listener interface;
it
//
it
waits for the next call and returns a generic Conn.
// waits for the next call and returns a generic Conn.
func
(
l
*
UnixListener
)
Accept
()
(
c
Conn
,
err
error
)
{
func
(
l
*
UnixListener
)
Accept
()
(
Conn
,
error
)
{
return
nil
,
syscall
.
EPLAN9
return
nil
,
syscall
.
EPLAN9
}
}
// Close stops listening on the Unix address.
// Close stops listening on the Unix address.
Already accepted
//
Already accepted
connections are not closed.
// connections are not closed.
func
(
l
*
UnixListener
)
Close
()
error
{
func
(
l
*
UnixListener
)
Close
()
error
{
return
syscall
.
EPLAN9
return
syscall
.
EPLAN9
}
}
// Addr returns the listener's network address.
// Addr returns the listener's network address.
func
(
l
*
UnixListener
)
Addr
()
Addr
{
return
nil
}
func
(
l
*
UnixListener
)
Addr
()
Addr
{
return
nil
}
// SetDeadline sets the deadline associated with the listener.
// A zero time value disables the deadline.
func
(
l
*
UnixListener
)
SetDeadline
(
t
time
.
Time
)
error
{
return
syscall
.
EPLAN9
}
// File returns a copy of the underlying os.File, set to blocking
// mode. It is the caller's responsibility to close f when finished.
// Closing l does not affect f, and closing f does not affect l.
func
(
l
*
UnixListener
)
File
()
(
*
os
.
File
,
error
)
{
return
nil
,
syscall
.
EPLAN9
}
// ListenUnixgram listens for incoming Unix datagram packets addressed
// to the local address laddr. The returned connection c's ReadFrom
// and WriteTo methods can be used to receive and send UDP packets
// with per-packet addressing. The network net must be "unixgram".
func
ListenUnixgram
(
net
string
,
laddr
*
UnixAddr
)
(
*
UDPConn
,
error
)
{
return
nil
,
syscall
.
EPLAN9
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment