]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: fix handling socket control messages on dragonfly
authorMikio Hara <mikioh.mikioh@gmail.com>
Sun, 27 Apr 2014 13:28:41 +0000 (22:28 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Sun, 27 Apr 2014 13:28:41 +0000 (22:28 +0900)
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/91860043

src/pkg/syscall/sockcmsg_unix.go
src/pkg/syscall/syscall_unix.go

index 2cdc28ee3576b09ad856ffa69ba5ac210cea06f8..045a012c05bd3a0a65636a4891d6cf7e17c07e02 100644 (file)
@@ -13,9 +13,9 @@ import "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 kernel still requires 32-bit
-       // aligned access to BSD subsystem.
-       if darwin64Bit {
+       // NOTE: It seems like 64-bit Darwin and DragonFly BSD kernels
+       // still require 32-bit aligned access to network subsystem.
+       if darwin64Bit || dragonfly64Bit {
                salign = 4
        }
        return (salen + salign - 1) & ^(salign - 1)
index de5ff95cf1822d5c8fe6f793e6eddaa30af13138..b28891568d892c9a2f6efea6e303fee087db6d43 100644 (file)
@@ -19,8 +19,9 @@ var (
 )
 
 const (
-       darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8
-       netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4
+       darwin64Bit    = runtime.GOOS == "darwin" && sizeofPtr == 8
+       dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8
+       netbsd32Bit    = runtime.GOOS == "netbsd" && sizeofPtr == 4
 )
 
 func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)