linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [2.5] Non-blocking write can block
@ 2003-06-04  0:58 P. Benie
  2003-06-04  5:53 ` Christoph Hellwig
  0 siblings, 1 reply; 43+ messages in thread
From: P. Benie @ 2003-06-04  0:58 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Kernel Mailing List

Non-blocking writes to a tty will block if there is a blocking write
waiting for the atomic_write semaphore.

Peter

--- linux-2.5.70/drivers/char/tty_io.c.orig	2003-06-03 21:34:42.000000000 +0100
+++ linux-2.5.70/drivers/char/tty_io.c	2003-06-04 01:40:33.000000000 +0100
@@ -687,8 +687,13 @@
 {
 	ssize_t ret = 0, written = 0;

-	if (down_interruptible(&tty->atomic_write)) {
-		return -ERESTARTSYS;
+	if (file->f_flags & O_NONBLOCK) {
+		if (down_trylock(&tty->atomic_write))
+			return -EAGAIN;
+	}
+	else {
+		if (down_interruptible(&tty->atomic_write))
+			return -ERESTARTSYS;
 	}
 	if ( test_bit(TTY_NO_WRITE_SPLIT, &tty->flags) ) {
 		lock_kernel();


^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2003-06-11  0:07 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-04  0:58 [PATCH] [2.5] Non-blocking write can block P. Benie
2003-06-04  5:53 ` Christoph Hellwig
2003-06-04 14:35   ` Linus Torvalds
2003-06-04 14:58     ` P. Benie
2003-06-04 16:47     ` Alan Cox
2003-06-04 17:57       ` Linus Torvalds
2003-06-04 19:46         ` P. Benie
2003-06-04 19:56           ` Linus Torvalds
2003-06-04 20:48             ` P. Benie
2003-06-11  0:19               ` Robert White
2003-06-04 20:43           ` Hua Zhong
2003-06-04 23:42           ` Russell King
2003-06-04 23:47             ` Davide Libenzi
2003-06-04 21:29         ` Alan Cox
2003-06-04 17:14     ` Hua Zhong
2003-06-04 17:41       ` Linus Torvalds
2003-06-04 18:44         ` Hua Zhong
2003-06-04 18:47           ` P. Benie
2003-06-04 19:23             ` P. Benie
2003-06-04 19:20           ` Linus Torvalds
2003-06-04 17:53       ` Mike Dresser
2003-06-04 15:21   ` Coding standards. (Was: Re: [PATCH] [2.5] Non-blocking write can block) Timothy Miller
2003-06-07  0:12     ` Greg KH
2003-06-07  0:59       ` Alex Goddard
2003-06-09 16:24       ` Timothy Miller
2003-06-09 16:39         ` Jörn Engel
2003-06-09 17:15           ` Davide Libenzi
2003-06-09 17:33             ` Eli Carter
2003-06-09 17:49               ` Richard B. Johnson
2003-06-09 18:07                 ` Davide Libenzi
2003-06-09 18:22                   ` Jörn Engel
2003-06-09 18:55             ` Timothy Miller
2003-06-09 18:58               ` Davide Libenzi
2003-06-09 21:35                 ` David Schwartz
2003-06-09 22:55                   ` Davide Libenzi
2003-06-09 23:21                     ` Nigel Cunningham
2003-06-09 21:54                 ` Jörn Engel
2003-06-10 18:17                 ` Jesse Pollard
2003-06-10 18:41                   ` Davide Libenzi
2003-06-10 18:14               ` Jesse Pollard
2003-06-09 23:50             ` James Stevenson
2003-06-09 18:44           ` Timothy Miller
2003-06-09 22:00             ` Jörn Engel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).