Skip to content

Commit 3723495

Browse files
committed
merge branch 'pr-1474'
LGTMs: @cyphar @crosbymichael Closes opencontainers#1474
2 parents 18f336d + 306b498 commit 3723495

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

libcontainer/message_linux.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
package libcontainer
44

55
import (
6-
"syscall"
7-
86
"github.com/vishvananda/netlink/nl"
7+
"golang.org/x/sys/unix"
98
)
109

1110
// list of known message types we want to send to bootstrap program
@@ -19,9 +18,6 @@ const (
1918
SetgroupAttr uint16 = 27285
2019
OomScoreAdjAttr uint16 = 27286
2120
RootlessAttr uint16 = 27287
22-
23-
// When syscall.NLA_HDRLEN is in gccgo, take this out.
24-
syscall_NLA_HDRLEN = (syscall.SizeofNlAttr + syscall.NLA_ALIGNTO - 1) & ^(syscall.NLA_ALIGNTO - 1)
2521
)
2622

2723
type Int32msg struct {
@@ -43,7 +39,7 @@ func (msg *Int32msg) Serialize() []byte {
4339
}
4440

4541
func (msg *Int32msg) Len() int {
46-
return syscall_NLA_HDRLEN + 4
42+
return unix.NLA_HDRLEN + 4
4743
}
4844

4945
// Bytemsg has the following representation
@@ -56,7 +52,7 @@ type Bytemsg struct {
5652

5753
func (msg *Bytemsg) Serialize() []byte {
5854
l := msg.Len()
59-
buf := make([]byte, (l+syscall.NLA_ALIGNTO-1) & ^(syscall.NLA_ALIGNTO-1))
55+
buf := make([]byte, (l+unix.NLA_ALIGNTO-1) & ^(unix.NLA_ALIGNTO-1))
6056
native := nl.NativeEndian()
6157
native.PutUint16(buf[0:2], uint16(l))
6258
native.PutUint16(buf[2:4], msg.Type)
@@ -65,7 +61,7 @@ func (msg *Bytemsg) Serialize() []byte {
6561
}
6662

6763
func (msg *Bytemsg) Len() int {
68-
return syscall_NLA_HDRLEN + len(msg.Value) + 1 // null-terminated
64+
return unix.NLA_HDRLEN + len(msg.Value) + 1 // null-terminated
6965
}
7066

7167
type Boolmsg struct {
@@ -87,5 +83,5 @@ func (msg *Boolmsg) Serialize() []byte {
8783
}
8884

8985
func (msg *Boolmsg) Len() int {
90-
return syscall_NLA_HDRLEN + 1
86+
return unix.NLA_HDRLEN + 1
9187
}

0 commit comments

Comments
 (0)