libgo: update to go1.9
[official-gcc.git] / libgo / go / golang_org / x / net / route / sys.go
blob3d0ee9b1481513d0e4ad4f3b8691aa514e3ba427
1 // Copyright 2016 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // +build darwin dragonfly freebsd netbsd openbsd
7 package route
9 import "unsafe"
11 var (
12 nativeEndian binaryByteOrder
13 kernelAlign int
14 wireFormats map[int]*wireFormat
17 func init() {
18 i := uint32(1)
19 b := (*[4]byte)(unsafe.Pointer(&i))
20 if b[0] == 1 {
21 nativeEndian = littleEndian
22 } else {
23 nativeEndian = bigEndian
25 kernelAlign, wireFormats = probeRoutingStack()
28 func roundup(l int) int {
29 if l == 0 {
30 return kernelAlign
32 return (l + kernelAlign - 1) & ^(kernelAlign - 1)
35 type wireFormat struct {
36 extOff int // offset of header extension
37 bodyOff int // offset of message body
38 parse func(RIBType, []byte) (Message, error)