From 56ff75c711ea2647095f62be91b43243ee091243 Mon Sep 17 00:00:00 2001 From: jakemsr Date: Sun, 30 Mar 2008 08:46:15 +0000 Subject: [PATCH] - restore the 10 second sleep in the watchdog thread by using nanosleep(2) instead of usleep(3), which is limited to 1 second. - stop clients from getting "zombified" after connection graph changes by ignoring errors from read(2)ing data that isn't used. --- audio/jack/Makefile | 4 ++-- audio/jack/patches/patch-jackd_engine_c | 21 +++++++++++++++------ audio/jack/patches/patch-libjack_client_c | 12 ++++++++++++ 3 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 audio/jack/patches/patch-libjack_client_c diff --git a/audio/jack/Makefile b/audio/jack/Makefile index 6b7b4a3a588..f59f79b024c 100644 --- a/audio/jack/Makefile +++ b/audio/jack/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.2 2008/03/24 21:45:14 jakemsr Exp $ +# $OpenBSD: Makefile,v 1.3 2008/03/30 08:46:15 jakemsr Exp $ SHARED_ONLY = Yes COMMENT = low latency sound server DISTNAME = jack-0.109.10.1133 -PKGNAME = ${DISTNAME}p0 +PKGNAME = ${DISTNAME}p1 SHARED_LIBS += jack 0.0 # 0.28 SHARED_LIBS += jackserver 0.0 # 0.28 diff --git a/audio/jack/patches/patch-jackd_engine_c b/audio/jack/patches/patch-jackd_engine_c index a223bca4be3..a1e3a7a326d 100644 --- a/audio/jack/patches/patch-jackd_engine_c +++ b/audio/jack/patches/patch-jackd_engine_c @@ -1,16 +1,25 @@ -$OpenBSD: patch-jackd_engine_c,v 1.1.1.1 2008/03/24 03:01:28 jakemsr Exp $ +$OpenBSD: patch-jackd_engine_c,v 1.2 2008/03/30 08:46:15 jakemsr Exp $ --- jackd/engine.c.orig Tue Mar 18 03:24:21 2008 -+++ jackd/engine.c Fri Mar 21 00:01:11 2008 -@@ -912,7 +912,7 @@ jack_watchdog_thread (void *arg) ++++ jackd/engine.c Sat Mar 29 19:15:00 2008 +@@ -908,11 +908,16 @@ static void * + jack_watchdog_thread (void *arg) + { + jack_engine_t *engine = (jack_engine_t *) arg; ++ struct timespec timo; + ++ /* JACKD_WATCHDOG_TIMEOUT is specified in msec */ ++ timo.tv_sec = JACKD_WATCHDOG_TIMEOUT / 1000; ++ timo.tv_nsec = (JACKD_WATCHDOG_TIMEOUT - (timo.tv_sec * 1000)) * 1000; ++ engine->watchdog_check = 0; while (1) { - usleep (1000 * JACKD_WATCHDOG_TIMEOUT); -+ usleep (100 * JACKD_WATCHDOG_TIMEOUT); ++ nanosleep (&timo, NULL); if (!engine->freewheeling && engine->watchdog_check == 0) { jack_error ("jackd watchdog: timeout - killing jackd"); -@@ -1468,10 +1468,8 @@ jack_server_thread (void *arg) +@@ -1468,10 +1473,8 @@ jack_server_thread (void *arg) (engine, pfd[i].fd)) { jack_error ("could not handle external" " client request"); @@ -23,7 +32,7 @@ $OpenBSD: patch-jackd_engine_c,v 1.1.1.1 2008/03/24 03:01:28 jakemsr Exp $ select does not return any error, POLLIN is true and the next read will return 0 bytes. This -@@ -1481,7 +1479,7 @@ jack_server_thread (void *arg) +@@ -1481,7 +1484,7 @@ jack_server_thread (void *arg) and remove the client. */ jack_client_disconnect(engine, pfd[i].fd); diff --git a/audio/jack/patches/patch-libjack_client_c b/audio/jack/patches/patch-libjack_client_c new file mode 100644 index 00000000000..45ec983f667 --- /dev/null +++ b/audio/jack/patches/patch-libjack_client_c @@ -0,0 +1,12 @@ +$OpenBSD: patch-libjack_client_c,v 1.1 2008/03/30 08:46:15 jakemsr Exp $ +--- libjack/client.c.orig Sat Mar 29 21:30:38 2008 ++++ libjack/client.c Sat Mar 29 21:50:43 2008 +@@ -1533,7 +1533,7 @@ jack_wake_next_client (jack_client_t* client) + jack_error ("cannot complete execution of the " + "processing graph (%s)", + strerror(errno)); +- return -1; ++ // return -1; + } + + return 0;