]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/golang.org/x/sys/unix/sockcmsg_unix.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / golang.org / x / sys / unix / sockcmsg_unix.go
index 9dd2f32f50175b9d849bdcf07013960d9d9d5140..062bcabab1b0edaa65c9a099ff15bf023e79558f 100644 (file)
@@ -8,17 +8,33 @@
 
 package unix
 
-import "unsafe"
+import (
+       "runtime"
+       "unsafe"
+)
 
 // Round the length of a raw sockaddr up to align it properly.
 func cmsgAlignOf(salen int) int {
        salign := SizeofPtr
-       // NOTE: It seems like 64-bit Darwin, DragonFly BSD and
-       // Solaris kernels still require 32-bit aligned access to
-       // network subsystem.
-       if darwin64Bit || dragonfly64Bit || solaris64Bit {
-               salign = 4
+
+       switch runtime.GOOS {
+       case "aix":
+               // There is no alignment on AIX.
+               salign = 1
+       case "darwin", "dragonfly", "solaris", "illumos":
+               // NOTE: It seems like 64-bit Darwin, DragonFly BSD,
+               // illumos, and Solaris kernels still require 32-bit
+               // aligned access to network subsystem.
+               if SizeofPtr == 8 {
+                       salign = 4
+               }
+       case "netbsd", "openbsd":
+               // NetBSD and OpenBSD armv7 require 64-bit alignment.
+               if runtime.GOARCH == "arm" {
+                       salign = 8
+               }
        }
+
        return (salen + salign - 1) & ^(salign - 1)
 }