msghdr_solaris_64bit.go 736 B

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