-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
runtime: defs_linux.go doesn't work anymore #8477
Labels
Comments
Having fixed this locally, here's the resulting diff I get between the current defs_linux_amd64.h and a freshly generated one: --- defs_linux_amd64.h 2014-08-05 13:42:59.683096049 -0700 +++ - 2014-08-05 13:51:18.314042923 -0700 @@ -122,7 +122,7 @@ }; struct EpollEvent { uint32 events; - uint64 data; + byte Pad_cgo_0[8]; }; @@ -246,7 +246,7 @@ uint64 trapno; uint64 oldmask; uint64 cr2; - Fpstate1 *fpstate; + byte anon0[8]; uint64 __reserved1[8]; }; The EpollEvent struct change is because it's a packed structure, so data is supposed to be at a 4-byte offset, but cgo wants to put it at an 8-byte offset. This makes me a little surprised if the integrated network poller is currently working correctly on linux/amd64, but I haven't looked into it further yet. The Sigcontext struct change is because Linux has moved fpstate into an anonymous union. The Go runtime doesn't touch fpstate anyway, so that seems harmless. |
CL https://golang.org/cl/120610043 mentions this issue. |
Seems like the culprit is revision 2fb7165d5fdcd4141eff4cc3dc4bbba5a6728272. Updated https://golang.org/cl/120610043 to fix the EpollEvent issue too. |
This issue was closed by revision f7a8adb. Status changed to Fixed. |
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 25, 2018
Instead of including <sys/types.h> to get size_t, instead include the ISO C standard <stddef.h> header, which defines fewer additional types at risk of colliding with the user code. In particular, this prevents collisions between <sys/types.h>'s userspace definitions with the kernel definitions needed by defs_linux.go. Also, -cdefs mode uses #pragma pack, so we can keep misaligned fields. Fixes golang#8477. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/120610043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 9, 2018
Instead of including <sys/types.h> to get size_t, instead include the ISO C standard <stddef.h> header, which defines fewer additional types at risk of colliding with the user code. In particular, this prevents collisions between <sys/types.h>'s userspace definitions with the kernel definitions needed by defs_linux.go. Also, -cdefs mode uses #pragma pack, so we can keep misaligned fields. Fixes golang#8477. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/120610043
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: