aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-08-30 14:54:09 -0400
committerRuss Cox <rsc@golang.org>2014-08-30 14:54:09 -0400
commit86c4c4f00cc2ab6445ccb333c5b585bfe4a1002f (patch)
tree38e0024cb9d7194fdf7e6c75f7ac7455a6bf81f3 /src/pkg/runtime
parent50199d7b35ef684aef2122b9327b3cf5036b011a (diff)
downloadgo-86c4c4f00cc2ab6445ccb333c5b585bfe4a1002f.tar.xz
cmd/cc: generate error if #pragma pack off does anything
We can't translate misaligned things to Go, so start rejecting them in C. The only one in any build appears to be EpollEvent on linux/amd64. Fix that. LGTM=r R=golang-codereviews, r, dvyukov CC=golang-codereviews, iant https://golang.org/cl/137020043
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/defs_linux_amd64.h2
-rw-r--r--src/pkg/runtime/netpoll_epoll.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/runtime/defs_linux_amd64.h b/src/pkg/runtime/defs_linux_amd64.h
index 73fd9947a7..14616dffed 100644
--- a/src/pkg/runtime/defs_linux_amd64.h
+++ b/src/pkg/runtime/defs_linux_amd64.h
@@ -122,7 +122,7 @@ struct Itimerval {
};
struct EpollEvent {
uint32 events;
- uint64 data;
+ byte data[8]; // unaligned uintptr
};
diff --git a/src/pkg/runtime/netpoll_epoll.c b/src/pkg/runtime/netpoll_epoll.c
index a0ae7df310..2cf9b3760d 100644
--- a/src/pkg/runtime/netpoll_epoll.c
+++ b/src/pkg/runtime/netpoll_epoll.c
@@ -37,7 +37,7 @@ runtime·netpollopen(uintptr fd, PollDesc *pd)
int32 res;
ev.events = EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET;
- ev.data = (uint64)pd;
+ *(uintptr*)ev.data = (uintptr)pd;
res = runtime·epollctl(epfd, EPOLL_CTL_ADD, (int32)fd, &ev);
return -res;
}