msghdr_solaris_64bit.go 759 B

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