* combine.c (try_combine): Don't ignore result of overlap checking
[official-gcc.git] / libgo / go / syscall / route_freebsd_32bit.go
blob5c10b05e24df5211d44165ff36c135dc7f9d3976
1 // Copyright 2014 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 freebsd,386 freebsd,arm
7 package syscall
9 import "unsafe"
11 func (any *anyMessage) parseRouteMessage(b []byte) *RouteMessage {
12 p := (*RouteMessage)(unsafe.Pointer(any))
13 off := int(unsafe.Offsetof(p.Header.Rmx)) + SizeofRtMetrics
14 if freebsdConfArch == "amd64" {
15 off += SizeofRtMetrics // rt_metrics on amd64 is simply doubled
17 return &RouteMessage{Header: p.Header, Data: b[rsaAlignOf(off):any.Msglen]}
20 func (any *anyMessage) parseInterfaceMessage(b []byte) *InterfaceMessage {
21 p := (*InterfaceMessage)(unsafe.Pointer(any))
22 // FreeBSD 10 and beyond have a restructured mbuf
23 // packet header view.
24 // See http://svnweb.freebsd.org/base?view=revision&revision=254804.
25 if freebsdVersion >= 1000000 {
26 m := (*ifMsghdr)(unsafe.Pointer(any))
27 p.Header.Data.Hwassist = uint32(m.Data.Hwassist)
28 p.Header.Data.Epoch = m.Data.Epoch
29 p.Header.Data.Lastchange = m.Data.Lastchange
30 return &InterfaceMessage{Header: p.Header, Data: b[int(unsafe.Offsetof(p.Header.Data))+int(p.Header.Data.Datalen) : any.Msglen]}
32 return &InterfaceMessage{Header: p.Header, Data: b[int(unsafe.Offsetof(p.Header.Data))+int(p.Header.Data.Datalen) : any.Msglen]}