Skip to content

Commit 766e4c5

Browse files
committed
Merge pull request opencontainers#437 from clnperez/nlahdrlen-fix-for-gccgo
Add NLA_HDRLEN workaround for gccgo
2 parents 9d6ce71 + ced8e5e commit 766e4c5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libcontainer/message_linux.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const (
1414
InitMsg uint16 = 62000
1515
PidAttr uint16 = 27281
1616
ConsolePathAttr uint16 = 27282
17+
// When syscall.NLA_HDRLEN is in gccgo, take this out.
18+
syscall_NLA_HDRLEN = (syscall.SizeofNlAttr + syscall.NLA_ALIGNTO - 1) & ^(syscall.NLA_ALIGNTO - 1)
1719
)
1820

1921
type Int32msg struct {
@@ -34,7 +36,7 @@ func (msg *Int32msg) Serialize() []byte {
3436
}
3537

3638
func (msg *Int32msg) Len() int {
37-
return syscall.NLA_HDRLEN + 4
39+
return syscall_NLA_HDRLEN + 4
3840
}
3941

4042
// bytemsg has the following representation
@@ -56,5 +58,5 @@ func (msg *Bytemsg) Serialize() []byte {
5658
}
5759

5860
func (msg *Bytemsg) Len() int {
59-
return syscall.NLA_HDRLEN + len(msg.Value) + 1 // null-terminated
61+
return syscall_NLA_HDRLEN + len(msg.Value) + 1 // null-terminated
6062
}

0 commit comments

Comments
 (0)