OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [net/] [unixsock.go] - Blame information for rev 848

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2009 The Go Authors.  All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
 
5
// Unix domain sockets
6
 
7
package net
8
 
9
// UnixAddr represents the address of a Unix domain socket end point.
10
type UnixAddr struct {
11
        Name string
12
        Net  string
13
}
14
 
15
// Network returns the address's network name, "unix" or "unixgram".
16
func (a *UnixAddr) Network() string {
17
        return a.Net
18
}
19
 
20
func (a *UnixAddr) String() string {
21
        if a == nil {
22
                return ""
23
        }
24
        return a.Name
25
}
26
 
27
func (a *UnixAddr) toAddr() Addr {
28
        if a == nil { // nil *UnixAddr
29
                return nil // nil interface
30
        }
31
        return a
32
}
33
 
34
// ResolveUnixAddr parses addr as a Unix domain socket address.
35
// The string net gives the network name, "unix", "unixgram" or
36
// "unixpacket".
37
func ResolveUnixAddr(net, addr string) (*UnixAddr, error) {
38
        switch net {
39
        case "unix":
40
        case "unixpacket":
41
        case "unixgram":
42
        default:
43
                return nil, UnknownNetworkError(net)
44
        }
45
        return &UnixAddr{addr, net}, nil
46
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.