github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/net/internal/socket/msghdr_zos_s390x.go (about)

     1  // Copyright 2020 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  //go:build s390x && zos
     6  // +build s390x,zos
     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.Control = (*byte)(unsafe.Pointer(&oob[0]))
    22  		h.Controllen = uint32(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.Controllen)
    32  }
    33  
    34  func (h *msghdr) flags() int {
    35  	return int(h.Flags)
    36  }