From: Ian Lance Taylor Date: Sun, 31 Aug 2014 01:15:55 +0000 (-0700) Subject: runtime: fix Linux build X-Git-Tag: go1.4beta1~601 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a287567d3cd108513d337f647a3902d3b7fade34;p=gostls13.git runtime: fix Linux build Make the definition of the EpollEvent data field consistent across architectures, adapt the other use of it in netpoll_epoll for the new definition, and use uint64 rather than uintptr. LGTM=dave R=rsc, dave CC=golang-codereviews https://golang.org/cl/137890043 --- diff --git a/src/pkg/runtime/defs_linux_386.h b/src/pkg/runtime/defs_linux_386.h index d19bb7a00f..24a05d862a 100644 --- a/src/pkg/runtime/defs_linux_386.h +++ b/src/pkg/runtime/defs_linux_386.h @@ -204,7 +204,7 @@ struct Itimerval { }; struct EpollEvent { uint32 events; - uint64 data; + byte data[8]; // to match amd64 }; diff --git a/src/pkg/runtime/defs_linux_arm.h b/src/pkg/runtime/defs_linux_arm.h index 61bd30d59c..50b3c919ed 100644 --- a/src/pkg/runtime/defs_linux_arm.h +++ b/src/pkg/runtime/defs_linux_arm.h @@ -163,6 +163,6 @@ typedef struct EpollEvent EpollEvent; struct EpollEvent { uint32 events; uint32 _pad; - uint64 data; + byte data[8]; // to match amd64 }; #pragma pack off diff --git a/src/pkg/runtime/netpoll_epoll.c b/src/pkg/runtime/netpoll_epoll.c index 2cf9b3760d..9d6c205155 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; - *(uintptr*)ev.data = (uintptr)pd; + *(uint64*)ev.data = (uint64)(uintptr)pd; res = runtime·epollctl(epfd, EPOLL_CTL_ADD, (int32)fd, &ev); return -res; } @@ -95,7 +95,7 @@ retry: if(ev->events & (EPOLLOUT|EPOLLHUP|EPOLLERR)) mode += 'w'; if(mode) - runtime·netpollready(&gp, (void*)ev->data, mode); + runtime·netpollready(&gp, (void*)(uintptr)*(uint64*)ev->data, mode); } if(block && gp == nil) goto retry;