Module Name: src Committed By: christos Date: Sun Aug 12 14:45:45 UTC 2012
Modified Files: src/sys/kern: tty.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.250 -r1.251 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.250 src/sys/kern/tty.c:1.251 --- src/sys/kern/tty.c:1.250 Mon Mar 12 14:27:08 2012 +++ src/sys/kern/tty.c Sun Aug 12 10:45:44 2012 @@ -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 @@ tty_get_qsize(int *qsize, int newsize) 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 @@ tty_set_qsize(struct tty *tp, int newsiz clfree(&orawq); clfree(&ocanq); clfree(&ooutq); + + return 0; } static int @@ -1350,7 +1355,7 @@ ttioctl(struct tty *tp, u_long cmd, void 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. */