x/sys: sizeof st_rdev is 64bits on mips64 #42370
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
Outputwhen I compile docker on mips64 arch, there is a field Rdev comes from golang/sys must be convert to uint64 otherwise it doesn't compile, this field defined as uint32 on mips64, but we do some test which shows the sizeof st_rdev on mips64 should be 8bytes.
$ uname -a
Linux node001 4.19.90 #2 SMP PREEMPT Fri Sep 4 15:53:40 CST 2020 mips64 mips64 mips64 GNU/Linux
$ cat dev.c
#include <sys/stat.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("%lu\n", sizeof(dev_t));
struct stat s;
printf("%lu\n", sizeof(s.st_dev));
printf("%lu\n", sizeof(s.st_rdev));
}
$ gcc --version
gcc (GCC) 7.3.1 20180303 (Loongson 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc dev.c -o dev && ./dev
8
8
8
So I think Rdev should be defined as unit64 on mips64:
https://github.com/golang/sys/blob/master/unix/ztypes_linux_mips64.go#L92
https://forum.golangbridge.org/t/the-argument-rdev-is-defined-as-type-uint32-in-mips-arch-and-uint64-in-others/21179
thanks.
The text was updated successfully, but these errors were encountered: