mirror of
https://github.com/golang/go
synced 2024-11-19 23:04: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 {
|
struct EpollEvent {
|
||||||
uint32 events;
|
uint32 events;
|
||||||
uint64 data;
|
byte data[8]; // to match amd64
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -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)
|
|||||||
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:
|
|||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user