Fix 386 and arm cross-compile
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
This commit is contained in:
parent
818628ad11
commit
6fca833e4d
|
@ -3,7 +3,6 @@ package netlink
|
|||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
|
@ -949,7 +948,7 @@ func setBridgeMacAddress(s int, name string) error {
|
|||
copy(ifr.IfrnName[:], name)
|
||||
|
||||
for i := 0; i < 6; i++ {
|
||||
ifr.IfruHwaddr.Data[i] = int8(rand.Intn(255))
|
||||
ifr.IfruHwaddr.Data[i] = randIfrDataByte()
|
||||
}
|
||||
|
||||
ifr.IfruHwaddr.Data[0] &^= 0x1 // clear multicast bit
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package netlink
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
func randIfrDataByte() uint8 {
|
||||
return uint8(rand.Intn(255))
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !arm
|
||||
|
||||
package netlink
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
func randIfrDataByte() int8 {
|
||||
return int8(rand.Intn(255))
|
||||
}
|
|
@ -4,10 +4,9 @@ package system
|
|||
|
||||
/*
|
||||
#include <unistd.h>
|
||||
int get_hz(void) { return sysconf(_SC_CLK_TCK); }
|
||||
*/
|
||||
import "C"
|
||||
|
||||
func GetClockTicks() int {
|
||||
return int(C.get_hz())
|
||||
return int(C.sysconf(C._SC_CLK_TCK))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// +build linux,!cgo
|
||||
|
||||
package system
|
||||
|
||||
func GetClockTicks() int {
|
||||
// TODO figure out a better alternative for platforms where we're missing cgo
|
||||
return 100
|
||||
}
|
Loading…
Reference in New Issue