From d844d6982ebd3ea2a1a146d753581018f977c6ec Mon Sep 17 00:00:00 2001 From: Mikio Hara Date: Sun, 27 Apr 2014 22:28:41 +0900 Subject: [PATCH] syscall: fix handling socket control messages on dragonfly LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/91860043 --- src/pkg/syscall/sockcmsg_unix.go | 6 +++--- src/pkg/syscall/syscall_unix.go | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pkg/syscall/sockcmsg_unix.go b/src/pkg/syscall/sockcmsg_unix.go index 2cdc28ee35..045a012c05 100644 --- a/src/pkg/syscall/sockcmsg_unix.go +++ b/src/pkg/syscall/sockcmsg_unix.go @@ -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) diff --git a/src/pkg/syscall/syscall_unix.go b/src/pkg/syscall/syscall_unix.go index de5ff95cf1..b28891568d 100644 --- a/src/pkg/syscall/syscall_unix.go +++ b/src/pkg/syscall/syscall_unix.go @@ -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) -- 2.50.0