From f205689ff5a23d09340361ba3210a6708017995e Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Wed, 5 Apr 2017 19:17:59 +0100 Subject: [PATCH] build: Fix compilation in 32 bits platforms (#4052) go fails to build Minio under at least, armv6 and 386 due to some inconsistencies in the type of one syscall variable in different architectures. This PR casts that variable to uint64 to achieve the desired consistency. --- pkg/sys/stats_linux.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/sys/stats_linux.go b/pkg/sys/stats_linux.go index dbb91bb12..4d467219c 100644 --- a/pkg/sys/stats_linux.go +++ b/pkg/sys/stats_linux.go @@ -62,9 +62,14 @@ func getSysinfoMemoryLimit() (limit uint64, err error) { return 0, err } + // Some fields in syscall.Sysinfo_t have different integer sizes + // in different platform architectures. Cast all fields to uint64. + totalRAM := uint64(si.Totalram) + unit := uint64(si.Unit) + // Total RAM is always the multiplicative value // of unit size and total ram. - limit = uint64(si.Unit) * si.Totalram + limit = unit * totalRAM return limit, nil }