aboutsummaryrefslogtreecommitdiffstats
path: root/lang
diff options
context:
space:
mode:
authorscheidell <scheidell@FreeBSD.org>2012-04-09 19:54:04 +0800
committerscheidell <scheidell@FreeBSD.org>2012-04-09 19:54:04 +0800
commit46a125de415304691b0e40182b2cadd5f62309d1 (patch)
tree7243aecc15a08ed05bb189046132df43102db777 /lang
parentae93984fcb07b3ec36dabcae59490e6f8eb89953 (diff)
downloadfreebsd-ports-graphics-46a125de415304691b0e40182b2cadd5f62309d1.tar.gz
freebsd-ports-graphics-46a125de415304691b0e40182b2cadd5f62309d1.tar.zst
freebsd-ports-graphics-46a125de415304691b0e40182b2cadd5f62309d1.zip
- Fix suggested by upstream. Revise mutex initializer patch to avoid deadlocks
- Bump PORTREVISION PR: ports/166778 Submitted by: Timothy Beyer <beyert@cs.ucr.edu> (maintainer) Feature safe: yes
Diffstat (limited to 'lang')
-rw-r--r--lang/urweb/Makefile1
-rw-r--r--lang/urweb/files/patch-Makefile.am8
-rw-r--r--lang/urweb/files/patch-Makefile.in11
-rw-r--r--lang/urweb/files/patch-urweb.c48
4 files changed, 44 insertions, 24 deletions
diff --git a/lang/urweb/Makefile b/lang/urweb/Makefile
index 0e560ce7ee3..87263ce0729 100644
--- a/lang/urweb/Makefile
+++ b/lang/urweb/Makefile
@@ -6,6 +6,7 @@
PORTNAME= urweb
PORTVERSION= 20120329
+PORTREVISION= 1
CATEGORIES= lang www
MASTER_SITES= http://www.impredicative.com/ur/
EXTRACT_SUFX= .tgz
diff --git a/lang/urweb/files/patch-Makefile.am b/lang/urweb/files/patch-Makefile.am
deleted file mode 100644
index 91b41adb24d..00000000000
--- a/lang/urweb/files/patch-Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
---- src/c/Makefile.am.orig 2012-03-29 08:09:43.000000000 -0700
-+++ src/c/Makefile.am 2012-04-04 00:52:39.000000000 -0700
-@@ -7,4 +7,4 @@
- liburweb_static_la_SOURCES = static.c
-
- AM_CPPFLAGS = -I../../include @OPENSSL_INCLUDES@
--AM_CFLAGS = -Wimplicit -Wall -Werror -Wno-format-security -Wno-deprecated-declarations
-+AM_CFLAGS = -Wimplicit -Wall -Wno-format-security -Wno-deprecated-declarations
diff --git a/lang/urweb/files/patch-Makefile.in b/lang/urweb/files/patch-Makefile.in
deleted file mode 100644
index 2812b07a9cf..00000000000
--- a/lang/urweb/files/patch-Makefile.in
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/c/Makefile.in.orig 2012-03-29 08:09:43.000000000 -0700
-+++ src/c/Makefile.in 2012-04-04 00:52:43.000000000 -0700
-@@ -254,7 +254,7 @@
- liburweb_fastcgi_la_SOURCES = fastcgi.c
- liburweb_static_la_SOURCES = static.c
- AM_CPPFLAGS = -I../../include @OPENSSL_INCLUDES@
--AM_CFLAGS = -Wimplicit -Wall -Werror -Wno-format-security -Wno-deprecated-declarations
-+AM_CFLAGS = -Wimplicit -Wall -Wno-format-security -Wno-deprecated-declarations
- all: all-am
-
- .SUFFIXES:
diff --git a/lang/urweb/files/patch-urweb.c b/lang/urweb/files/patch-urweb.c
index 2d56700ba5f..83482c9aaa5 100644
--- a/lang/urweb/files/patch-urweb.c
+++ b/lang/urweb/files/patch-urweb.c
@@ -1,16 +1,54 @@
---- src/c/urweb.c.orig 2012-03-29 08:09:43.000000000 -0700
-+++ src/c/urweb.c 2012-04-04 00:55:17.000000000 -0700
-@@ -160,12 +160,7 @@
+--- src/c/urweb.c.orig Thu Mar 29 11:23:35 2012 -0400
++++ src/c/urweb.c Sun Apr 08 13:47:57 2012 -0700
+@@ -159,13 +159,7 @@
+ static client **clients, *clients_free, *clients_used;
static unsigned n_clients;
- static pthread_mutex_t clients_mutex =
+-static pthread_mutex_t clients_mutex =
- #ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER
- PTHREAD_RECURSIVE_MUTEX_INITIALIZER
- #else
- PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
- #endif
- ;
-+PTHREAD_MUTEX_INITIALIZER;
++static pthread_mutex_t clients_mutex = PTHREAD_MUTEX_INITIALIZER;
size_t uw_messages_max = SIZE_MAX;
size_t uw_clients_max = SIZE_MAX;
+@@ -230,20 +224,23 @@
+ }
+
+ static const char begin_msgs[] = "Content-type: text/plain\r\n\r\n";
++static pthread_t pruning_thread;
++static int pruning_thread_initialized = 0;
+
+ static client *find_client(unsigned id) {
+ client *c;
+-
+- pthread_mutex_lock(&clients_mutex);
++ int i_am_pruner = pruning_thread_initialized && pthread_equal(pruning_thread, pthread_self());
++
++ if (!i_am_pruner) pthread_mutex_lock(&clients_mutex);
+
+ if (id >= n_clients) {
+- pthread_mutex_unlock(&clients_mutex);
++ if (!i_am_pruner) pthread_mutex_unlock(&clients_mutex);
+ return NULL;
+ }
+
+ c = clients[id];
+
+- pthread_mutex_unlock(&clients_mutex);
++ if (!i_am_pruner) pthread_mutex_unlock(&clients_mutex);
+ return c;
+ }
+
+@@ -3291,6 +3288,8 @@
+ cutoff = time(NULL) - ctx->app->timeout;
+
+ pthread_mutex_lock(&clients_mutex);
++ pruning_thread = pthread_self();
++ pruning_thread_initialized = 1;
+
+ for (c = clients_used; c; c = next) {
+ next = c->next;