blob: 42411affad9e49d8a25e60337e5f6cfc33cdbb29 [file] [log] [blame]
Mikio Harab8b13432017-03-16 05:58:54 +09001// 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
Guoqi Chend55c2552021-10-13 09:29:24 +08005//go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
6// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x
Mikio Harab8b13432017-03-16 05:58:54 +09007// +build linux
8
9package socket
10
11import "unsafe"
12
13func (h *msghdr) setIov(vs []iovec) {
Mikio Hara4f8c76a2017-10-03 12:23:07 +090014 l := len(vs)
15 if l == 0 {
16 return
17 }
Mikio Harab8b13432017-03-16 05:58:54 +090018 h.Iov = &vs[0]
Mikio Hara4f8c76a2017-10-03 12:23:07 +090019 h.Iovlen = uint64(l)
Mikio Harab8b13432017-03-16 05:58:54 +090020}
21
22func (h *msghdr) setControl(b []byte) {
23 h.Control = (*byte)(unsafe.Pointer(&b[0]))
24 h.Controllen = uint64(len(b))
25}