Module: sip-router
Branch: sr_3.0
Commit: f78a76244e9261ea6081dabeecfaf93dcc303307
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f78a762…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Aug 13 11:45:39 2010 +0200
core: DragonFly kqueue support enabled
- fixed kqueue support check for DragonFly (seems to be always
supported since it was forked from FreeBSD 4.8).
- in dragonfly case define both __OS_freebsd and __OS_dragonfly so
that we can make some exceptions for dragonfly (e.g. no >= 4.1
version check at runtime before enabling kqueue).
- assume SCTP in 2.6 is at least on par with SCTP in FreeBSD 7.1.
(cherry picked from commit c07c2b5e599a2b97fc21d04731f1f9d409859d43)
---
Makefile.defs | 27 +++++++++++++++------------
io_wait.c | 10 ++++++++--
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/Makefile.defs b/Makefile.defs
index decc247..c3614fc 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -618,18 +618,20 @@ $(info target architecture <$(ARCH)>, host architecture
<$(HOST_ARCH)>)
# adds support for Application Server interface
# Sometimes is needes correct non-quoted $OS. HACK: gcc translates known OS to number
('linux'), so there is added underscore
-# Tell it that dragonflybsd is equivalent to compiling for freebsd.
-# This will cause __OS_freebsd to be defined below.
ifeq ($(OS), dragonfly)
- EQUIV_OS := freebsd
+ # Tell it that dragonflybsd is equivalent to compiling for freebsd, but
+ # define also __OS_dragonfly (for fine-tunning like kqueue support).
+ os_defs := -D__OS_freebsd -D__OS_dragonfly
+ EQUIV_OS = freebsd
else
- EQUIV_OS := $(OS)
+ os_defs := -D__OS_$(OS)
+ EQUIV_OS = $(OS)
endif
C_DEFS= $(extra_defs) \
-DNAME='"$(MAIN_NAME)"' -DVERSION='"$(RELEASE)"'
-DARCH='"$(ARCH)"' \
-DOS='$(OS)_' -DOS_QUOTED='"$(OS)"'
-DCOMPILER='"$(CC_VER)"'\
- -D__CPU_$(ARCH) -D__OS_$(EQUIV_OS) \
+ -D__CPU_$(ARCH) $(os_defs) \
-DSER_VER=$(SER_VER) \
-DCFG_DIR='"$(cfg_target)"'\
-DPKG_MALLOC \
@@ -1806,11 +1808,9 @@ ifeq ($(OS), dragonfly)
else
LIBS= #dlopen is in libc
endif
- # check for ver >= 4.1
- ifeq ($(shell [ $(OSREL_N) -gt 4001 ] && echo has_kqueue), has_kqueue)
- ifeq ($(NO_KQUEUE),)
- C_DEFS+=-DHAVE_KQUEUE
- endif
+ # dragonfly was forked from freebsd 4.8 => all version have kqueue
+ ifeq ($(NO_KQUEUE),)
+ C_DEFS+=-DHAVE_KQUEUE
endif
ifeq ($(NO_SELECT),)
C_DEFS+=-DHAVE_SELECT
@@ -1826,8 +1826,11 @@ ifeq ($(OS), dragonfly)
$(info "sctp development files not installed -- sctp disabled")
override SCTP :=
endif
- ifeq ($(shell [ $(OSREL_N) -lt 7000 ] && echo sctp), sctp)
-$(info "old freebsd version (>= 7.0 needed) -- sctp disabled")
+ # FIXME: don't know what's the status of SCTP on dragonfly
+ # (we suppose the 2.6 version is >= the version in
+ # in freebsd 7.0)
+ ifeq ($(shell [ $(OSREL_N) -lt 2006 ] && echo sctp), sctp)
+$(info "old dragonfly version (>= 2.6 needed) -- sctp disabled")
override SCTP :=
endif
diff --git a/io_wait.c b/io_wait.c
index 1b29813..72e34ee 100644
--- a/io_wait.c
+++ b/io_wait.c
@@ -333,10 +333,13 @@ char* check_poll_method(enum poll_types poll_method)
#ifndef HAVE_KQUEUE
ret="kqueue not supported, try re-compiling with -DHAVE_KQUEUE";
#else
- /* only in FreeBSD 4.1, NETBSD 2.0, OpenBSD 2.9, Darwin */
+ /* only in FreeBSD 4.1, NETBSD 2.0, OpenBSD 2.9, Darwin, DragonFly */
#ifdef __OS_freebsd
+ /* all DragonFly versions have kqueque */
+ #ifndef __OS_dragonfly
if (_os_ver<0x0401) /* if ver < 4.1 */
ret="kqueue not supported on FreeBSD < 4.1";
+ #endif /* __OS_dragonfly */
#elif defined (__OS_netbsd)
if (_os_ver<0x020000) /* if ver < 2.0 */
ret="kqueue not supported on NetBSD < 2.0";
@@ -381,9 +384,12 @@ enum poll_types choose_poll_method()
#endif
#ifdef HAVE_KQUEUE
if (poll_method==0)
- /* only in FreeBSD 4.1, NETBSD 2.0, OpenBSD 2.9, Darwin */
+ /* only in FreeBSD 4.1, NETBSD 2.0, OpenBSD 2.9, Darwin, DragonFly */
#ifdef __OS_freebsd
+ /* all DragonFly versions have kqueque */
+ #ifndef __OS_dragonfly
if (_os_ver>=0x0401) /* if ver >= 4.1 */
+ #endif /**__OS_dragonfly
#elif defined (__OS_netbsd)
if (_os_ver>=0x020000) /* if ver >= 2.0 */
#elif defined (__OS_openbsd)