Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
f735ce31
Commit
f735ce31
authored
Jul 24, 2013
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: Only use GNU/Linux unix socket abstract paths on GNU/Linux.
From-SVN: r201217
parent
821f6f1b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
47 deletions
+49
-47
libgo/go/syscall/socket.go
+1
-5
libgo/go/syscall/socket_bsd.go
+21
-17
libgo/go/syscall/socket_irix.go
+4
-0
libgo/go/syscall/socket_linux.go
+9
-0
libgo/go/syscall/socket_solaris.go
+14
-25
No files found.
libgo/go/syscall/socket.go
View file @
f735ce31
...
...
@@ -92,11 +92,7 @@ func (sa *SockaddrUnix) sockaddr() (*RawSockaddrAny, Socklen_t, error) {
if
n
>
0
{
sl
+=
Socklen_t
(
n
)
+
1
}
if
sa
.
raw
.
Path
[
0
]
==
'@'
{
sa
.
raw
.
Path
[
0
]
=
0
// Don't count trailing NUL for abstract address.
sl
--
}
sl
=
sa
.
raw
.
adjustAbstract
(
sl
)
// length is family (uint16), name, NUL.
return
(
*
RawSockaddrAny
)(
unsafe
.
Pointer
(
&
sa
.
raw
)),
sl
,
nil
...
...
libgo/go/syscall/socket_bsd.go
View file @
f735ce31
...
...
@@ -11,11 +11,11 @@ const SizeofSockaddrInet6 = 28
const
SizeofSockaddrUnix
=
110
type
RawSockaddrInet4
struct
{
Len
uint8
;
Family
uint8
;
Port
uint16
;
Addr
[
4
]
byte
/* in_addr */
;
Zero
[
8
]
uint8
;
Len
uint8
Family
uint8
Port
uint16
Addr
[
4
]
byte
/* in_addr */
Zero
[
8
]
uint8
}
func
(
sa
*
RawSockaddrInet4
)
setLen
()
Socklen_t
{
...
...
@@ -24,12 +24,12 @@ func (sa *RawSockaddrInet4) setLen() Socklen_t {
}
type
RawSockaddrInet6
struct
{
Len
uint8
;
Family
uint8
;
Port
uint16
;
Flowinfo
uint32
;
Addr
[
16
]
byte
/* in6_addr */
;
Scope_id
uint32
;
Len
uint8
Family
uint8
Port
uint16
Flowinfo
uint32
Addr
[
16
]
byte
/* in6_addr */
Scope_id
uint32
}
func
(
sa
*
RawSockaddrInet6
)
setLen
()
Socklen_t
{
...
...
@@ -38,9 +38,9 @@ func (sa *RawSockaddrInet6) setLen() Socklen_t {
}
type
RawSockaddrUnix
struct
{
Len
uint8
;
Family
uint8
;
Path
[
108
]
int8
;
Len
uint8
Family
uint8
Path
[
108
]
int8
}
func
(
sa
*
RawSockaddrUnix
)
setLen
(
n
int
)
{
...
...
@@ -62,10 +62,14 @@ func (sa *RawSockaddrUnix) getLen() (int, error) {
return
n
,
nil
}
func
(
sa
*
RawSockaddrUnix
)
adjustAbstract
(
sl
Socklen_t
)
Socklen_t
{
return
sl
}
type
RawSockaddr
struct
{
Len
uint8
;
Family
uint8
;
Data
[
14
]
int8
;
Len
uint8
Family
uint8
Data
[
14
]
int8
}
// BindToDevice binds the socket associated with fd to device.
...
...
libgo/go/syscall/socket_irix.go
View file @
f735ce31
...
...
@@ -64,6 +64,10 @@ func (sa *RawSockaddrUnix) getLen() (int, error) {
return
n
,
nil
}
func
(
sa
*
RawSockaddrUnix
)
adjustAbstract
(
sl
Socklen_t
)
Socklen_t
{
return
sl
}
type
RawSockaddr
struct
{
Family
uint16
Data
[
14
]
int8
...
...
libgo/go/syscall/socket_linux.go
View file @
f735ce31
...
...
@@ -110,6 +110,15 @@ func (sa *RawSockaddrUnix) getLen() (int, error) {
return
n
,
nil
}
func
(
sa
*
RawSockaddrUnix
)
adjustAbstract
(
sl
Socklen_t
)
Socklen_t
{
if
sa
.
Path
[
0
]
==
'@'
{
sa
.
Path
[
0
]
=
0
// Don't count trailing NUL for abstract address.
sl
--
}
return
sl
}
type
RawSockaddrLinklayer
struct
{
Family
uint16
Protocol
uint16
...
...
libgo/go/syscall/socket_solaris.go
View file @
f735ce31
...
...
@@ -12,9 +12,9 @@ const SizeofSockaddrUnix = 110
type
RawSockaddrInet4
struct
{
Family
uint16
Port
uint16
Addr
[
4
]
byte
/* in_addr */
Zero
[
8
]
uint8
Port
uint16
Addr
[
4
]
byte
/* in_addr */
Zero
[
8
]
uint8
}
func
(
sa
*
RawSockaddrInet4
)
setLen
()
Socklen_t
{
...
...
@@ -22,12 +22,12 @@ func (sa *RawSockaddrInet4) setLen() Socklen_t {
}
type
RawSockaddrInet6
struct
{
Family
uint16
Port
uint16
Family
uint16
Port
uint16
Flowinfo
uint32
Addr
[
16
]
byte
/* in6_addr */
Addr
[
16
]
byte
/* in6_addr */
Scope_id
uint32
Src_id
uint32
Src_id
uint32
}
func
(
sa
*
RawSockaddrInet6
)
setLen
()
Socklen_t
{
...
...
@@ -36,38 +36,27 @@ func (sa *RawSockaddrInet6) setLen() Socklen_t {
type
RawSockaddrUnix
struct
{
Family
uint16
Path
[
108
]
int8
Path
[
108
]
int8
}
func
(
sa
*
RawSockaddrUnix
)
setLen
(
int
)
{
}
func
(
sa
*
RawSockaddrUnix
)
getLen
()
(
int
,
error
)
{
if
sa
.
Path
[
0
]
==
0
{
// "Abstract" Unix domain socket.
// Rewrite leading NUL as @ for textual display.
// (This is the standard convention.)
// Not friendly to overwrite in place,
// but the callers below don't care.
sa
.
Path
[
0
]
=
'@'
}
// Assume path ends at NUL.
// This is not technically the GNU/Linux semantics for
// abstract Unix domain sockets--they are supposed
// to be uninterpreted fixed-size binary blobs--but
// everyone uses this convention.
n
:=
0
for
n
<
len
(
sa
.
Path
)
-
3
&&
sa
.
Path
[
n
]
!=
0
{
for
n
<
len
(
sa
.
Path
)
&&
sa
.
Path
[
n
]
!=
0
{
n
++
}
return
n
,
nil
}
func
(
sa
*
RawSockaddrUnix
)
adjustAbstract
(
sl
Socklen_t
)
Socklen_t
{
return
sl
}
type
RawSockaddr
struct
{
Family
uint16
Data
[
14
]
int8
Data
[
14
]
int8
}
// BindToDevice binds the socket associated with fd to device.
...
...
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