summaryrefslogtreecommitdiff
path: root/audio/pulseaudio
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2008-03-02 06:03:38 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2008-03-02 06:03:38 +0000
commit864ba2de5d45e50f2705f24da18a82052dcada77 (patch)
treec465fcf16d5e25bba615eb622453191a7935a130 /audio/pulseaudio
parent- Fix USE_GNOME (diff)
Port the atomic_fetchadd_int function for use on 5.X.
Reported by: pointyhat via pav
Notes
Notes: svn path=/head/; revision=208305
Diffstat (limited to 'audio/pulseaudio')
-rw-r--r--audio/pulseaudio/files/patch-src_pulsecore_atomic.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/audio/pulseaudio/files/patch-src_pulsecore_atomic.h b/audio/pulseaudio/files/patch-src_pulsecore_atomic.h
index e0d268727181..c63829b7e912 100644
--- a/audio/pulseaudio/files/patch-src_pulsecore_atomic.h
+++ b/audio/pulseaudio/files/patch-src_pulsecore_atomic.h
@@ -1,6 +1,6 @@
--- src/pulsecore/atomic.h.orig 2008-01-23 19:44:20.000000000 -0500
-+++ src/pulsecore/atomic.h 2008-02-25 14:02:59.000000000 -0500
-@@ -106,6 +106,76 @@ static inline int pa_atomic_ptr_cmpxchg(
++++ src/pulsecore/atomic.h 2008-03-02 01:02:20.000000000 -0500
+@@ -106,6 +106,108 @@ static inline int pa_atomic_ptr_cmpxchg(
return __sync_bool_compare_and_swap(&a->value, (long) old_p, (long) new_p);
}
@@ -8,8 +8,40 @@
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
++#include <sys/param.h>
+#include <machine/atomic.h>
+
++#if __FreeBSD_version < 600000
++#if defined(__i386__) || defined(__amd64__)
++static inline u_int
++atomic_fetchadd_int(volatile u_int *p, u_int v)
++{
++ __asm __volatile(
++ " " MPLOCKED " "
++ " xaddl %0, %1 ; "
++ "# atomic_fetchadd_int"
++ : "+r" (v),
++ "=m" (*p)
++ : "m" (*p));
++
++ return (v);
++}
++#elif defined(__sparc64__)
++#define atomic_fetchadd_int atomic_add_int
++#elif defined(__ia64__)
++static inline uint32_t
++atomic_fetchadd_int(volatile uint32_t *p, uint32_t v)
++{
++ uint32_t value;
++
++ do {
++ value = *p;
++ } while (!atomic_cmpset_32(p, value, value + v));
++ return (value);
++}
++#endif
++#endif
++
+typedef struct pa_atomic {
+ volatile unsigned long value;
+} pa_atomic_t;