mirror of
https://github.com/golang/go
synced 2024-11-19 21:54:40 -07: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:
parent
86c4c4f00c
commit
a287567d3c
@ -204,7 +204,7 @@ struct Itimerval {
|
||||
};
|
||||
struct EpollEvent {
|
||||
uint32 events;
|
||||
uint64 data;
|
||||
byte data[8]; // to match amd64
|
||||
};
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user