mirror of
https://github.com/moparisthebest/spdylay
synced 2024-11-12 04:25:09 -05:00
Fix compile error on netbsd
Include config.h from sources under examples. Added kevent.udata type check.
This commit is contained in:
parent
51c4f4f5b0
commit
05e6d527b1
21
configure.ac
21
configure.ac
@ -59,6 +59,10 @@ AM_CONDITIONAL([HAVE_STDCXX_11],
|
|||||||
|
|
||||||
# Checks for libraries.
|
# Checks for libraries.
|
||||||
|
|
||||||
|
# Search for dlsym function, which is used in tests. Linux needs -ldl,
|
||||||
|
# but netbsd does not need it.
|
||||||
|
AC_SEARCH_LIBS([dlsym], [dl])
|
||||||
|
|
||||||
# zlib
|
# zlib
|
||||||
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3])
|
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3])
|
||||||
LIBS="$ZLIB_LIBS $LIBS"
|
LIBS="$ZLIB_LIBS $LIBS"
|
||||||
@ -163,6 +167,23 @@ AM_CONDITIONAL([HAVE_EPOLL], [ test "x${have_epoll}" = "xyes" ])
|
|||||||
AC_CHECK_FUNCS([kqueue], [have_kqueue=yes])
|
AC_CHECK_FUNCS([kqueue], [have_kqueue=yes])
|
||||||
AM_CONDITIONAL([HAVE_KQUEUE], [test "x${have_kqueue}" = "xyes"])
|
AM_CONDITIONAL([HAVE_KQUEUE], [test "x${have_kqueue}" = "xyes"])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([whether struct kevent.udata is intptr_t])
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/event.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
]],
|
||||||
|
[[
|
||||||
|
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
|
||||||
|
|
||||||
if test "x$maintainer_mode" != "xno"; then
|
if test "x$maintainer_mode" != "xno"; then
|
||||||
CFLAGS="$CFLAGS -Wall -Wextra -Werror"
|
CFLAGS="$CFLAGS -Wall -Wextra -Werror"
|
||||||
CFLAGS="$CFLAGS -Wmissing-prototypes -Wstrict-prototypes"
|
CFLAGS="$CFLAGS -Wmissing-prototypes -Wstrict-prototypes"
|
||||||
|
@ -25,9 +25,7 @@
|
|||||||
#ifndef EVENT_POLL_H
|
#ifndef EVENT_POLL_H
|
||||||
#define EVENT_POLL_H
|
#define EVENT_POLL_H
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#include "spdylay_config.h"
|
||||||
# include <config.h>
|
|
||||||
#endif // HAVE_CONFIG_H
|
|
||||||
|
|
||||||
#ifdef HAVE_EPOLL
|
#ifdef HAVE_EPOLL
|
||||||
# include "EventPoll_epoll.h"
|
# include "EventPoll_epoll.h"
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef EVENT_POLL_EVENT_H
|
#ifndef EVENT_POLL_EVENT_H
|
||||||
#define EVENT_POLL_EVENT_H
|
#define EVENT_POLL_EVENT_H
|
||||||
|
|
||||||
|
#include "spdylay_config.h"
|
||||||
|
|
||||||
namespace spdylay {
|
namespace spdylay {
|
||||||
|
|
||||||
enum EventPollEvent {
|
enum EventPollEvent {
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef EVENT_POLL_EPOLL_H
|
#ifndef EVENT_POLL_EPOLL_H
|
||||||
#define EVENT_POLL_EPOLL_H
|
#define EVENT_POLL_EPOLL_H
|
||||||
|
|
||||||
|
#include "spdylay_config.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
|
@ -29,6 +29,12 @@
|
|||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#ifdef KEVENT_UDATA_INTPTR_T
|
||||||
|
# define PTR_TO_UDATA(X) (reinterpret_cast<intptr_t>(X))
|
||||||
|
#else // !KEVENT_UDATA_INTPTR_T
|
||||||
|
# define PTR_TO_UDATA(X) (X)
|
||||||
|
#endif // !KEVENT_UDATA_INTPTR_T
|
||||||
|
|
||||||
namespace spdylay {
|
namespace spdylay {
|
||||||
|
|
||||||
EventPoll::EventPoll(size_t max_events)
|
EventPoll::EventPoll(size_t max_events)
|
||||||
@ -74,7 +80,7 @@ int EventPoll::get_num_events()
|
|||||||
|
|
||||||
void* EventPoll::get_user_data(size_t p)
|
void* EventPoll::get_user_data(size_t p)
|
||||||
{
|
{
|
||||||
return evlist_[p].udata;
|
return reinterpret_cast<void*>(evlist_[p].udata);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EventPoll::get_events(size_t p)
|
int EventPoll::get_events(size_t p)
|
||||||
@ -96,10 +102,10 @@ int update_event(int kq, int fd, int events, void *user_data)
|
|||||||
struct kevent changelist[2];
|
struct kevent changelist[2];
|
||||||
EV_SET(&changelist[0], fd, EVFILT_READ,
|
EV_SET(&changelist[0], fd, EVFILT_READ,
|
||||||
EV_ADD | ((events & EP_POLLIN) ? EV_ENABLE : EV_DISABLE),
|
EV_ADD | ((events & EP_POLLIN) ? EV_ENABLE : EV_DISABLE),
|
||||||
0, 0, user_data);
|
0, 0, PTR_TO_UDATA(user_data));
|
||||||
EV_SET(&changelist[1], fd, EVFILT_WRITE,
|
EV_SET(&changelist[1], fd, EVFILT_WRITE,
|
||||||
EV_ADD | ((events & EP_POLLOUT) ? EV_ENABLE : EV_DISABLE),
|
EV_ADD | ((events & EP_POLLOUT) ? EV_ENABLE : EV_DISABLE),
|
||||||
0, 0, user_data);
|
0, 0, PTR_TO_UDATA(user_data));
|
||||||
timespec ts = { 0, 0 };
|
timespec ts = { 0, 0 };
|
||||||
return kevent(kq, changelist, 2, changelist, 0, &ts);
|
return kevent(kq, changelist, 2, changelist, 0, &ts);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef EVENT_POLL_KQUEUE_H
|
#ifndef EVENT_POLL_KQUEUE_H
|
||||||
#define EVENT_POLL_KQUEUE_H
|
#define EVENT_POLL_KQUEUE_H
|
||||||
|
|
||||||
|
#include "spdylay_config.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -25,9 +25,7 @@
|
|||||||
#ifndef HTML_PARSER_H
|
#ifndef HTML_PARSER_H
|
||||||
#define HTML_PARSER_H
|
#define HTML_PARSER_H
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#include "spdylay_config.h"
|
||||||
# include <config.h>
|
|
||||||
#endif // HAVE_CONFIG_H
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -36,7 +36,7 @@ bin_PROGRAMS += shrpx
|
|||||||
endif # HAVE_LIBEVENT_OPENSSL
|
endif # HAVE_LIBEVENT_OPENSSL
|
||||||
|
|
||||||
HELPER_OBJECTS = uri.cc util.cc spdylay_ssl.cc
|
HELPER_OBJECTS = uri.cc util.cc spdylay_ssl.cc
|
||||||
HELPER_HFILES = uri.h util.h spdylay_ssl.h
|
HELPER_HFILES = uri.h util.h spdylay_ssl.h spdylay_config.h
|
||||||
|
|
||||||
EVENT_OBJECTS =
|
EVENT_OBJECTS =
|
||||||
EVENT_HFILES = EventPoll.h EventPollEvent.h
|
EVENT_HFILES = EventPoll.h EventPollEvent.h
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef SPDY_SERVER_H
|
#ifndef SPDY_SERVER_H
|
||||||
#define SPDY_SERVER_H
|
#define SPDY_SERVER_H
|
||||||
|
|
||||||
|
#include "spdylay_config.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
@ -569,9 +569,8 @@ int SpdyUpstream::rst_stream(Downstream *downstream, int status_code)
|
|||||||
LOG(FATAL) << "spdylay_submit_rst_stream() failed: "
|
LOG(FATAL) << "spdylay_submit_rst_stream() failed: "
|
||||||
<< spdylay_strerror(rv);
|
<< spdylay_strerror(rv);
|
||||||
DIE();
|
DIE();
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SpdyUpstream::window_update(Downstream *downstream)
|
int SpdyUpstream::window_update(Downstream *downstream)
|
||||||
@ -584,9 +583,8 @@ int SpdyUpstream::window_update(Downstream *downstream)
|
|||||||
LOG(FATAL) << "spdylay_submit_window_update() failed: "
|
LOG(FATAL) << "spdylay_submit_window_update() failed: "
|
||||||
<< spdylay_strerror(rv);
|
<< spdylay_strerror(rv);
|
||||||
DIE();
|
DIE();
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -645,9 +643,8 @@ int SpdyUpstream::error_reply(Downstream *downstream, int status_code)
|
|||||||
LOG(FATAL) << "spdylay_submit_response() failed: "
|
LOG(FATAL) << "spdylay_submit_response() failed: "
|
||||||
<< spdylay_strerror(rv);
|
<< spdylay_strerror(rv);
|
||||||
DIE();
|
DIE();
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferevent_data_cb SpdyUpstream::get_downstream_readcb()
|
bufferevent_data_cb SpdyUpstream::get_downstream_readcb()
|
||||||
|
@ -22,6 +22,11 @@
|
|||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
#ifndef SPDY_H
|
||||||
|
#define SPDY_H
|
||||||
|
|
||||||
|
#include "spdylay_config.h"
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -232,3 +237,5 @@ int run(Server& server)
|
|||||||
} // namespace reactor
|
} // namespace reactor
|
||||||
|
|
||||||
} // namespace spdylay
|
} // namespace spdylay
|
||||||
|
|
||||||
|
#endif // SPDY_H
|
||||||
|
@ -22,9 +22,7 @@
|
|||||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CONFIG_H
|
#include "spdylay_config.h"
|
||||||
# include <config.h>
|
|
||||||
#endif // HAVE_CONFIG_H
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
32
examples/spdylay_config.h
Normal file
32
examples/spdylay_config.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Spdylay - SPDY 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 SPDYLAY_CONFIG_H
|
||||||
|
#define SPDYLAY_CONFIG_H
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#endif // SPDYLAY_CONFIG_H
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef SPDYLAY_SSL_H
|
#ifndef SPDYLAY_SSL_H
|
||||||
#define SPDYLAY_SSL_H
|
#define SPDYLAY_SSL_H
|
||||||
|
|
||||||
|
#include "spdylay_config.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef URI_H
|
#ifndef URI_H
|
||||||
#define URI_H
|
#define URI_H
|
||||||
|
|
||||||
|
#include "spdylay_config.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef UTIL_H
|
#ifndef UTIL_H
|
||||||
#define UTIL_H
|
#define UTIL_H
|
||||||
|
|
||||||
|
#include "spdylay_config.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -349,7 +349,7 @@ int spdylay_session_add_frame(spdylay_session *session,
|
|||||||
void *abs_frame,
|
void *abs_frame,
|
||||||
void *aux_data)
|
void *aux_data)
|
||||||
{
|
{
|
||||||
int r;
|
int r = 0;
|
||||||
spdylay_outbound_item *item;
|
spdylay_outbound_item *item;
|
||||||
item = malloc(sizeof(spdylay_outbound_item));
|
item = malloc(sizeof(spdylay_outbound_item));
|
||||||
if(item == NULL) {
|
if(item == NULL) {
|
||||||
@ -929,7 +929,7 @@ int spdylay_session_prep_credential(spdylay_session *session,
|
|||||||
static ssize_t spdylay_session_prep_frame(spdylay_session *session,
|
static ssize_t spdylay_session_prep_frame(spdylay_session *session,
|
||||||
spdylay_outbound_item *item)
|
spdylay_outbound_item *item)
|
||||||
{
|
{
|
||||||
ssize_t framebuflen;
|
ssize_t framebuflen = 0;
|
||||||
if(item->frame_cat == SPDYLAY_CTRL) {
|
if(item->frame_cat == SPDYLAY_CTRL) {
|
||||||
spdylay_frame *frame;
|
spdylay_frame *frame;
|
||||||
spdylay_frame_type frame_type;
|
spdylay_frame_type frame_type;
|
||||||
|
@ -46,7 +46,7 @@ main_LDFLAGS = -static @CUNIT_LIBS@
|
|||||||
failmalloc_SOURCES = failmalloc.c failmalloc_test.c failmalloc_test.h \
|
failmalloc_SOURCES = failmalloc.c failmalloc_test.c failmalloc_test.h \
|
||||||
malloc_wrapper.c malloc_wrapper.h \
|
malloc_wrapper.c malloc_wrapper.h \
|
||||||
spdylay_test_helper.c spdylay_test_helper.h
|
spdylay_test_helper.c spdylay_test_helper.h
|
||||||
failmalloc_LDADD = $(main_LDADD) -ldl
|
failmalloc_LDADD = $(main_LDADD)
|
||||||
failmalloc_LDFLAGS = $(main_LDFLAGS)
|
failmalloc_LDFLAGS = $(main_LDFLAGS)
|
||||||
|
|
||||||
AM_CFLAGS = -Wall -I${top_srcdir}/lib -I${top_srcdir}/lib/includes -I${top_builddir}/lib/includes \
|
AM_CFLAGS = -Wall -I${top_srcdir}/lib -I${top_srcdir}/lib/includes -I${top_builddir}/lib/includes \
|
||||||
|
Loading…
Reference in New Issue
Block a user