3
3
package libcontainer
4
4
5
5
import (
6
- "syscall"
7
-
8
6
"github.com/vishvananda/netlink/nl"
7
+ "golang.org/x/sys/unix"
9
8
)
10
9
11
10
// list of known message types we want to send to bootstrap program
@@ -19,9 +18,6 @@ const (
19
18
SetgroupAttr uint16 = 27285
20
19
OomScoreAdjAttr uint16 = 27286
21
20
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 )
25
21
)
26
22
27
23
type Int32msg struct {
@@ -43,7 +39,7 @@ func (msg *Int32msg) Serialize() []byte {
43
39
}
44
40
45
41
func (msg * Int32msg ) Len () int {
46
- return syscall_NLA_HDRLEN + 4
42
+ return unix . NLA_HDRLEN + 4
47
43
}
48
44
49
45
// Bytemsg has the following representation
@@ -56,7 +52,7 @@ type Bytemsg struct {
56
52
57
53
func (msg * Bytemsg ) Serialize () []byte {
58
54
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 ))
60
56
native := nl .NativeEndian ()
61
57
native .PutUint16 (buf [0 :2 ], uint16 (l ))
62
58
native .PutUint16 (buf [2 :4 ], msg .Type )
@@ -65,7 +61,7 @@ func (msg *Bytemsg) Serialize() []byte {
65
61
}
66
62
67
63
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
69
65
}
70
66
71
67
type Boolmsg struct {
@@ -87,5 +83,5 @@ func (msg *Boolmsg) Serialize() []byte {
87
83
}
88
84
89
85
func (msg * Boolmsg ) Len () int {
90
- return syscall_NLA_HDRLEN + 1
86
+ return unix . NLA_HDRLEN + 1
91
87
}
0 commit comments