$NetBSD: patch-ba,v 1.8 2011/05/21 15:33:00 wiz Exp $

1. chunk:
Check NetBSD's native atomic_ops in configure even in arm case.
configure checks $host_cpu first, not $host_os on checks for
native atomic operations.
(In upstream it seems fixed to see $host_os first but
 it might still have problem around NetBSD version checks)

2. chunk:
Fix for security vulnerability reported in CVE-2009-1299, taken from here:

http://git.0pointer.de/?p=pulseaudio.git;a=patch;h=d3efa43d85ac132c6a5a416a2b6f2115f5d577ee

--- configure.ac.orig	2009-11-23 04:06:47.000000000 +0000
+++ configure.ac	2010-08-07 08:06:57.000000000 +0000
@@ -220,6 +220,10 @@
                 AC_MSG_RESULT([yes])
                 AC_DEFINE_UNQUOTED(ATOMIC_ARM_LINUX_HELPERS, 1, [special arm linux implementation])
                 need_libatomic_ops=no
+            elif test "x$pulse_target_os" = "xnetbsd" && test "x$atomic_netbsd_helpers" = "xyes"; then
+                AC_MSG_RESULT([yes])
+                AC_DEFINE_UNQUOTED(NETBSD_ATOMIC_OPS, 1, [netbsd implementation])
+                need_libatomic_ops=no
             else
                AC_MSG_RESULT([no])
                AC_CACHE_CHECK([compiler support for arm inline asm atomic operations],
@@ -424,7 +428,7 @@
 AC_FUNC_FORK
 AC_FUNC_GETGROUPS
 AC_FUNC_SELECT_ARGTYPES
-AC_CHECK_FUNCS_ONCE([chmod chown clock_gettime getaddrinfo getgrgid_r getgrnam_r \
+AC_CHECK_FUNCS_ONCE([chmod chown fstat fchown fchmod clock_gettime getaddrinfo getgrgid_r getgrnam_r \
     getpwnam_r getpwuid_r gettimeofday getuid inet_ntop inet_pton mlock nanosleep \
     pipe posix_fadvise posix_madvise posix_memalign setpgid setsid shm_open \
     sigaction sleep sysconf pthread_setaffinity_np])
