David K. Bainbridge | 215e024 | 2017-09-05 23:18:24 -0700 | [diff] [blame] | 1 | // Copyright 2017 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 | // +build amd64 |
| 6 | // +build solaris |
| 7 | |
| 8 | package socket |
| 9 | |
| 10 | import "unsafe" |
| 11 | |
| 12 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { |
| 13 | for i := range vs { |
| 14 | vs[i].set(bs[i]) |
| 15 | } |
| 16 | h.Iov = &vs[0] |
| 17 | h.Iovlen = int32(len(vs)) |
| 18 | if len(oob) > 0 { |
| 19 | h.Accrights = (*int8)(unsafe.Pointer(&oob[0])) |
| 20 | h.Accrightslen = int32(len(oob)) |
| 21 | } |
| 22 | if sa != nil { |
| 23 | h.Name = (*byte)(unsafe.Pointer(&sa[0])) |
| 24 | h.Namelen = uint32(len(sa)) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | func (h *msghdr) controllen() int { |
| 29 | return int(h.Accrightslen) |
| 30 | } |
| 31 | |
| 32 | func (h *msghdr) flags() int { |
| 33 | return int(NativeEndian.Uint32(h.Pad_cgo_2[:])) |
| 34 | } |