unix: add AF_IUCV and SockaddrIUCV

On z series machines the IUCV address family is used to communicate
between parts of the machine and other VMs that may be running.

This adds support for addressing these services using AF_IUCV.

Fixes golang/go#40826

Change-Id: I3aba3beb5cb98d9c548d7abc874ca86fb25c8a52
GitHub-Last-Rev: b964d186b45dd907f4ae302ea9b1ff63e3592eb6
GitHub-Pull-Request: golang/sys#76
Reviewed-on: https://go-review.googlesource.com/c/sys/+/248777
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
Christian Svensson
2020-08-17 08:59:35 +00:00
committed by Tobias Klauser
parent 3d37ad5750
commit 3ff754bf58
4 changed files with 87 additions and 0 deletions
+21
View File
@@ -156,6 +156,18 @@ func Test_anyToSockaddr(t *testing.T) {
Name: "gopher",
},
},
{
name: "AF_IUCV",
rsa: sockaddrIUCVToAny(RawSockaddrIUCV{
Family: AF_IUCV,
User_id: [8]int8{'*', 'M', 'S', 'G', ' ', ' ', ' ', ' '},
Name: [8]int8{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
}),
sa: &SockaddrIUCV{
UserID: "*MSG ",
Name: " ",
},
},
{
name: "AF_MAX EAFNOSUPPORT",
rsa: &RawSockaddrAny{
@@ -505,3 +517,12 @@ func sockaddrUnixToAny(in RawSockaddrUnix) *RawSockaddrAny {
return &out
}
func sockaddrIUCVToAny(in RawSockaddrIUCV) *RawSockaddrAny {
var out RawSockaddrAny
copy(
(*(*[SizeofSockaddrAny]byte)(unsafe.Pointer(&out)))[:],
(*(*[SizeofSockaddrUnix]byte)(unsafe.Pointer(&in)))[:],
)
return &out
}