]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix Linux build
authorIan Lance Taylor <iant@golang.org>
Sun, 31 Aug 2014 01:15:55 +0000 (18:15 -0700)
committerIan Lance Taylor <iant@golang.org>
Sun, 31 Aug 2014 01:15:55 +0000 (18:15 -0700)
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

src/pkg/runtime/defs_linux_386.h
src/pkg/runtime/defs_linux_arm.h
src/pkg/runtime/netpoll_epoll.c

index d19bb7a00ffc6f1db04ea28430fac4c3e0ddf1c3..24a05d862af0b2f22d21427048eed11c12d9b365 100644 (file)
@@ -204,7 +204,7 @@ struct Itimerval {
 };
 struct EpollEvent {
        uint32  events;
-       uint64  data;
+       byte    data[8]; // to match amd64
 };
 
 
index 61bd30d59c176613f954dc8576e438570a5a4c69..50b3c919edf0c4047855c38c757615cc18589d22 100644 (file)
@@ -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
index 2cf9b3760db5060be3b7d799d5cceef0660e88f2..9d6c20515561fd0871085275115c8c0911a9804c 100644 (file)
@@ -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;