$NetBSD: patch-bg,v 1.2 2012/02/15 19:43:51 hans Exp $

--- src/timer/timer_hw.c.orig	2008-10-29 08:42:10.000000000 -0400
+++ src/timer/timer_hw.c
@@ -72,11 +72,14 @@ static int snd_timer_hw_nonblock(snd_tim
 
 static int snd_timer_hw_async(snd_timer_t *timer, int sig, pid_t pid)
 {
+#ifndef __sun
 	long flags;
+#endif
 	int fd;
 
 	assert(timer);
 	fd = timer->poll_fd;
+#ifndef __sun
 	if ((flags = fcntl(fd, F_GETFL)) < 0) {
 		SYSERR("F_GETFL failed");
 		return -errno;
@@ -89,12 +92,22 @@ static int snd_timer_hw_async(snd_timer_
 		SYSERR("F_SETFL for O_ASYNC failed");
 		return -errno;
 	}
+#endif
 	if (sig < 0)
 		return 0;
+#ifndef __sun
+#ifdef F_SETSIG
 	if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
 		SYSERR("F_SETSIG failed");
 		return -errno;
 	}
+#else
+	if (fcntl(fd, F_SETFL, O_ASYNC) < 0) {
+		SYSERR("F_SETFL failed");
+		return -errno;
+	}
+#endif
+#endif
 	if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
 		SYSERR("F_SETOWN failed");
 		return -errno;
