[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35341 - in libmicrohttpd: . src/microhttpd
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35341 - in libmicrohttpd: . src/microhttpd |
Date: |
Wed, 4 Mar 2015 00:42:55 +0100 |
Author: Karlson2k
Date: 2015-03-04 00:42:55 +0100 (Wed, 04 Mar 2015)
New Revision: 35341
Modified:
libmicrohttpd/configure.ac
libmicrohttpd/src/microhttpd/daemon.c
Log:
Check for epoll_create1() function, fix build for Android
Modified: libmicrohttpd/configure.ac
===================================================================
--- libmicrohttpd/configure.ac 2015-03-03 21:59:04 UTC (rev 35340)
+++ libmicrohttpd/configure.ac 2015-03-03 23:42:55 UTC (rev 35341)
@@ -293,6 +293,18 @@
fi
fi
+if test "x$enable_epoll" = "xyes"; then
+ AC_CACHE_CHECK([for epoll_create1()], [mhd_cv_have_epoll_create1], [
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[
+int fd;
+fd = epoll_create1(EPOLL_CLOEXEC);]])],
+ [mhd_cv_have_epoll_create1=yes],
+ [mhd_cv_have_epoll_create1=no])])
+ AS_IF([test "x$mhd_cv_have_epoll_create1" = "xyes"],[
+ AC_DEFINE([[HAVE_EPOLL_CREATE1]], [[1]], [Define if you have epoll_create1
function.])])
+fi
+
if test "x$HAVE_POSIX_THREADS" = "xyes"; then
# Check for pthread_setname_np()
SAVE_LIBS="$LIBS"
Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c 2015-03-03 21:59:04 UTC (rev
35340)
+++ libmicrohttpd/src/microhttpd/daemon.c 2015-03-03 23:42:55 UTC (rev
35341)
@@ -3333,7 +3333,11 @@
{
struct epoll_event event;
+#ifdef HAVE_EPOLL_CREATE1
daemon->epoll_fd = epoll_create1 (EPOLL_CLOEXEC);
+#else /* !HAVE_EPOLL_CREATE1 */
+ daemon->epoll_fd = epoll_create (MAX_EVENTS);
+#endif /* !HAVE_EPOLL_CREATE1 */
if (-1 == daemon->epoll_fd)
{
#if HAVE_MESSAGES
@@ -3343,6 +3347,20 @@
#endif
return MHD_NO;
}
+#ifndef HAVE_EPOLL_CREATE1
+ else
+ {
+ int fdflags = fcntl (daemon->epoll_fd, F_GETFD);
+ if (0 > fdflags || 0 > fcntl (daemon->epoll_fd, F_SETFD, fdflags |
FD_CLOEXEC))
+ {
+#if HAVE_MESSAGES
+ MHD_DLOG (daemon,
+ "Failed to change flags on epoll fd: %s\n",
+ MHD_socket_last_strerr_ ());
+#endif /* HAVE_MESSAGES */
+ }
+ }
+#endif /* !HAVE_EPOLL_CREATE1 */
if (0 == EPOLL_CLOEXEC)
make_nonblocking_noninheritable (daemon,
daemon->epoll_fd);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35341 - in libmicrohttpd: . src/microhttpd,
gnunet <=