$OpenBSD: patch-audio-sun_cc,v 1.1 2001/07/30 15:33:22 espie Exp $
--- audio-sun.cc.orig	Fri May  3 10:24:22 1996
+++ audio-sun.cc	Mon Jul 30 17:25:38 2001
@@ -35,14 +35,15 @@ static const char rcsid[] =
 
 #undef resource_h
 
+#include <sys/types.h>
+
 #ifdef __svr4__
 #include <sys/audioio.h>
 #include <sys/filio.h>
 #else
-#include <sun/audioio.h>
+#include <sys/audioio.h>
 #endif
 #include <unistd.h>
-#include <stropts.h>
 #include <errno.h>
 #include <fcntl.h>
 #include "audio-sun.h"
@@ -103,7 +104,7 @@ Audio* SunAudioMatcher::create()
 			 * braindead driver will supply a weird, huge
 			 * blocksize).
 			 */
-#ifndef __svr4__
+#if !defined(__svr4_) && !defined(__OpenBSD__)
 			int bs = info.record._xxx[2];
 #else
 			int bs = info.record.buffer_size;
@@ -273,7 +274,7 @@ int SUNAudio::FrameReady()
 				Obtain();
 				goto out;
 
-#ifndef __svr4__
+#if !defined(__svr4__) && !defined(__OpenBSD__)
 			case EWOULDBLOCK:
 #endif
 			case EAGAIN:
@@ -307,7 +308,7 @@ void SUNAudio::setup_device()
 		perror("audio O_NONBLOCK");
 	int on = 1;
 	ioctl(fd, FIONBIO, &on);
-#ifndef __svr4__
+#if !defined(__svr4__) && !defined(__OpenBSD__)
 	int bsddrvr = 0;
 	AUDIO_INITINFO(&info);
 	getinfo(&info);
@@ -330,7 +331,7 @@ void SUNAudio::setup_device()
 	info.record.gain = rgain;
 	info.record.port = IPort(iport);
 	info.record.balance = rbalance;
-#ifndef __svr4__
+#if !defined(__svr4__) && !defined(__OpenBSD__)
 	/* solaris 2.2 hack: set buffer size.
 	 * NB- this changes to _xxx[3] for os<4.1.3 */
 	info.record._xxx[2] = blksize;
@@ -349,7 +350,7 @@ void SUNAudio::setup_device()
 	info.monitor_gain = mgain;
 	setinfo(&info);
 	/* flush input to get rid of any data fragments */
-	ioctl(fd, I_FLUSH, FLUSHR);
+	ioctl(fd, AUDIO_FLUSH, 0);
 	bufcur = buf;
 }
 
@@ -646,7 +647,7 @@ void SUNXAudio::setup_device()
 	AUDIO_INITINFO(&info);
 	info.record.precision = 16;
 	info.record.encoding  = AUDIO_ENCODING_LINEAR;
-#ifndef __svr4__
+#if !defined(__svr4__) && !defined(__OpenBSD__)
 	info.record._xxx[2]   = blksize << 1;
 #else
 	info.record.buffer_size = blksize << 1;
@@ -655,6 +656,6 @@ void SUNXAudio::setup_device()
 	info.play.encoding    = AUDIO_ENCODING_LINEAR;
 	setinfo(&info);
 	/* flush input again to get rid of any data with wrong encoding */
-	ioctl(fd, I_FLUSH, FLUSHR);
+	ioctl(fd, AUDIO_FLUSH, 0);
 	bufcur = buf;
 }
