Sat Dec 20 17:53:51 2008 UTC ()
Make NetBSD native atomic ops support work.


(jmcneill)
diff -r1.4 -r1.5 pkgsrc/audio/pulseaudio/distinfo
diff -r1.1 -r1.2 pkgsrc/audio/pulseaudio/patches/patch-bb

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

--- pkgsrc/audio/pulseaudio/distinfo 2008/12/20 16:50:50 1.4
+++ pkgsrc/audio/pulseaudio/distinfo 2008/12/20 17:53:51 1.5
@@ -1,13 +1,13 @@ @@ -1,13 +1,13 @@
1$NetBSD: distinfo,v 1.4 2008/12/20 16:50:50 jmcneill Exp $ 1$NetBSD: distinfo,v 1.5 2008/12/20 17:53:51 jmcneill Exp $
2 2
3SHA1 (pulseaudio-0.9.13.tar.gz) = c8482f1bb42d5213bfdbe2154e1a55b7bc04c915 3SHA1 (pulseaudio-0.9.13.tar.gz) = c8482f1bb42d5213bfdbe2154e1a55b7bc04c915
4RMD160 (pulseaudio-0.9.13.tar.gz) = 07cea9939dfb4fc76f13bf01dfe22ab6d0fd8459 4RMD160 (pulseaudio-0.9.13.tar.gz) = 07cea9939dfb4fc76f13bf01dfe22ab6d0fd8459
5Size (pulseaudio-0.9.13.tar.gz) = 1308493 bytes 5Size (pulseaudio-0.9.13.tar.gz) = 1308493 bytes
6SHA1 (patch-aa) = 8cc076c1301fa90ee0bb113ec3fee885ba99fbb4 6SHA1 (patch-aa) = 8cc076c1301fa90ee0bb113ec3fee885ba99fbb4
7SHA1 (patch-ab) = b894cf1797a2f02e8131be8abc8250774bfec1ec 7SHA1 (patch-ab) = b894cf1797a2f02e8131be8abc8250774bfec1ec
8SHA1 (patch-ac) = 8f61cf7c4a6681ab53c9ddf1007acb1bf524fe15 8SHA1 (patch-ac) = 8f61cf7c4a6681ab53c9ddf1007acb1bf524fe15
9SHA1 (patch-ad) = 40474c4e04dffe836c41ff348d959c821da527fd 9SHA1 (patch-ad) = 40474c4e04dffe836c41ff348d959c821da527fd
10SHA1 (patch-ae) = 1cd31d18c133fdd5e8db59be319ba5b7a45fe0fe 10SHA1 (patch-ae) = 1cd31d18c133fdd5e8db59be319ba5b7a45fe0fe
11SHA1 (patch-af) = 31b8564cb91aabb5de5490659e77de984fd1920b 11SHA1 (patch-af) = 31b8564cb91aabb5de5490659e77de984fd1920b
12SHA1 (patch-ba) = 518d23027fc9467a8bae2385233c2991136ee905 12SHA1 (patch-ba) = 518d23027fc9467a8bae2385233c2991136ee905
13SHA1 (patch-bb) = 1a9f436c0809af35b4846d09be5ffdc25fa7daeb 13SHA1 (patch-bb) = ded51f4642163dd5f78bb51522df64cb6ef8b985

cvs diff -r1.1 -r1.2 pkgsrc/audio/pulseaudio/patches/Attic/patch-bb (expand / switch to unified diff)

--- pkgsrc/audio/pulseaudio/patches/Attic/patch-bb 2008/12/20 16:10:25 1.1
+++ pkgsrc/audio/pulseaudio/patches/Attic/patch-bb 2008/12/20 17:53:51 1.2
@@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
1$NetBSD: patch-bb,v 1.1 2008/12/20 16:10:25 ahoka Exp $ 1$NetBSD: patch-bb,v 1.2 2008/12/20 17:53:51 jmcneill Exp $
2 2
3--- src/pulsecore/atomic.h.orig 2008-09-03 23:13:44.000000000 +0200 3--- src/pulsecore/atomic.h.orig 2008-09-03 17:13:44.000000000 -0400
4+++ src/pulsecore/atomic.h 4+++ src/pulsecore/atomic.h 2008-12-20 12:35:13.000000000 -0500
5@@ -107,6 +107,81 @@ static inline pa_bool_t pa_atomic_ptr_cm 5@@ -107,6 +107,85 @@ static inline pa_bool_t pa_atomic_ptr_cm
6 return __sync_bool_compare_and_swap(&a->value, (long) old_p, (long) new_p); 6 return __sync_bool_compare_and_swap(&a->value, (long) old_p, (long) new_p);
7 } 7 }
8  8
9+#elif defined(NETBSD_ATOMIC_OPS) 9+#elif defined(NETBSD_ATOMIC_OPS)
10+ 10+
11+/* NetBSD 5.0+ atomic_ops(3) implementation */ 11+/* NetBSD 5.0+ atomic_ops(3) implementation */
12+ 12+
13+#include <sys/atomic.h> 13+#include <sys/atomic.h>
14+ 14+
15+typedef struct pa_atomic { 15+typedef struct pa_atomic {
16+ volatile unsigned int value; 16+ volatile unsigned int value;
17+} pa_atomic_t; 17+} pa_atomic_t;
18+ 18+
@@ -20,42 +20,46 @@ $NetBSD: patch-bb,v 1.1 2008/12/20 16:10 @@ -20,42 +20,46 @@ $NetBSD: patch-bb,v 1.1 2008/12/20 16:10
20+ 20+
21+static inline int pa_atomic_load(const pa_atomic_t *a) { 21+static inline int pa_atomic_load(const pa_atomic_t *a) {
22+ membar_sync(); 22+ membar_sync();
23+ return (int) a->value; 23+ return (int) a->value;
24+} 24+}
25+ 25+
26+static inline void pa_atomic_store(pa_atomic_t *a, int i) { 26+static inline void pa_atomic_store(pa_atomic_t *a, int i) {
27+ a->value = (unsigned int) i; 27+ a->value = (unsigned int) i;
28+ membar_sync(); 28+ membar_sync();
29+} 29+}
30+ 30+
31+/* Returns the previously set value */ 31+/* Returns the previously set value */
32+static inline int pa_atomic_add(pa_atomic_t *a, int i) { 32+static inline int pa_atomic_add(pa_atomic_t *a, int i) {
33+ return (int) atomic_add_int_nv(&a->value, i); 33+ int nv = (int)atomic_add_int_nv(&a->value, i);
 34+ return nv - i;
34+} 35+}
35+ 36+
36+/* Returns the previously set value */ 37+/* Returns the previously set value */
37+static inline int pa_atomic_sub(pa_atomic_t *a, int i) { 38+static inline int pa_atomic_sub(pa_atomic_t *a, int i) {
38+ return (int) atomic_add_int_nv(&a->value, -i); 39+ int nv = (int)atomic_add_int_nv(&a->value, -i);
 40+ return nv + i;
39+} 41+}
40+ 42+
41+/* Returns the previously set value */ 43+/* Returns the previously set value */
42+static inline int pa_atomic_inc(pa_atomic_t *a) { 44+static inline int pa_atomic_inc(pa_atomic_t *a) {
43+ return (int) atomic_inc_uint_nv(&a->value); 45+ int nv = (int)atomic_inc_uint_nv(&a->value);
 46+ return nv - 1;
44+} 47+}
45+ 48+
46+/* Returns the previously set value */ 49+/* Returns the previously set value */
47+static inline int pa_atomic_dec(pa_atomic_t *a) { 50+static inline int pa_atomic_dec(pa_atomic_t *a) {
48+ return (int) atomic_dec_uint_nv(&a->value); 51+ int nv = (int)atomic_dec_uint_nv(&a->value);
 52+ return nv + 1;
49+} 53+}
50+ 54+
51+/* Returns TRUE when the operation was successful. */ 55+/* Returns TRUE when the operation was successful. */
52+static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { 56+static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
53+ unsigned int r = atomic_cas_uint(&a->value, (unsigned int) old_i, (unsigned int) new_i); 57+ unsigned int r = atomic_cas_uint(&a->value, (unsigned int) old_i, (unsigned int) new_i);
54+ if ((int) r == old_i) 58+ if ((int) r == old_i)
55+ return TRUE; 59+ return TRUE;
56+ else 60+ else
57+ return FALSE; 61+ return FALSE;
58+} 62+}
59+ 63+
60+typedef struct pa_atomic_ptr { 64+typedef struct pa_atomic_ptr {
61+ volatile void *value; 65+ volatile void *value;