linux-user: Support the epoll syscalls
PATCH 1/1 linux-user: Support the epoll syscalls
Support the epoll family of syscalls: epoll_create(), epoll_create1(), epoll_ctl(), epoll_wait() and epoll_pwait(). Note that epoll_create1() and epoll_pwait() are later additions, so we have to test separately in configure for their presence.
--- configure | 54 +++++++++++++++++++++++ linux-user/syscall.c | 107 +++++++++++++++++++++++++++++++++++++++++++++ linux-user/syscall_defs.h | 13 +++++ 3 files changed, 174 insertions(+), 0 deletions(-)
configure +54 -0
@@ -2136,6 +2136,51 @@ if compile_prog "" "" ; then dup3=yes fi +# check for epoll support +epoll=no +cat > $TMPC << EOF +#include <sys/epoll.h> + +int main(void) +{ + epoll_create(0); + return 0; +} +EOF +if compile_prog "$ARCH_CFLAGS" "" ; then + epoll=yes +fi + +# epoll_create1 and epoll_pwait are later additions +# so we must check separately for their presence +epoll_create1=no +cat > $TMPC << EOF +#include <sys/epoll.h> + +int main(void) +{ + epoll_create1(0); + return 0; +} +EOF +if compile_prog "$ARCH_CFLAGS" "" ; then + epoll_create1=yes +fi + +epoll_pwait=no +cat > $TMPC << EOF +#include <sys/epoll.h> + +int main(void) +{ + epoll_pwait(0, 0, 0, 0, 0); + return 0; +} +EOF +if compile_prog "$ARCH_CFLAGS" "" ; then + epoll_pwait=yes +fi + # Check if tools are available to build documentation. if test "$docs" != "no" ; then if has makeinfo && has pod2man; then
@@ -2668,6 +2713,15 @@ fi if test "$dup3" = "yes" ; then echo "CONFIG_DUP3=y" >> $config_host_mak fi +if test "$epoll" = "yes" ; then + echo "CONFIG_EPOLL=y" >> $config_host_mak +fi +if test "$epoll_create1" = "yes" ; then + echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak +fi +if test "$epoll_pwait" = "yes" ; then + echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak +fi if test "$inotify" = "yes" ; then echo "CONFIG_INOTIFY=y" >> $config_host_mak fi
linux-user/syscall.c +107 -0
119 lines not on this page · raw message
linux-user/syscall_defs.h +13 -0
@@ -2206,3 +2206,16 @@ struct target_mq_attr {#define FUTEX_CLOCK_REALTIME 256#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) +#ifdef CONFIG_EPOLL +typedef union target_epoll_data { +abi_ulong ptr; +abi_ulong fd; +uint32_t u32; +uint64_t u64; +}target_epoll_data_t ; + +struct target_epoll_event { +uint32_t events; +target_epoll_data_t data; +}; +#endif
Signature · 1 line
1.7.1
Quoted 6 lines · Peter Maydell
Support the epoll family of syscalls:
epoll_create(),epoll_create1(),epoll_ctl(),epoll_wait()andepoll_pwait(). Note thatepoll_create1()andepoll_pwait()are later additions, so we have to test separately in configure for their presence.Signed-off-by Peter Maydell <[email protected]>
PS: the real life motivation for this addition is
https://bugs.launchpad.net/qemu-linaro/+bug/644961
and there's also a useful noddy test program attached to this random openwrt bug:
https://dev.openwrt.org/ticket/1815
-- PMM
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Peter Maydell
Support the epoll family of syscalls:
epoll_create(),epoll_create1(),epoll_ctl(),epoll_wait()andepoll_pwait(). Note thatepoll_create1()andepoll_pwait()are later additions, so we have to test separately in configure for their presence.Signed-off-by Peter Maydell <[email protected]>
I tested it and applied to que.
Quoted 5 lines
PS: the real life motivation for this addition is
https://bugs.launchpad.net/qemu-linaro/+bug/644961
and there's also a useful noddy test program attached to this random openwrt bug:
https://dev.openwrt.org/ticket/1815
ltp has also testcases for epoll which I used.