66ff12e5f7
* vendor: bump libcontainer and docker to remove Sirupsen imports * vendor: fix bad vendoring of archive package * vendor: fix api changes to cgroups in executor * vendor: fix docker api changes * vendor: update github.com/Azure/go-ansiterm to use non capitalized logrus import
43 lines
724 B
Go
43 lines
724 B
Go
package nl
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
type RtMsg struct {
|
|
syscall.RtMsg
|
|
}
|
|
|
|
func NewRtMsg() *RtMsg {
|
|
return &RtMsg{
|
|
RtMsg: syscall.RtMsg{
|
|
Table: syscall.RT_TABLE_MAIN,
|
|
Scope: syscall.RT_SCOPE_UNIVERSE,
|
|
Protocol: syscall.RTPROT_BOOT,
|
|
Type: syscall.RTN_UNICAST,
|
|
},
|
|
}
|
|
}
|
|
|
|
func NewRtDelMsg() *RtMsg {
|
|
return &RtMsg{
|
|
RtMsg: syscall.RtMsg{
|
|
Table: syscall.RT_TABLE_MAIN,
|
|
Scope: syscall.RT_SCOPE_NOWHERE,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (msg *RtMsg) Len() int {
|
|
return syscall.SizeofRtMsg
|
|
}
|
|
|
|
func DeserializeRtMsg(b []byte) *RtMsg {
|
|
return (*RtMsg)(unsafe.Pointer(&b[0:syscall.SizeofRtMsg][0]))
|
|
}
|
|
|
|
func (msg *RtMsg) Serialize() []byte {
|
|
return (*(*[syscall.SizeofRtMsg]byte)(unsafe.Pointer(msg)))[:]
|
|
}
|