diff --git a/configure.ac b/configure.ac index db01a246..27a92e71 100644 --- a/configure.ac +++ b/configure.ac @@ -69,10 +69,6 @@ AC_PROG_MAKE_SET AM_PROG_CC_C_O PKG_PROG_PKG_CONFIG([0.20]) -AC_COMPILE_STDCXX_11 -AM_CONDITIONAL([HAVE_STDCXX_11], - [ test "x$ac_cv_cxx_compile_cxx11_cxx" = "xyes" ]) - # Checks for libraries. # Additional libraries required for tests. @@ -145,26 +141,22 @@ fi AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ]) -# openssl (for examples) +# openssl (for src) PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.1], [have_openssl=yes], [have_openssl=no]) if test "x${have_openssl}" = "xno"; then AC_MSG_NOTICE($OPENSSL_PKG_ERRORS) - AC_MSG_NOTICE([The example programs will not be built.]) fi -# libevent_openssl +# libevent_openssl (for src) # 2.0.8 is required because we use evconnlistener_set_error_cb() PKG_CHECK_MODULES([LIBEVENT_OPENSSL], [libevent_openssl >= 2.0.8], [have_libevent_openssl=yes], [have_libevent_openssl=no]) if test "x${have_libevent_openssl}" = "xno"; then AC_MSG_NOTICE($LIBEVENT_OPENSSL_PKG_ERRORS) - AC_MSG_NOTICE([Shrpx example program will not be built.]) fi -AM_CONDITIONAL([HAVE_LIBEVENT_OPENSSL], - [ test "x${have_libevent_openssl}" = "xyes" ]) -# libxml2 (for examples/spdycat) +# libxml2 (for src/nghttp) have_libxml2=no if test "x$with_libxml2" != "xno"; then AM_PATH_XML2(2.7.7, [have_libxml2=yes], [have_libxml2=no]) @@ -174,21 +166,22 @@ if test "x$with_libxml2" != "xno"; then fi AM_CONDITIONAL([HAVE_LIBXML2], [ test "x${have_libxml2}" = "xyes" ]) -# spdylay (for shrpx) +# spdylay (for src/nghttpx) PKG_CHECK_MODULES([LIBSPDYLAY], [libspdylay >= 1.0.0], [have_spdylay=yes], [have_spdylay=no]) if test "x${have_spdylay}" = "xyes"; then AC_DEFINE([HAVE_SPDYLAY], [1], [Define to 1 if you have `spdylay` library.]) else AC_MSG_NOTICE($LIBSPDYLAY_PKG_ERRORS) - AC_MSG_NOTICE([The SPDY support in shrpx will be disabled.]) + AC_MSG_NOTICE([The SPDY support in nghttpd will be disabled.]) fi AM_CONDITIONAL([HAVE_SPDYLAY], [ test "x${have_spdylay}" = "xyes" ]) -# The src programs depend on OpenSSL +# The programs under src depend on OpenSSL and libevent_openssl enable_src=no if test "x${request_src}" = "xyes" && - test "x${have_openssl}" = "xyes"; then + test "x${have_openssl}" = "xyes" && + test "x${have_libevent_openssl}" = "xyes"; then enable_src=yes fi @@ -245,37 +238,6 @@ AC_CHECK_FUNCS([ \ timegm \ ]) -AX_HAVE_EPOLL([have_epoll=yes], [have_epoll=no]) -if test "x${have_epoll}" = "xyes"; then - AC_DEFINE([HAVE_EPOLL], [1], [Define to 1 if you have the `epoll`.]) -fi -AM_CONDITIONAL([HAVE_EPOLL], [ test "x${have_epoll}" = "xyes" ]) - -AC_CHECK_FUNCS([kqueue], [have_kqueue=yes]) -AM_CONDITIONAL([HAVE_KQUEUE], [ test "x${have_kqueue}" = "xyes" ]) - -AM_CONDITIONAL([ENABLE_SPDYD], - [ test "x${have_epoll}" = "xyes" || test "x${have_kqueue}" = "xyes" ]) - -AC_LANG_PUSH(C++) -AC_MSG_CHECKING([whether struct kevent.udata is intptr_t]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -#include -]], -[[ -struct kevent event; -event.udata = (intptr_t)(&event); -]])], -[kevent_udata_intptr_t=yes], [kevent_udata_intptr_t=no]) -AC_MSG_RESULT([$kevent_udata_intptr_t]) -if test "x$kevent_udata_intptr_t" = "xyes"; then - AC_DEFINE([KEVENT_UDATA_INTPTR_T], [1], - [Define to 1 if struct kevent.udata is intptr_t]) -fi -AC_LANG_POP() - dnl Windows library for winsock2 case "${host}" in *mingw*) diff --git a/m4/ac_compile_stdcxx_11.m4 b/m4/ac_compile_stdcxx_11.m4 deleted file mode 100644 index 746c44ed..00000000 --- a/m4/ac_compile_stdcxx_11.m4 +++ /dev/null @@ -1,22 +0,0 @@ -# AC_COMPILE_STDCXX_11 -AC_DEFUN([AC_COMPILE_STDCXX_11], [ - - AC_CACHE_CHECK(if g++ supports C++11 features with -std=c++0x, - ac_cv_cxx_compile_cxx11_cxx, - [AC_LANG_SAVE - AC_LANG_CPLUSPLUS - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -std=gnu++0x" - AC_TRY_COMPILE([ - #include - std::function func; - ],, - ac_cv_cxx_compile_cxx11_cxx=yes, ac_cv_cxx_compile_cxx11_cxx=no) - CXXFLAGS="$ac_save_CXXFLAGS" - AC_LANG_RESTORE - ]) - - if test "$ac_cv_cxx_compile_cxx11_cxx" = yes; then - AC_DEFINE(HAVE_STDCXX_11,,[Define if g++ supports C++11 features. ]) - fi -]) diff --git a/m4/ax_have_epoll.m4 b/m4/ax_have_epoll.m4 deleted file mode 100644 index 07ceb49f..00000000 --- a/m4/ax_have_epoll.m4 +++ /dev/null @@ -1,104 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_have_epoll.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_HAVE_EPOLL([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# AX_HAVE_EPOLL_PWAIT([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# DESCRIPTION -# -# This macro determines whether the system supports the epoll I/O event -# interface. A neat usage example would be: -# -# AX_HAVE_EPOLL( -# [AX_CONFIG_FEATURE_ENABLE(epoll)], -# [AX_CONFIG_FEATURE_DISABLE(epoll)]) -# AX_CONFIG_FEATURE( -# [epoll], [This platform supports epoll(7)], -# [HAVE_EPOLL], [This platform supports epoll(7).]) -# -# The epoll interface was added to the Linux kernel in version 2.5.45, and -# the macro verifies that a kernel newer than this is installed. This -# check is somewhat unreliable if doesn't match the -# running kernel, but it is necessary regardless, because glibc comes with -# stubs for the epoll_create(), epoll_wait(), etc. that allow programs to -# compile and link even if the kernel is too old; the problem would then -# be detected only at runtime. -# -# Linux kernel version 2.6.19 adds the epoll_pwait() call in addition to -# epoll_wait(). The availability of that function can be tested with the -# second macro. Generally speaking, it is safe to assume that -# AX_HAVE_EPOLL would succeed if AX_HAVE_EPOLL_PWAIT has, but not the -# other way round. -# -# LICENSE -# -# Copyright (c) 2008 Peter Simons -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 10 - -AC_DEFUN([AX_HAVE_EPOLL], [dnl - ax_have_epoll_cppflags="${CPPFLAGS}" - AC_CHECK_HEADER([linux/version.h], [CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H"]) - AC_MSG_CHECKING([for Linux epoll(7) interface]) - AC_CACHE_VAL([ax_cv_have_epoll], [dnl - AC_LINK_IFELSE([dnl - AC_LANG_PROGRAM([dnl -#include -#ifdef HAVE_LINUX_VERSION_H -# include -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,45) -# error linux kernel version is too old to have epoll -# endif -#endif -], [dnl -int fd, rc; -struct epoll_event ev; -fd = epoll_create(128); -rc = epoll_wait(fd, &ev, 1, 0);])], - [ax_cv_have_epoll=yes], - [ax_cv_have_epoll=no])]) - CPPFLAGS="${ax_have_epoll_cppflags}" - AS_IF([test "${ax_cv_have_epoll}" = "yes"], - [AC_MSG_RESULT([yes]) -$1],[AC_MSG_RESULT([no]) -$2]) -])dnl - -AC_DEFUN([AX_HAVE_EPOLL_PWAIT], [dnl - ax_have_epoll_cppflags="${CPPFLAGS}" - AC_CHECK_HEADER([linux/version.h], - [CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H"]) - AC_MSG_CHECKING([for Linux epoll(7) interface with signals extension]) - AC_CACHE_VAL([ax_cv_have_epoll_pwait], [dnl - AC_LINK_IFELSE([dnl - AC_LANG_PROGRAM([dnl -#ifdef HAVE_LINUX_VERSION_H -# include -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -# error linux kernel version is too old to have epoll_pwait -# endif -#endif -#include -#include -], [dnl -int fd, rc; -struct epoll_event ev; -fd = epoll_create(128); -rc = epoll_wait(fd, &ev, 1, 0); -rc = epoll_pwait(fd, &ev, 1, 0, (sigset_t const *)(0));])], - [ax_cv_have_epoll_pwait=yes], - [ax_cv_have_epoll_pwait=no])]) - CPPFLAGS="${ax_have_epoll_cppflags}" - AS_IF([test "${ax_cv_have_epoll_pwait}" = "yes"], - [AC_MSG_RESULT([yes]) -$1],[AC_MSG_RESULT([no]) -$2]) -])dnl diff --git a/src/EventPoll.h b/src/EventPoll.h deleted file mode 100644 index 4433f6b0..00000000 --- a/src/EventPoll.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * nghttp2 - HTTP/2.0 C Library - * - * Copyright (c) 2012 Tatsuhiro Tsujikawa - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -#ifndef EVENT_POLL_H -#define EVENT_POLL_H - -#include "nghttp2_config.h" - -#ifdef HAVE_EPOLL -# include "EventPoll_epoll.h" -#elif HAVE_KQUEUE -# include "EventPoll_kqueue.h" -#endif // HAVE_KQUEUE - -#endif // EVENT_POLL_H diff --git a/src/EventPollEvent.h b/src/EventPollEvent.h deleted file mode 100644 index 562ba5b3..00000000 --- a/src/EventPollEvent.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * nghttp2 - HTTP/2.0 C Library - * - * Copyright (c) 2012 Tatsuhiro Tsujikawa - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -#ifndef EVENT_POLL_EVENT_H -#define EVENT_POLL_EVENT_H - -#include "nghttp2_config.h" - -namespace nghttp2 { - -enum EventPollEvent { - EP_POLLIN = 1, - EP_POLLOUT = 1 << 1, - EP_POLLHUP = 1 << 2, - EP_POLLERR = 1 << 3 -}; - -enum EventPollOp { - EP_ADD, - EP_MOD -}; - -} // namespace nghttp2 - -#endif // EVENT_POLL_EVENT_H diff --git a/src/EventPoll_epoll.cc b/src/EventPoll_epoll.cc deleted file mode 100644 index 8622274a..00000000 --- a/src/EventPoll_epoll.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* - * nghttp2 - HTTP/2.0 C Library - * - * Copyright (c) 2012 Tatsuhiro Tsujikawa - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -#include "EventPoll_epoll.h" - -#include - -#include - -namespace nghttp2 { - -EventPoll::EventPoll(size_t max_events) - : max_events_(max_events), num_events_(0) -{ - epfd_ = epoll_create(1); - assert(epfd_ != -1); - evlist_ = new epoll_event[max_events_]; -} - -EventPoll::~EventPoll() -{ - if(epfd_ != -1) { - close(epfd_); - } - delete [] evlist_; -} - -int EventPoll::poll(int timeout) -{ - num_events_ = 0; - int n = epoll_wait(epfd_, evlist_, max_events_, timeout); - if(n > 0) { - num_events_ = n; - } - return n; -} - -int EventPoll::get_num_events() -{ - return num_events_; -} - -void* EventPoll::get_user_data(size_t p) -{ - return evlist_[p].data.ptr; -} - -int EventPoll::get_events(size_t p) -{ - int events = 0; - int revents = evlist_[p].events; - if(revents & EPOLLIN) { - events |= EP_POLLIN; - } - if(revents & EPOLLOUT) { - events |= EP_POLLOUT; - } - if(revents & EPOLLHUP) { - events |= EP_POLLHUP; - } - if(revents & EPOLLERR) { - events |= EP_POLLERR; - } - return events; -} - -namespace { -int update_event(int epfd, int op, int fd, int events, void *user_data) -{ - epoll_event ev; - ev.events = 0; - if(events & EP_POLLIN) { - ev.events |= EPOLLIN; - } - if(events & EP_POLLOUT) { - ev.events |= EPOLLOUT; - } - ev.data.ptr = user_data; - return epoll_ctl(epfd, op, fd, &ev); -} -} // namespace - -int EventPoll::ctl_event(int op, int fd, int events, void *user_data) -{ - if(op == EP_ADD) { - op = EPOLL_CTL_ADD; - } else if(op == EP_MOD) { - op = EPOLL_CTL_MOD; - } else { - return -1; - } - return update_event(epfd_, op, fd, events, user_data); -} - -} // namespace nghttp2 diff --git a/src/EventPoll_epoll.h b/src/EventPoll_epoll.h deleted file mode 100644 index 1a595e10..00000000 --- a/src/EventPoll_epoll.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * nghttp2 - HTTP/2.0 C Library - * - * Copyright (c) 2012 Tatsuhiro Tsujikawa - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -#ifndef EVENT_POLL_EPOLL_H -#define EVENT_POLL_EPOLL_H - -#include "nghttp2_config.h" - -#include - -#include - -#include "EventPollEvent.h" - -namespace nghttp2 { - -class EventPoll { -public: - EventPoll(size_t max_events); - ~EventPoll(); - // Returns 0 if this function succeeds, or -1. - // On success - int poll(int timeout); - // Returns number of events detected in previous call of poll(). - int get_num_events(); - // Returns events of p-eth event. - int get_events(size_t p); - // Returns user data of p-th event. - void* get_user_data(size_t p); - // Adds/Modifies event to watch. - int ctl_event(int op, int fd, int events, void *user_data); -private: - int epfd_; - size_t max_events_; - epoll_event *evlist_; - size_t num_events_; -}; - -} // namespace nghttp2 - -#endif // EVENT_POLL_EPOLL_H diff --git a/src/EventPoll_kqueue.cc b/src/EventPoll_kqueue.cc deleted file mode 100644 index 1006ad29..00000000 --- a/src/EventPoll_kqueue.cc +++ /dev/null @@ -1,119 +0,0 @@ -/* - * nghttp2 - HTTP/2.0 C Library - * - * Copyright (c) 2012 Tatsuhiro Tsujikawa - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -#include "EventPoll_kqueue.h" - -#include - -#include -#include - -#ifdef KEVENT_UDATA_INTPTR_T -# define PTR_TO_UDATA(X) (reinterpret_cast(X)) -#else // !KEVENT_UDATA_INTPTR_T -# define PTR_TO_UDATA(X) (X) -#endif // !KEVENT_UDATA_INTPTR_T - -namespace nghttp2 { - -EventPoll::EventPoll(size_t max_events) - : max_events_(max_events), num_events_(0) -{ - kq_ = kqueue(); - assert(kq_ != -1); - evlist_ = new struct kevent[max_events_]; -} - -EventPoll::~EventPoll() -{ - if(kq_ != -1) { - close(kq_); - } - delete [] evlist_; -} - -int EventPoll::poll(int timeout) -{ - timespec ts, *ts_ptr; - if(timeout == -1) { - ts_ptr = 0; - } else { - ts.tv_sec = timeout/1000; - ts.tv_nsec = (timeout%1000)*1000000; - ts_ptr = &ts; - } - num_events_ = 0; - int n; - while((n = kevent(kq_, evlist_, 0, evlist_, max_events_, ts_ptr)) == -1 && - errno == EINTR); - if(n > 0) { - num_events_ = n; - } - return n; -} - -int EventPoll::get_num_events() -{ - return num_events_; -} - -void* EventPoll::get_user_data(size_t p) -{ - return reinterpret_cast(evlist_[p].udata); -} - -int EventPoll::get_events(size_t p) -{ - int events = 0; - short filter = evlist_[p].filter; - if(filter == EVFILT_READ) { - events |= EP_POLLIN; - } - if(filter == EVFILT_WRITE) { - events |= EP_POLLOUT; - } - return events; -} - -namespace { -int update_event(int kq, int fd, int events, void *user_data) -{ - struct kevent changelist[2]; - EV_SET(&changelist[0], fd, EVFILT_READ, - EV_ADD | ((events & EP_POLLIN) ? EV_ENABLE : EV_DISABLE), - 0, 0, PTR_TO_UDATA(user_data)); - EV_SET(&changelist[1], fd, EVFILT_WRITE, - EV_ADD | ((events & EP_POLLOUT) ? EV_ENABLE : EV_DISABLE), - 0, 0, PTR_TO_UDATA(user_data)); - timespec ts = { 0, 0 }; - return kevent(kq, changelist, 2, changelist, 0, &ts); -} -} // namespace - -int EventPoll::ctl_event(int op, int fd, int events, void *user_data) -{ - return update_event(kq_, fd, events, user_data); -} - -} // namespace nghttp2 diff --git a/src/EventPoll_kqueue.h b/src/EventPoll_kqueue.h deleted file mode 100644 index 67f63b82..00000000 --- a/src/EventPoll_kqueue.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * nghttp2 - HTTP/2.0 C Library - * - * Copyright (c) 2012 Tatsuhiro Tsujikawa - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -#ifndef EVENT_POLL_KQUEUE_H -#define EVENT_POLL_KQUEUE_H - -#include "nghttp2_config.h" - -#include - -#include -#include -#include - -#include "EventPollEvent.h" - -namespace nghttp2 { - -class EventPoll { -public: - EventPoll(size_t max_events); - ~EventPoll(); - // Returns 0 if this function succeeds, or -1. - // On success - int poll(int timeout); - // Returns number of events detected in previous call of poll(). - int get_num_events(); - // Returns events of p-eth event. - int get_events(size_t p); - // Returns user data of p-th event. - void* get_user_data(size_t p); - // Adds/Modifies event to watch. - int ctl_event(int op, int fd, int events, void *user_data); -private: - int kq_; - size_t max_events_; - struct kevent *evlist_; - size_t num_events_; -}; - -} // namespace nghttp2 - -#endif // EVENT_POLL_KQUEUE_H diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 28135267..048bc493 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -46,7 +46,6 @@ #include "app_helper.h" #include "util.h" -#include "EventPoll.h" #ifndef O_BINARY # define O_BINARY (0) diff --git a/src/Makefile.am b/src/Makefile.am index 0762e820..e9ab0caa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -42,19 +42,6 @@ bin_PROGRAMS += nghttp nghttpd nghttpx HELPER_OBJECTS = util.cc timegm.c app_helper.cc HELPER_HFILES = util.h timegm.h app_helper.h nghttp2_config.h -EVENT_OBJECTS = -EVENT_HFILES = EventPoll.h EventPollEvent.h - -if HAVE_EPOLL -EVENT_OBJECTS += EventPoll_epoll.cc -EVENT_HFILES += EventPoll_epoll.h -endif # HAVE_EPOLL - -if HAVE_KQUEUE -EVENT_OBJECTS += EventPoll_kqueue.cc -EVENT_HFILES += EventPoll_kqueue.h -endif # HAVE_KQUEUE - HTML_PARSER_OBJECTS = HTML_PARSER_HFILES = HtmlParser.h @@ -69,7 +56,6 @@ nghttp_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttp.cc \ nghttpd_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttpd.cc \ HttpServer.cc HttpServer.h -if HAVE_LIBEVENT_OPENSSL NGHTTPX_SRCS = \ util.cc util.h timegm.c timegm.h base64.h \ shrpx_config.cc shrpx_config.h \ @@ -112,6 +98,4 @@ nghttpx_SOURCES = ${NGHTTPX_SRCS} shrpx.cc shrpx.h # TESTS += shrpx-unittest # endif # HAVE_CUNIT -endif # HAVE_LIBEVENT_OPENSSL - endif # ENABLE_SRC