From 893fd97cdcfbb040c938acac42658c885da879ee Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 22 Feb 2017 23:22:51 -0800 Subject: [PATCH] Use to implement . Bug: https://github.com/android-ndk/ndk/issues/302 Test: builds Change-Id: Ia3074326a128c38f2488e342c028cc030801cfd9 --- libc/include/sys/epoll.h | 14 +++++++------- libc/kernel/tools/defaults.py | 2 ++ libc/kernel/uapi/linux/eventpoll.h | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libc/include/sys/epoll.h b/libc/include/sys/epoll.h index 4ec8969a4e3..b7fdd4d8b64 100644 --- a/libc/include/sys/epoll.h +++ b/libc/include/sys/epoll.h @@ -31,11 +31,17 @@ #include #include -#include /* For O_CLOEXEC. */ #include /* For sigset_t. */ +#include +/* TODO: https://lkml.org/lkml/2017/2/23/416 has a better fix. */ +#undef EPOLLWAKEUP +#undef EPOLLONESHOT +#undef EPOLLET + __BEGIN_DECLS +/* TODO: remove once https://lkml.org/lkml/2017/2/23/417 is upstream. */ #define EPOLLIN 0x00000001 #define EPOLLPRI 0x00000002 #define EPOLLOUT 0x00000004 @@ -51,12 +57,6 @@ __BEGIN_DECLS #define EPOLLONESHOT 0x40000000 #define EPOLLET 0x80000000 -#define EPOLL_CTL_ADD 1 -#define EPOLL_CTL_DEL 2 -#define EPOLL_CTL_MOD 3 - -#define EPOLL_CLOEXEC O_CLOEXEC - typedef union epoll_data { void* ptr; int fd; diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py index d5577da50b2..620bb3137d8 100644 --- a/libc/kernel/tools/defaults.py +++ b/libc/kernel/tools/defaults.py @@ -75,6 +75,8 @@ "SIGRTMAX": "__SIGRTMAX", # We want to support both BSD and Linux member names in struct udphdr. "udphdr": "__kernel_udphdr", + # The kernel's struct epoll_event just has __u64 for the data. + "epoll_event": "__kernel_uapi_epoll_event", } # this is the set of known static inline functions that we want to keep diff --git a/libc/kernel/uapi/linux/eventpoll.h b/libc/kernel/uapi/linux/eventpoll.h index ec51b9f4e5d..6c7e3553602 100644 --- a/libc/kernel/uapi/linux/eventpoll.h +++ b/libc/kernel/uapi/linux/eventpoll.h @@ -37,7 +37,7 @@ #define EPOLL_PACKED /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #endif -struct epoll_event { +struct __kernel_uapi_epoll_event { __u32 events; __u64 data; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */