* cp-tree.h (build_noexcept_spec, add_exception_specifier): Adjust
[official-gcc.git] / libgo / go / syscall / socket_aix.go
blob40cf42365e2c819f88997bc66e8eeb937801f2db
1 // socket_aix.go -- Socket handling specific to AIX.
3 // Copyright 2017 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 package syscall
9 import "unsafe"
11 const SizeofSockaddrInet4 = 16
12 const SizeofSockaddrInet6 = 28
13 const SizeofSockaddrUnix = 1025
15 type RawSockaddrInet4 struct {
16 Len uint8
17 Family uint8
18 Port uint16
19 Addr [4]byte /* in_addr */
20 Zero [8]uint8
23 func (sa *RawSockaddrInet4) setLen() Socklen_t {
24 sa.Len = SizeofSockaddrInet4
25 return SizeofSockaddrInet4
28 type RawSockaddrInet6 struct {
29 Len uint8
30 Family uint8
31 Port uint16
32 Flowinfo uint32
33 Addr [16]byte /* in6_addr */
34 Scope_id uint32
37 func (sa *RawSockaddrInet6) setLen() Socklen_t {
38 sa.Len = SizeofSockaddrInet6
39 return SizeofSockaddrInet6
42 type RawSockaddrUnix struct {
43 Len uint8
44 Family uint8
45 Path [1023]int8
48 func (sa *RawSockaddrUnix) setLen(n int) {
49 sa.Len = uint8(3 + n) // 2 for Family, Len; 1 for NUL.
52 func (sa *RawSockaddrUnix) getLen() (int, error) {
53 // Some versions of AIX have a bug in getsockname (see IV78655).
54 // We can't rely on sa.Len being set correctly.
55 n := SizeofSockaddrUnix - 3 // substract leading Family, Len, terminating NUL.
56 for i := 0; i < n; i++ {
57 if sa.Path[i] == 0 {
58 n = i
59 break
62 return n, nil
65 func (sa *RawSockaddrUnix) adjustAbstract(sl Socklen_t) Socklen_t {
66 return sl
69 type RawSockaddr struct {
70 Len uint8
71 Family uint8
72 Data [14]int8
75 // BindToDevice binds the socket associated with fd to device.
76 func BindToDevice(fd int, device string) (err error) {
77 return ENOSYS
80 func anyToSockaddrOS(rsa *RawSockaddrAny) (Sockaddr, error) {
81 return nil, EAFNOSUPPORT
84 func GetsockoptIPv6MTUInfo(fd, level, opt int) (*IPv6MTUInfo, error) {
85 var value IPv6MTUInfo
86 vallen := Socklen_t(SizeofIPv6MTUInfo)
87 err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
88 return &value, err