patch-2.1.132 linux/drivers/sound/midibuf.c

Next file: linux/drivers/sound/msnd.h
Previous file: linux/drivers/sound/lowlevel/awe_wave.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.131/linux/drivers/sound/midibuf.c linux/drivers/sound/midibuf.c
@@ -40,7 +40,7 @@
 
 struct midi_parms
 {
-	int prech_timeout;	/*
+	long prech_timeout;	/*
 				 * Timeout before the first ch
 				 */
 };
@@ -282,8 +282,14 @@
 		n = SPACE_AVAIL(midi_out_buf[dev]);
 
 		if (n == 0) {	/*
-				 * No space just now. We have to sleep
+				 * No space just now.
 				 */
+
+			if (file->f_flags & O_NONBLOCK) {
+				restore_flags(flags);
+				return -EAGAIN;
+			}
+
 			interruptible_sleep_on(&midi_sleeper[dev]);
 			if (signal_pending(current)) 
 			{
@@ -322,6 +328,10 @@
 	if (!DATA_AVAIL(midi_in_buf[dev])) {	/*
 						 * No data yet, wait
 						 */
+ 		if (file->f_flags & O_NONBLOCK) {
+ 			restore_flags(flags);
+ 			return -EAGAIN;
+ 		}
 		interruptible_sleep_on_timeout(&input_sleeper[dev],
 					       parms[dev].prech_timeout);
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov