summaryrefslogtreecommitdiff
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
commit76dc54d2310606156ea3b6692bdda5f54ddf3aef (patch)
treec1d3c6219b836ce5fc5f5700a8b4050093ba4651 /src/pkg
parentccedd2e0701037721ce25aee82c316aa3a0ca024 (diff)
downloadgo-76dc54d2310606156ea3b6692bdda5f54ddf3aef.tar.gz
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://codereview.appspot.com/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 d19bb7a00..24a05d862 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 61bd30d59..50b3c919e 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 2cf9b3760..9d6c20515 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;