asterisk port tweaks:

- use getthrid to record TID (this is displayed following the opaque thread
id in "core show threads", and is useful to match against top -H output)

- provide a -kqueue package for res_timing_kqueue (previously @comment'ed
out). Normally a pthread-backed timer is used in the package; the kqueue-backed
timer is built by default but has had problems on OpenBSD in the past so is
@comment'ed out. I wouldn't consider this production ready on OpenBSD (lots
of "kqueue_timer_ack: [18]: Missed 1" at least on a kernel with standard HZ)
but I'd like to have it more easily available for experimentation, hence
adding the package.
This commit is contained in:
sthen 2020-01-19 21:35:24 +00:00
parent e6a42a1a97
commit 835fa8ff45
5 changed files with 41 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.312 2020/01/16 21:24:19 sthen Exp $
# $OpenBSD: Makefile,v 1.313 2020/01/19 21:35:24 sthen Exp $
COMMENT-main= open source multi-protocol PBX and telephony toolkit
@ -7,6 +7,7 @@ PJ_V= 2.9
DISTNAME= asterisk-${VER:S/beta/-beta/:S/rc/-rc/}
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} pjproject-${PJ_V}.tar.bz2:0
PKGNAME-main= asterisk-${VER}
REVISION-main= 0
.if ${MACHINE_ARCH} == i386
# i386 issue linking libasteriskpj.so.0.0:
@ -34,6 +35,7 @@ WANTLIB-main += spandsp sqlite3 srtp2 ssl tiff uriparser unbound uuid
WANTLIB-main += vorbis vorbisenc vorbisfile xml2 xslt z
DEBUG_PACKAGES= ${BUILD_PACKAGES}
DPB_PROPERTIES= parallel
# Asterisk requires either nested functions (gcc extension), or -fblocks (clang).
# However -fblocks fails:
@ -56,9 +58,9 @@ COMPILER= ports-gcc
SHARED_LIBS+= asteriskssl 0.0 # 1
SHARED_LIBS+= asteriskpj 0.0 # 2
MULTI_PACKAGES= -main -calendar -http_post -ldap -odbc \
MULTI_PACKAGES= -main -calendar -http_post -kqueue -ldap -odbc \
-pgsql -snmp -speex -tds
PSEUDO_FLAVORS= ${MULTI_PACKAGES:N-main:C/-/no_/g}
PSEUDO_FLAVORS= ${MULTI_PACKAGES:N-main:N-kqueue:C/-/no_/g}
LIB_DEPENDS-main= ${MODGCC4_CPPLIBDEP} \
audio/gsm \
@ -210,6 +212,11 @@ CONFIGURE_ARGS+= --with-tds=no
CONFIGURE_ARGS+= --with-tds=${LOCALBASE}
.endif
# kqueue
COMMENT-kqueue= kqueue-backed timer for Asterisk
LIB_DEPENDS-kqueue=
WANTLIB-kqueue= pthread
# odbc
COMMENT-odbc= ODBC support for Asterisk
LIB_DEPENDS-odbc= databases/iodbc

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-main_utils_c,v 1.4 2020/01/19 21:35:24 sthen Exp $
Index: main/utils.c
--- main/utils.c.orig
+++ main/utils.c
@@ -2336,6 +2336,8 @@ int ast_get_tid(void)
long lwpid;
thr_self(&lwpid); /* available since sys/thr.h creation 2003 */
ret = lwpid;
+#elif defined(__OpenBSD__)
+ ret = getthrid();
#endif
return ret;
}

View File

@ -0,0 +1,14 @@
kqueue-backed timer module for Asterisk.
Timing is a fundamental part of Asterisk. It has multiple timing
modules available for various OS. For OpenBSD, the options are pthread or
kqueue-backed timers.
Normally, the pthread-backed timer performs best, and this is included
in the main package.
This package provides the kqueue timer to make it easier for those
wishing to EXPERIMENT with it (possibly on a kernel built with a higher
HZ value).
Use the "timing test" cli command to investigate performance.

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PLIST-kqueue,v 1.1 2020/01/19 21:35:24 sthen Exp $
@so lib/asterisk/modules/res_timing_kqueue.so

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-main,v 1.83 2019/12/27 13:27:50 sthen Exp $
@comment $OpenBSD: PLIST-main,v 1.84 2020/01/19 21:35:24 sthen Exp $
@conflict asterisk-sounds-<=1.2.1p2
@conflict asterisk-curl-*
@conflict asterisk-fax-*
@ -528,7 +528,6 @@ lib/asterisk/modules/
@so lib/asterisk/modules/res_stasis_snoop.so
@so lib/asterisk/modules/res_statsd.so
@so lib/asterisk/modules/res_stun_monitor.so
@comment lib/asterisk/modules/res_timing_kqueue.so
@so lib/asterisk/modules/res_timing_pthread.so
@so lib/asterisk/modules/res_xmpp.so
@comment lib/libasteriskpj.so