Commit a287567d authored by Ian Lance Taylor's avatar Ian Lance Taylor

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
parent 86c4c4f0
...@@ -204,7 +204,7 @@ struct Itimerval { ...@@ -204,7 +204,7 @@ struct Itimerval {
}; };
struct EpollEvent { struct EpollEvent {
uint32 events; uint32 events;
uint64 data; byte data[8]; // to match amd64
}; };
......
...@@ -163,6 +163,6 @@ typedef struct EpollEvent EpollEvent; ...@@ -163,6 +163,6 @@ typedef struct EpollEvent EpollEvent;
struct EpollEvent { struct EpollEvent {
uint32 events; uint32 events;
uint32 _pad; uint32 _pad;
uint64 data; byte data[8]; // to match amd64
}; };
#pragma pack off #pragma pack off
...@@ -37,7 +37,7 @@ runtime·netpollopen(uintptr fd, PollDesc *pd) ...@@ -37,7 +37,7 @@ runtime·netpollopen(uintptr fd, PollDesc *pd)
int32 res; int32 res;
ev.events = EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET; 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); res = runtime·epollctl(epfd, EPOLL_CTL_ADD, (int32)fd, &ev);
return -res; return -res;
} }
...@@ -95,7 +95,7 @@ retry: ...@@ -95,7 +95,7 @@ retry:
if(ev->events & (EPOLLOUT|EPOLLHUP|EPOLLERR)) if(ev->events & (EPOLLOUT|EPOLLHUP|EPOLLERR))
mode += 'w'; mode += 'w';
if(mode) if(mode)
runtime·netpollready(&gp, (void*)ev->data, mode); runtime·netpollready(&gp, (void*)(uintptr)*(uint64*)ev->data, mode);
} }
if(block && gp == nil) if(block && gp == nil)
goto retry; goto retry;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment