blob: d1b059397300cbf96990107f74b496bad40215a3 [file] [log] [blame]
David K. Bainbridge215e0242017-09-05 23:18:24 -07001// 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
8package socket
9
10import "unsafe"
11
12func (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
28func (h *msghdr) controllen() int {
29 return int(h.Accrightslen)
30}
31
32func (h *msghdr) flags() int {
33 return int(NativeEndian.Uint32(h.Pad_cgo_2[:]))
34}