From 03a9da175a61c639da5820fd6b4f3bd51e9355b7 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 23 Sep 2009 23:50:43 +0000 Subject: [PATCH] Fix compilation on Android: define fd_mask when it's missing. svn:r1434 --- ChangeLog | 1 + configure.in | 8 ++++++++ select.c | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 08575030..eb4006f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ Changes in 1.4.13-stable: o If the kernel tells us that there are a negative number of bytes to read from a socket, do not believe it. Fixes bug 2841177; found by Alexander Pronchenkov. o Do not allocate the maximum event queue and fd array for the epoll backend at startup. Instead, start out accepting 32 events at a time, and double the queue's size when it seems that the OS is generating events faster than we're requesting them. Saves up to 512K per epoll-based event_base. Resolves bug 2839240. + o Fix compilation on Android, which forgot to define fd_mask in its sys/select.h Changes in 1.4.12-stable: diff --git a/configure.in b/configure.in index bc3eca1f..620fd41c 100644 --- a/configure.in +++ b/configure.in @@ -309,6 +309,14 @@ AC_CHECK_TYPES([uint64_t, uint32_t, uint16_t, uint8_t], , , #ifdef HAVE_SYS_TYPES_H #include #endif]) +AC_CHECK_TYPES([fd_mask], , , +[#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SELECT_H +#include +#endif]) + AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(short) diff --git a/select.c b/select.c index ca6639fd..ac826fd7 100644 --- a/select.c +++ b/select.c @@ -51,6 +51,7 @@ #endif #include "event.h" +#include "evutil.h" #include "event-internal.h" #include "evsignal.h" #include "log.h" @@ -59,6 +60,13 @@ #define howmany(x, y) (((x)+((y)-1))/(y)) #endif +#ifndef _EVENT_HAVE_FD_MASK +/* This type is mandatory, but Android doesn't define it. */ +#undef NFDBITS +#define NFDBITS (sizeof(long)*8) +typedef unsigned long fd_mask; +#endif + struct selectop { int event_fds; /* Highest fd in fd set */ int event_fdsz;