Skip to content

Commit

Permalink
build: Fix compilation in 32 bits platforms (minio#4052)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vadmeste authored and harshavardhana committed Apr 5, 2017
1 parent 393c01d commit f205689
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/sys/stats_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit f205689

Please sign in to comment.