aboutsummaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2014-08-30 18:15:55 -0700
committerIan Lance Taylor <iant@golang.org>2014-08-30 18:15:55 -0700
commita287567d3cd108513d337f647a3902d3b7fade34 (patch)
treeeb757633130786790a9d49bac889b9ccb27c8bd7 /src/pkg
parent86c4c4f00cc2ab6445ccb333c5b585bfe4a1002f (diff)
downloadgo-a287567d3cd108513d337f647a3902d3b7fade34.tar.xz
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
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/runtime/defs_linux_386.h2
-rw-r--r--src/pkg/runtime/defs_linux_arm.h2
-rw-r--r--src/pkg/runtime/netpoll_epoll.c4
3 files changed, 4 insertions, 4 deletions
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;