Make putc and b_to_q deal with clists with no reserved blocks in a more

civilised manner than panicing.  This only happens as a result of another
state botch somewhere else, eg: from a tty driver calling putc or b_to_q
on a closed device.  Apparently, it's also been implicated in a panic
with a status (^T) event on ptys.

This change should pretty well be in it's final form now.
This commit is contained in:
Peter Wemm 1995-11-02 08:37:22 +00:00
parent 23922ccaca
commit 0839e0de72
2 changed files with 10 additions and 26 deletions

View File

@ -6,7 +6,7 @@
* of this software, nor does the author assume any responsibility
* for damages incurred with its use.
*
* $Id: tty_subr.c,v 1.15 1995/10/31 19:00:00 peter Exp $
* $Id: tty_subr.c,v 1.16 1995/11/01 15:59:55 peter Exp $
*/
/*
@ -351,12 +351,8 @@ putc(chr, clistp)
if (clistp->c_cl == NULL) {
if (clistp->c_cbreserved < 1) {
splx(s);
printf("putc to a clist with no reserved cblocks: data discarded.\n");
#ifdef DIAGNOSTIC
Debugger("putc to clist with no reserved cblocks");
#endif
/* black-hole the character */
return (0);
printf("putc to a clist with no reserved cblocks\n");
return (-1); /* nothing done */
}
cblockp = cblock_alloc();
clistp->c_cbcount = 1;
@ -434,12 +430,8 @@ b_to_q(src, amount, clistp)
if (clistp->c_cl == NULL) {
if (clistp->c_cbreserved < 1) {
splx(s);
printf("b_to_q to a clist with no reserved cblocks: data discarded.\n");
#ifdef DIAGNOSTIC
Debugger("b_to_q to clist with no reserved cblocks");
#endif
/* black-hole the characters */
return (0);
printf("b_to_q to a clist with no reserved cblocks.\n");
return (amount); /* nothing done */
}
cblockp = cblock_alloc();
clistp->c_cbcount = 1;

View File

@ -6,7 +6,7 @@
* of this software, nor does the author assume any responsibility
* for damages incurred with its use.
*
* $Id: tty_subr.c,v 1.15 1995/10/31 19:00:00 peter Exp $
* $Id: tty_subr.c,v 1.16 1995/11/01 15:59:55 peter Exp $
*/
/*
@ -351,12 +351,8 @@ putc(chr, clistp)
if (clistp->c_cl == NULL) {
if (clistp->c_cbreserved < 1) {
splx(s);
printf("putc to a clist with no reserved cblocks: data discarded.\n");
#ifdef DIAGNOSTIC
Debugger("putc to clist with no reserved cblocks");
#endif
/* black-hole the character */
return (0);
printf("putc to a clist with no reserved cblocks\n");
return (-1); /* nothing done */
}
cblockp = cblock_alloc();
clistp->c_cbcount = 1;
@ -434,12 +430,8 @@ b_to_q(src, amount, clistp)
if (clistp->c_cl == NULL) {
if (clistp->c_cbreserved < 1) {
splx(s);
printf("b_to_q to a clist with no reserved cblocks: data discarded.\n");
#ifdef DIAGNOSTIC
Debugger("b_to_q to clist with no reserved cblocks");
#endif
/* black-hole the characters */
return (0);
printf("b_to_q to a clist with no reserved cblocks.\n");
return (amount); /* nothing done */
}
cblockp = cblock_alloc();
clistp->c_cbcount = 1;