Source-Changes-HG archive

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

[src/trunk]: src/sys/kern PR/46780: Dennis Ferguson: Take the easy way out an...



details:   https://anonhg.NetBSD.org/src/rev/6cc56a9321bd
branches:  trunk
changeset: 780938:6cc56a9321bd
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Aug 12 14:45:44 2012 +0000

description:
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 |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r 14413ce47364 -r 6cc56a9321bd sys/kern/tty.c
--- a/sys/kern/tty.c    Sun Aug 12 13:41:18 2012 +0000
+++ b/sys/kern/tty.c    Sun Aug 12 14:45:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.250 2012/03/12 18:27:08 christos Exp $       */
+/*     $NetBSD: tty.c,v 1.251 2012/08/12 14:45:44 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.250 2012/03/12 18:27:08 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.251 2012/08/12 14:45:44 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -224,12 +224,15 @@
        return 0;
 }
 
-static void
+static int
 tty_set_qsize(struct tty *tp, int newsize)
 {
        struct clist rawq, canq, outq;
        struct clist orawq, ocanq, ooutq;
 
+       if (outq.c_cc != 0)
+               return EBUSY;
+
        clalloc(&rawq, newsize, 1);
        clalloc(&canq, newsize, 1);
        clalloc(&outq, newsize, 0);
@@ -252,6 +255,8 @@
        clfree(&orawq);
        clfree(&ocanq);
        clfree(&ooutq);
+
+       return 0;
 }
 
 static int
@@ -1350,7 +1355,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