to the last delta's comment.
SCCS-vsn: sys/kern/tty_subr.c 6.5
-/* tty_subr.c 6.4 84/11/15 */
+/* tty_subr.c 6.5 84/11/15 */
#include "param.h"
#include "systm.h"
#include "param.h"
#include "systm.h"
-
- s = spl5();
- if ((cq = q->c_cl) == NULL || q->c_cc < 0) {
- if ((bp = cfreelist) == NULL)
- goto out;
- cfreelist = bp->c_next;
- cfreecount -= CBSIZE;
- bp->c_next = NULL;
- q->c_cf = cq = bp->c_info;
- }
-
- while (cc) {
+ while (cc > 0) {
+ s = spl6();
+ if ((cq = q->c_cl) == NULL || q->c_cc < 0) {
+ if ((bp = cfreelist) == NULL) {
+ splx(s);
+ break;
+ }
+ q->c_cf = cq = bp->c_info;
+ goto middle;
+ }
if (((int)cq & CROUND) == 0) {
if (((int)cq & CROUND) == 0) {
- bp = (struct cblock *) cq - 1;
- if ((bp->c_next = cfreelist) == NULL)
- goto out;
+ bp = &((struct cblock *) cq)[-1];
+ if ((bp->c_next = cfreelist) == NULL) {
+ splx(s);
+ break;
+ }
+ cq = bp->c_info;
+ middle:
cfreelist = bp->c_next;
cfreecount -= CBSIZE;
bp->c_next = NULL;
cfreelist = bp->c_next;
cfreecount -= CBSIZE;
bp->c_next = NULL;
+ acc = MIN (cc, CBSIZE);
+ else if ((acc = (char *) ((int) &cq[CBSIZE] & ~CROUND) - cq)
+ > cc)
+ acc = cc;
+ bcopy ((caddr_t)cp, cq, acc);
+ q->c_cl = &cq[acc];
+ q->c_cc += acc;
+ splx(s);
+ cp += acc;
+ cc -= acc;
-out:
- q->c_cl = cq;
- q->c_cc += acc-cc;
- splx(s);