Sat Aug 1 16:22:26 2009 UTC ()
Hack around silly behavior that unlocks every freshly created pthread
mutex. Fixes PR 35261.


(dholland)
diff -r1.17 -r1.18 pkgsrc/cad/electric/Makefile
diff -r1.4 -r1.5 pkgsrc/cad/electric/distinfo
diff -r1.2 -r1.3 pkgsrc/cad/electric/patches/patch-ac
diff -r0 -r1.1 pkgsrc/cad/electric/patches/patch-ad
diff -r0 -r1.1 pkgsrc/cad/electric/patches/patch-ae

cvs diff -r1.17 -r1.18 pkgsrc/cad/electric/Makefile (expand / switch to unified diff)

--- pkgsrc/cad/electric/Makefile 2009/07/08 15:35:48 1.17
+++ pkgsrc/cad/electric/Makefile 2009/08/01 16:22:25 1.18
@@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
1# $NetBSD: Makefile,v 1.17 2009/07/08 15:35:48 joerg Exp $ 1# $NetBSD: Makefile,v 1.18 2009/08/01 16:22:25 dholland Exp $
2# 2#
3 3
4DISTNAME= electric-7.00 4DISTNAME= electric-7.00
5PKGREVISION= 2 5PKGREVISION= 3
6CATEGORIES= cad 6CATEGORIES= cad
7MASTER_SITES= ${MASTER_SITE_GNU:=electric/} 7MASTER_SITES= ${MASTER_SITE_GNU:=electric/}
8 8
9MAINTAINER= pkgsrc-users@NetBSD.org 9MAINTAINER= pkgsrc-users@NetBSD.org
10HOMEPAGE= http://www.gnu.org/software/electric/electric.html 10HOMEPAGE= http://www.gnu.org/software/electric/electric.html
11COMMENT= Electrical CAD system 11COMMENT= Electrical CAD system
12 12
13PKG_DESTDIR_SUPPORT= user-destdir 13PKG_DESTDIR_SUPPORT= user-destdir
14 14
15GNU_CONFIGURE= YES 15GNU_CONFIGURE= YES
16USE_LANGUAGES= c c++ 16USE_LANGUAGES= c c++
17 17
18post-patch: 18post-patch:

cvs diff -r1.4 -r1.5 pkgsrc/cad/electric/distinfo (expand / switch to unified diff)

--- pkgsrc/cad/electric/distinfo 2005/12/28 14:17:57 1.4
+++ pkgsrc/cad/electric/distinfo 2009/08/01 16:22:25 1.5
@@ -1,8 +1,10 @@ @@ -1,8 +1,10 @@
1$NetBSD: distinfo,v 1.4 2005/12/28 14:17:57 joerg Exp $ 1$NetBSD: distinfo,v 1.5 2009/08/01 16:22:25 dholland Exp $
2 2
3SHA1 (electric-7.00.tar.gz) = 782652b078e81060928eadfae364cd74da07788e 3SHA1 (electric-7.00.tar.gz) = 782652b078e81060928eadfae364cd74da07788e
4RMD160 (electric-7.00.tar.gz) = c57a2e0a32e40d435e125cad6dfc5c1b98e9067b 4RMD160 (electric-7.00.tar.gz) = c57a2e0a32e40d435e125cad6dfc5c1b98e9067b
5Size (electric-7.00.tar.gz) = 4474722 bytes 5Size (electric-7.00.tar.gz) = 4474722 bytes
6SHA1 (patch-aa) = ca3aa5c28eef818dce61055daeedc1b7d2e9a8a7 6SHA1 (patch-aa) = ca3aa5c28eef818dce61055daeedc1b7d2e9a8a7
7SHA1 (patch-ab) = f9c648dda476f1e7cd3c3e875236b76198fa317b 7SHA1 (patch-ab) = f9c648dda476f1e7cd3c3e875236b76198fa317b
8SHA1 (patch-ac) = f599a3440bb1a6402280fe4129361c13cabd38f8 8SHA1 (patch-ac) = fac49d88feab792ff665686e9e4fc8a29caab471
 9SHA1 (patch-ad) = 6be5c47ead4bf023ef6215d7bce496a2f7abb5b0
 10SHA1 (patch-ae) = 095e56c085ae77d0615134b070082f6599a95280

cvs diff -r1.2 -r1.3 pkgsrc/cad/electric/patches/patch-ac (expand / switch to unified diff)

--- pkgsrc/cad/electric/patches/patch-ac 2005/12/28 14:17:57 1.2
+++ pkgsrc/cad/electric/patches/patch-ac 2009/08/01 16:22:26 1.3
@@ -1,17 +1,21 @@ @@ -1,17 +1,21 @@
1$NetBSD: patch-ac,v 1.2 2005/12/28 14:17:57 joerg Exp $ 1$NetBSD: patch-ac,v 1.3 2009/08/01 16:22:26 dholland Exp $
2 2
3--- src/graph/graphunixx11.c.orig 2004-07-16 01:59:53.000000000 +0000 3Get number of processors for NetBSD/Dragonfly.
4+++ src/graph/graphunixx11.c 4
 5Hack around silly behavior that unlocks every newly created pthread mutex.
 6
 7--- src/graph/graphunixx11.c.orig 2004-07-15 21:59:53.000000000 -0400
 8+++ src/graph/graphunixx11.c 2009-08-01 12:17:39.000000000 -0400
5@@ -3085,11 +3085,30 @@ void ewait(INTBIG process) 9@@ -3085,11 +3085,30 @@ void ewait(INTBIG process)
6 /* 10 /*
7 * Routine to return the number of processors on this machine. 11 * Routine to return the number of processors on this machine.
8 */ 12 */
9+ 13+
10+/* XXX there should really be some sort of autoconf test here... */ 14+/* XXX there should really be some sort of autoconf test here... */
11+#if defined(__NetBSD__) || defined(__DragonFly__) 15+#if defined(__NetBSD__) || defined(__DragonFly__)
12+#include <sys/param.h> 16+#include <sys/param.h>
13+#include <sys/sysctl.h> 17+#include <sys/sysctl.h>
14+#endif 18+#endif
15+ 19+
16 INTBIG enumprocessors(void) 20 INTBIG enumprocessors(void)
17 { 21 {
@@ -23,13 +27,41 @@ $NetBSD: patch-ac,v 1.2 2005/12/28 14:17 @@ -23,13 +27,41 @@ $NetBSD: patch-ac,v 1.2 2005/12/28 14:17
23+ 27+
24+ mib[0] = CTL_HW; 28+ mib[0] = CTL_HW;
25+ mib[1] = HW_NCPU; 29+ mib[1] = HW_NCPU;
26+ len = sizeof(ncpu); 30+ len = sizeof(ncpu);
27+ sysctl(mib, 2, &ncpu, &len, NULL, 0); 31+ sysctl(mib, 2, &ncpu, &len, NULL, 0);
28+ numproc = (INTBIG) ncpu; 32+ numproc = (INTBIG) ncpu;
29+ 33+
30+#else 34+#else
31 numproc = sysconf(_SC_NPROCESSORS_ONLN); 35 numproc = sysconf(_SC_NPROCESSORS_ONLN);
32+#endif 36+#endif
33 return(numproc); 37 return(numproc);
34 } 38 }
35  39
 40@@ -3168,6 +3187,27 @@ void emutexunlock(void *vmutex)
 41 }
 42
 43 /*
 44+ * Routine that ensures mutual-exclusion object "vmutex" is unlocked.
 45+ */
 46+void emutexensureunlocked(void *vmutex)
 47+{
 48+#ifdef HAVE_PTHREAD
 49+ pthread_mutex_t *mutex;
 50+
 51+ mutex = (pthread_mutex_t *)vmutex;
 52+ if (pthread_mutex_trylock(mutex) == 0)
 53+ {
 54+ pthread_mutex_unlock(mutex);
 55+ }
 56+#else
 57+ mutex_t *mutexid;
 58+
 59+ mutexid = (mutex_t *)vmutex;
 60+ mutex_unlock(mutexid);
 61+#endif
 62+}
 63+
 64+/*
 65 * Routine to determine the list of printers and return it.
 66 * The list terminates with a zero.
 67 */

File Added: pkgsrc/cad/electric/patches/patch-ad
$NetBSD: patch-ad,v 1.1 2009/08/01 16:22:26 dholland Exp $

Hack around silly behavior that unlocks every newly created pthread mutex.

--- src/include/global.h.orig	2009-08-01 12:18:08.000000000 -0400
+++ src/include/global.h	2009-08-01 12:18:21.000000000 -0400
@@ -2404,6 +2404,7 @@ void         enewthread(void* (*function
 void        *emakemutex(void);
 void         emutexlock(void *vmutex);
 void         emutexunlock(void *vmutex);
+void         emutexensureunlocked(void *vmutex);
 CHAR       **eprinterlist(void);
 void         flushscreen(void);
 void         exitprogram(void);

File Added: pkgsrc/cad/electric/patches/patch-ae
$NetBSD: patch-ae,v 1.1 2009/08/01 16:22:26 dholland Exp $

Hack around silly behavior that unlocks every newly created pthread mutex.

--- src/db/dbcontrol.c.orig	2009-08-01 12:21:37.000000000 -0400
+++ src/db/dbcontrol.c	2009-08-01 12:22:18.000000000 -0400
@@ -499,6 +499,6 @@ BOOLEAN ensurevalidmutex(void **mutex, B
 			return(TRUE);
 		}
 	}
-	emutexunlock(*mutex);
+	emutexensureunlocked(*mutex);
 	return(FALSE);
 }