1 // Copyright 2019 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.
5 // +build aix darwin freebsd linux netbsd openbsd solaris
13 // Round the length of a raw sockaddr up to align it properly.
14 func cmsgAlignOf(salen int) int {
17 // dragonfly needs to check ABI version at runtime, see cmsgAlignOf in
18 // sockcmsg_dragonfly.go
21 // There is no alignment on AIX.
23 case "darwin", "ios", "illumos", "solaris":
24 // NOTE: It seems like 64-bit Darwin, Illumos and Solaris
25 // kernels still require 32-bit aligned access to network
30 case "netbsd", "openbsd":
31 // NetBSD and OpenBSD armv7 require 64-bit alignment.
32 if runtime.GOARCH == "arm" {
35 // NetBSD aarch64 requires 128-bit alignment.
36 if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" {
41 return (salen + salign - 1) & ^(salign - 1)