| plan 9 kernel history: overview | file list | diff list |
1990/0321/gnot/stream.c (diff list | history)
| 1990/0312/sys/src/9/gnot/stream.c:7,12 – 1990/0321/sys/src/9/gnot/stream.c:7,17 (short | long | prev | next) | ||
| 1990/03091 | #include "errno.h" #include "devtab.h" | |
| 1990/0321 | enum { Nclass=4, /* number of block classes */ Nlds=32, /* max number of pushable line disciplines */ }; | |
| 1990/0312 | /* * process end line discipline */ | |
| 1990/0312/sys/src/9/gnot/stream.c:15,36 – 1990/0321/sys/src/9/gnot/stream.c:20,41 | ||
| 1990/03091 | ||
| 1990/0312 | /* * line disciplines that can be pushed | |
| 1990/03091 |
| |
| 1990/0312 |
| |
| 1990/03091 |
| |
| 1990/0321 | static Qinfo *lds[Nlds+1]; | |
| 1990/03091 |
| |
| 1990/0321 | void newqinfo(Qinfo *qi) { int i; | |
| 1990/03091 | ||
| 1990/0321 | for(i=0; i<Nlds && lds[i]; i++) if(lds[i] == qi) return; if(i == Nlds) panic("pushable"); lds[i] = qi; } | |
| 1990/03091 | /* * All stream structures are ialloc'd at boot time */ | |
| 1990/0312/sys/src/9/gnot/stream.c:51,58 – 1990/0321/sys/src/9/gnot/stream.c:56,63 | ||
| 1990/03091 | } Bclass; Bclass bclass[Nclass]={ { 0 }, | |
| 1990/0321 | { 68 }, { 260 }, | |
| 1990/03091 | { 4096 }, }; | |
| 1990/0312/sys/src/9/gnot/stream.c:88,94 – 1990/0321/sys/src/9/gnot/stream.c:93,98 | ||
| 1990/03091 | } } | |
| 1990/0312/sys/src/9/gnot/stream.c:169,175 – 1990/0321/sys/src/9/gnot/stream.c:173,180 | ||
| 1990/0312 | } | |
| 1990/03091 | bcp->last = bp; unlock(bcp); | |
| 1990/0312 |
| |
| 1990/0321 | if(bcp->r.p) wakeup(&bcp->r); | |
| 1990/03091 | } /* | |
| 1990/0312/sys/src/9/gnot/stream.c:716,722 – 1990/0321/sys/src/9/gnot/stream.c:721,727 | ||
| 1990/03091 | void stputq(Queue *q, Block *bp) { | |
| 1990/0321 | int delim; | |
| 1990/03091 | if(bp->type == M_HANGUP){ freeb(bp); | |
| 1990/0312/sys/src/9/gnot/stream.c:723,729 – 1990/0321/sys/src/9/gnot/stream.c:728,736 | ||
| 1990/03091 | q->flag |= QHUNGUP; q->other->flag |= QHUNGUP; | |
| 1990/0312 | wakeup(&q->other->r); | |
| 1990/0321 | delim = 1; | |
| 1990/03091 | } else { | |
| 1990/0321 | delim = 0; | |
| 1990/03091 | lock(q); if(q->first) q->last->next = bp; | |
| 1990/0312/sys/src/9/gnot/stream.c:730,745 – 1990/0321/sys/src/9/gnot/stream.c:737,757 | ||
| 1990/03091 | else q->first = bp; | |
| 1990/0312 | q->len += BLEN(bp); | |
| 1990/0321 | delim = bp->flags & S_DELIM; | |
| 1990/0312 | while(bp->next) { bp = bp->next; q->len += BLEN(bp); | |
| 1990/0321 | delim |= bp->flags & S_DELIM; | |
| 1990/0312 | } | |
| 1990/03091 | q->last = bp; | |
| 1990/0321 | if(q->len >= Streamhi){ | |
| 1990/03091 | q->flag |= QHIWAT; | |
| 1990/0321 | delim = 1; } | |
| 1990/03091 | unlock(q); } | |
| 1990/0321 | if(delim) wakeup(&q->r); | |
| 1990/03091 | } /* | |