Module Name: src Committed By: christos Date: Sat Aug 1 23:07:05 UTC 2009
Modified Files: src/sys/kern: tty.c Log Message: Don't return EWOULDBLOCK on an O_NONBLOCK tty file descriptor that has vmin > 0 and vtime > 0. It should be allowed to go to sleep for the sleep interval indicated in vtime. Reported by der Mouse a long while ago, and this is what other unixes do. To generate a diff of this commit: cvs rdiff -u -r1.231 -r1.232 src/sys/kern/tty.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/tty.c diff -u src/sys/kern/tty.c:1.231 src/sys/kern/tty.c:1.232 --- src/sys/kern/tty.c:1.231 Sat Apr 25 11:06:32 2009 +++ src/sys/kern/tty.c Sat Aug 1 19:07:05 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: tty.c,v 1.231 2009/04/25 15:06:32 rmind Exp $ */ +/* $NetBSD: tty.c,v 1.232 2009/08/01 23:07:05 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.231 2009/04/25 15:06:32 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.232 2009/08/01 23:07:05 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1795,9 +1795,11 @@ mutex_spin_exit(&tty_lock); return (0); /* EOF */ } - if (flag & IO_NDELAY) { - mutex_spin_exit(&tty_lock); - return (EWOULDBLOCK); + if (!has_stime || slp <= 0) { + if (flag & IO_NDELAY) { + mutex_spin_exit(&tty_lock); + return (EWOULDBLOCK); + } } error = ttysleep(tp, &tp->t_rawcv, true, slp); mutex_spin_exit(&tty_lock);