Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/sys: sizeof st_rdev is 64bits on mips64 #42370

Open
meidli opened this issue Nov 4, 2020 · 1 comment
Open

x/sys: sizeof st_rdev is 64bits on mips64 #42370

meidli opened this issue Nov 4, 2020 · 1 comment
Labels
NeedsInvestigation
Milestone

Comments

@meidli
Copy link

@meidli meidli commented Nov 4, 2020

What version of Go are you using (go version)?

$ go version
go version go1.13.9 linux/mips64le

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOHOSTARCH="mips64le"
GOHOSTOS="linux"

when 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.

@gopherbot gopherbot added this to the Unreleased milestone Nov 4, 2020
@cherrymui
Copy link
Member

@cherrymui cherrymui commented Nov 4, 2020

Go uses the kernel's layout, instead of libc's. #16500 (comment)

@toothrot toothrot added the NeedsInvestigation label Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

4 participants