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

cmd/cgo: more mkall.sh behaviour changes at tip #6677

Open
alberts opened this Issue Oct 28, 2013 · 7 comments

Comments

Projects
None yet
5 participants
@alberts
Contributor

alberts commented Oct 28, 2013

What steps will reproduce the problem?

Fedora 19 x86_64
gcc-4.8.1-1.fc19.x86_64

GOARCH=amd64 GOOS=linux ./mkall.sh 

What do you see instead?

some constants like VDISCARD are showing up in zerrors_linux_amd64.go although they are
defined in types_linux.go, which leads to a compile error

the Rusage struct loses its field names:

 type Rusage struct {
-       Utime    Timeval
-       Stime    Timeval
-       Maxrss   int64
-       Ixrss    int64
-       Idrss    int64
-       Isrss    int64
-       Minflt   int64
-       Majflt   int64
-       Nswap    int64
-       Inblock  int64
-       Oublock  int64
-       Msgsnd   int64
-       Msgrcv   int64
-       Nsignals int64
-       Nvcsw    int64
-       Nivcsw   int64
+       Utime  Timeval
+       Stime  Timeval
+       Anon0  [8]byte
+       Anon1  [8]byte
+       Anon2  [8]byte
+       Anon3  [8]byte
+       Anon4  [8]byte
+       Anon5  [8]byte
+       Anon6  [8]byte
+       Anon7  [8]byte
+       Anon8  [8]byte
+       Anon9  [8]byte
+       Anon10 [8]byte
+       Anon11 [8]byte
+       Anon12 [8]byte
+       Anon13 [8]byte
 }

the CSTATUS constant gets a strange value instead of 0x14 which doesn't compile:

CSTATUS = '\0'

the error is: non-octal character in escape sequence: '

the name field in InotifyEvent also changes type, which might break some code:

-   Name   [0]uint8
+   Name   [0]int8

Which operating system are you using?

linux

Which version are you using?  (run 'go version')

tip
@alberts

This comment has been minimized.

Contributor

alberts commented Oct 28, 2013

Comment 1:

Same thing happens with go 1.1.2, so maybe this is due to a bad interaction with GCC 4.8.
@rsc

This comment has been minimized.

Contributor

rsc commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added release-none, removed go1.3maybe.

@rsc

This comment has been minimized.

Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: added repo-main.

@gopherbot

This comment has been minimized.

gopherbot commented Jun 27, 2014

Comment 5:

CL https://golang.org/cl/103450043 mentions this issue.
@gopherbot

This comment has been minimized.

gopherbot commented Jun 28, 2014

Comment 6:

CL https://golang.org/cl/106260044 mentions this issue.
@ianlancetaylor

This comment has been minimized.

Contributor

ianlancetaylor commented Aug 6, 2014

Comment 7:

This issue was updated by revision f2f17c0.

When a struct contains an anonymous union, use the type and
name of the first field in the union.
This should make the glibc  file work; in that
file struct rusage has fields like
__extension__ union
{
        long int ru_maxrss;
        __syscall_slong_t __ru_maxrss_word;
};
in which the field that matters is ru_maxrss and
__ru_maxrss_word just exists to advance to the next field on
systems where the kernel uses long long fields but userspace
expects long fields.
LGTM=mikioh.mikioh
R=golang-codereviews, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/106260044

@alberts alberts added new labels Aug 6, 2014

@bradfitz bradfitz removed the new label Dec 18, 2014

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc removed release-none labels Apr 10, 2015

wheatman added a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018

cmd/cgo: for -godefs, promote first field of anonymous union
Update golang#6677

When a struct contains an anonymous union, use the type and
name of the first field in the union.

This should make the glibc <sys/resource.h> file work; in that
file struct rusage has fields like

__extension__ union
{
        long int ru_maxrss;
        __syscall_slong_t __ru_maxrss_word;
};

in which the field that matters is ru_maxrss and
__ru_maxrss_word just exists to advance to the next field on
systems where the kernel uses long long fields but userspace
expects long fields.

LGTM=mikioh.mikioh
R=golang-codereviews, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/106260044

wheatman added a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018

cmd/cgo: for -godefs, promote first field of anonymous union
Update golang#6677

When a struct contains an anonymous union, use the type and
name of the first field in the union.

This should make the glibc <sys/resource.h> file work; in that
file struct rusage has fields like

__extension__ union
{
        long int ru_maxrss;
        __syscall_slong_t __ru_maxrss_word;
};

in which the field that matters is ru_maxrss and
__ru_maxrss_word just exists to advance to the next field on
systems where the kernel uses long long fields but userspace
expects long fields.

LGTM=mikioh.mikioh
R=golang-codereviews, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/106260044
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment