github.com/Andyfoo/golang/x/net@v0.0.0-20190901054642-57c1bf301704/internal/socket/msghdr_solaris_64bit.go (about)

     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  	if len(vs) > 0 {
    17  		h.Iov = &vs[0]
    18  		h.Iovlen = int32(len(vs))
    19  	}
    20  	if len(oob) > 0 {
    21  		h.Accrights = (*int8)(unsafe.Pointer(&oob[0]))
    22  		h.Accrightslen = int32(len(oob))
    23  	}
    24  	if sa != nil {
    25  		h.Name = (*byte)(unsafe.Pointer(&sa[0]))
    26  		h.Namelen = uint32(len(sa))
    27  	}
    28  }
    29  
    30  func (h *msghdr) controllen() int {
    31  	return int(h.Accrightslen)
    32  }
    33  
    34  func (h *msghdr) flags() int {
    35  	return int(NativeEndian.Uint32(h.Pad_cgo_2[:]))
    36  }