Wed Jun 17 21:34:04 2009 UTC ()
Pull up following revision(s) (requested by plunky in ticket #807):
	sys/kern/tty_pty.c: revision 1.117
Writes on the controlling tty were not being awoken from blocks,
use the correct condvar to make this happen.
this fixes PR/41566


(bouyer)
diff -r1.112 -r1.112.6.1 src/sys/kern/tty_pty.c

cvs diff -r1.112 -r1.112.6.1 src/sys/kern/tty_pty.c (expand / switch to unified diff)

--- src/sys/kern/tty_pty.c 2008/09/03 16:47:34 1.112
+++ src/sys/kern/tty_pty.c 2009/06/17 21:34:04 1.112.6.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tty_pty.c,v 1.112 2008/09/03 16:47:34 drochner Exp $ */ 1/* $NetBSD: tty_pty.c,v 1.112.6.1 2009/06/17 21:34:04 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1986, 1989, 1993 4 * Copyright (c) 1982, 1986, 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 * 30 *
31 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 31 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
32 */ 32 */
33 33
34/* 34/*
35 * Pseudo-teletype Driver 35 * Pseudo-teletype Driver
36 * (Actually two drivers, requiring two entries in 'cdevsw') 36 * (Actually two drivers, requiring two entries in 'cdevsw')
37 */ 37 */
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.112 2008/09/03 16:47:34 drochner Exp $"); 40__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.112.6.1 2009/06/17 21:34:04 bouyer Exp $");
41 41
42#include "opt_compat_sunos.h" 42#include "opt_compat_sunos.h"
43#include "opt_ptm.h" 43#include "opt_ptm.h"
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47#include <sys/ioctl.h> 47#include <sys/ioctl.h>
48#include <sys/proc.h> 48#include <sys/proc.h>
49#include <sys/tty.h> 49#include <sys/tty.h>
50#include <sys/stat.h> 50#include <sys/stat.h>
51#include <sys/file.h> 51#include <sys/file.h>
52#include <sys/kernel.h> 52#include <sys/kernel.h>
53#include <sys/vnode.h> 53#include <sys/vnode.h>
@@ -769,27 +769,27 @@ block: @@ -769,27 +769,27 @@ block:
769 */ 769 */
770 if (!ISSET(tp->t_state, TS_CARR_ON)) { 770 if (!ISSET(tp->t_state, TS_CARR_ON)) {
771 /* adjust for data copied in but not written */ 771 /* adjust for data copied in but not written */
772 uio->uio_resid += cc; 772 uio->uio_resid += cc;
773 error = EIO; 773 error = EIO;
774 goto out; 774 goto out;
775 } 775 }
776 if (flag & IO_NDELAY) { 776 if (flag & IO_NDELAY) {
777 /* adjust for data copied in but not written */ 777 /* adjust for data copied in but not written */
778 uio->uio_resid += cc; 778 uio->uio_resid += cc;
779 error = cnt == 0 ? EWOULDBLOCK : 0; 779 error = cnt == 0 ? EWOULDBLOCK : 0;
780 goto out; 780 goto out;
781 } 781 }
782 error = cv_wait_sig(&tp->t_rawcv, &tty_lock); 782 error = cv_wait_sig(&tp->t_rawcvf, &tty_lock);
783 mutex_spin_exit(&tty_lock); 783 mutex_spin_exit(&tty_lock);
784 if (error) { 784 if (error) {
785 /* adjust for data copied in but not written */ 785 /* adjust for data copied in but not written */
786 uio->uio_resid += cc; 786 uio->uio_resid += cc;
787 return (error); 787 return (error);
788 } 788 }
789 goto again; 789 goto again;
790 790
791out: 791out:
792 mutex_spin_exit(&tty_lock); 792 mutex_spin_exit(&tty_lock);
793 return (error); 793 return (error);
794} 794}
795 795