summaryrefslogtreecommitdiffhomepage
path: root/pkg/abi/linux/socket.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-08-08 23:59:42 +0000
committergVisor bot <gvisor-bot@google.com>2019-08-08 23:59:42 +0000
commit3ccc00f471cdedafdf65eaa9bf749a2b2ab298cb (patch)
treef6ee8c14c5cde4ea6df8359eda7373ab26a53aa8 /pkg/abi/linux/socket.go
parent3e8a2e033f3e1245d027592aa490d38fbf86f20b (diff)
parent7bfad8ebb6ce71c0fe90a1e4f5897f62809fa58b (diff)
Merge 7bfad8eb (automated)
Diffstat (limited to 'pkg/abi/linux/socket.go')
-rw-r--r--pkg/abi/linux/socket.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/abi/linux/socket.go b/pkg/abi/linux/socket.go
index 6d22002c4..e53165622 100644
--- a/pkg/abi/linux/socket.go
+++ b/pkg/abi/linux/socket.go
@@ -267,6 +267,20 @@ type SockAddrUnix struct {
Path [UnixPathMax]int8
}
+// SockAddr represents a union of valid socket address types. This is logically
+// equivalent to struct sockaddr. SockAddr ensures that a well-defined set of
+// types can be used as socket addresses.
+type SockAddr interface {
+ // implementsSockAddr exists purely to allow a type to indicate that they
+ // implement this interface. This method is a no-op and shouldn't be called.
+ implementsSockAddr()
+}
+
+func (s *SockAddrInet) implementsSockAddr() {}
+func (s *SockAddrInet6) implementsSockAddr() {}
+func (s *SockAddrUnix) implementsSockAddr() {}
+func (s *SockAddrNetlink) implementsSockAddr() {}
+
// Linger is struct linger, from include/linux/socket.h.
type Linger struct {
OnOff int32