1
0
mirror of https://github.com/golang/go synced 2024-10-02 18:18:33 -06:00

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
This commit is contained in:
Ian Lance Taylor 2014-08-30 18:15:55 -07:00
parent 86c4c4f00c
commit a287567d3c
3 changed files with 4 additions and 4 deletions

View File

@ -204,7 +204,7 @@ struct Itimerval {
};
struct EpollEvent {
uint32 events;
uint64 data;
byte data[8]; // to match amd64
};

View File

@ -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

View File

@ -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;