From ced8e5e7ba0d19af5e99124f2f11bb487b8f2550 Mon Sep 17 00:00:00 2001 From: Christy Perez Date: Thu, 17 Dec 2015 10:46:38 -0600 Subject: [PATCH] Caclulate NLA_HDRLEN as gccgo workaround syscall.NLA_HDRLEN is not in gccgo (as of 5.3), so in the meantime use the #defines taken from linux/netlink.h. See https://github.com/golang/go/issues/13629 Signed-off-by: Christy Perez --- libcontainer/message_linux.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libcontainer/message_linux.go b/libcontainer/message_linux.go index 0e95e3b0..0c3301f2 100644 --- a/libcontainer/message_linux.go +++ b/libcontainer/message_linux.go @@ -14,6 +14,8 @@ const ( InitMsg uint16 = 62000 PidAttr uint16 = 27281 ConsolePathAttr uint16 = 27282 + // When syscall.NLA_HDRLEN is in gccgo, take this out. + syscall_NLA_HDRLEN = (syscall.SizeofNlAttr + syscall.NLA_ALIGNTO - 1) & ^(syscall.NLA_ALIGNTO - 1) ) type Int32msg struct { @@ -34,7 +36,7 @@ func (msg *Int32msg) Serialize() []byte { } func (msg *Int32msg) Len() int { - return syscall.NLA_HDRLEN + 4 + return syscall_NLA_HDRLEN + 4 } // bytemsg has the following representation @@ -56,5 +58,5 @@ func (msg *Bytemsg) Serialize() []byte { } func (msg *Bytemsg) Len() int { - return syscall.NLA_HDRLEN + len(msg.Value) + 1 // null-terminated + return syscall_NLA_HDRLEN + len(msg.Value) + 1 // null-terminated }