Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sys/kern Pull up following revision(s) (requested by chri...



details:   https://anonhg.NetBSD.org/src/rev/dce0e9229844
branches:  netbsd-6
changeset: 774476:dce0e9229844
user:      riz <riz%NetBSD.org@localhost>
date:      Mon Aug 20 19:15:36 2012 +0000

description:
Pull up following revision(s) (requested by christos in ticket #516):
        sys/kern/tty.c: revision 1.251
        sys/kern/tty.c: revision 1.252
        sys/kern/tty.c: revision 1.253
Better (not racy fix) from Paul Goyette.
Use the queue of the tty not garbage from the stack (Paul Goyette)
PR/46780: Dennis Ferguson: Take the easy way out and return EBUSY when changing
the queue size if the output queue is not empty. Other solutions seemed too
complex/fragile.

diffstat:

 sys/kern/tty.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (60 lines):

diff -r 6e8d1234bdb7 -r dce0e9229844 sys/kern/tty.c
--- a/sys/kern/tty.c    Sun Aug 19 17:47:18 2012 +0000
+++ b/sys/kern/tty.c    Mon Aug 20 19:15:36 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.249.8.1 2012/03/19 23:23:10 riz Exp $        */
+/*     $NetBSD: tty.c,v 1.249.8.2 2012/08/20 19:15:36 riz Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.249.8.1 2012/03/19 23:23:10 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.249.8.2 2012/08/20 19:15:36 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -224,7 +224,7 @@
        return 0;
 }
 
-static void
+static int
 tty_set_qsize(struct tty *tp, int newsize)
 {
        struct clist rawq, canq, outq;
@@ -236,6 +236,14 @@
 
        mutex_spin_enter(&tty_lock);
 
+       if (tp->t_outq.c_cc != 0) {
+               mutex_spin_exit(&tty_lock);
+               clfree(&rawq);
+               clfree(&canq);
+               clfree(&outq);
+               return EBUSY;
+       }
+
        orawq = tp->t_rawq;
        ocanq = tp->t_canq;
        ooutq = tp->t_outq;
@@ -252,6 +260,8 @@
        clfree(&orawq);
        clfree(&ocanq);
        clfree(&ooutq);
+
+       return 0;
 }
 
 static int
@@ -1350,7 +1360,7 @@
        case TIOCSQSIZE:
                if ((error = tty_get_qsize(&s, *(int *)data)) == 0 &&
                    s != tp->t_qsize)
-                       tty_set_qsize(tp, s);
+                       error = tty_set_qsize(tp, s);
                return error;
        default:
                /* We may have to load the compat module for this. */



Home | Main Index | Thread Index | Old Index