| plan 9 kernel history: overview | file list | diff list |
1990/1009/port/stream.c (diff list | history)
| 1990/0930/sys/src/9/port/stream.c:235,240 – 1990/1009/sys/src/9/port/stream.c:235,241 (short | long | prev | next) | ||
| 1990/0227 | q->info = qi; q->put = qi->iput; | |
| 1990/0403 | q->len = q->nb = 0; | |
| 1990/1009 | q->ptr = 0; | |
| 1990/0227 | wq = q->other = q + 1; | |
| 1990/0702 | wq->flag = QINUSE; | |
| 1990/0930/sys/src/9/port/stream.c:242,247 – 1990/1009/sys/src/9/port/stream.c:243,249 | ||
| 1990/0227 | wq->info = qi; wq->put = qi->oput; wq->other = q; | |
| 1990/1009 | wq->ptr = 0; | |
| 1990/0403 | wq->len = wq->nb = 0; | |
| 1990/0227 | unlock(q); | |
| 1990/0930/sys/src/9/port/stream.c:625,634 – 1990/1009/sys/src/9/port/stream.c:627,636 | ||
| 1990/0227 | } /* | |
| 1990/1009 | * create a new stream, if noopen is non-zero, don't increment the open count | |
| 1990/0227 | */ Stream * | |
| 1990/1009 | streamnew(ushort type, ushort dev, ushort id, Qinfo *qi, int noopen) | |
| 1990/0227 | { Stream *s; Queue *q; | |
| 1990/0930/sys/src/9/port/stream.c:651,676 – 1990/1009/sys/src/9/port/stream.c:653,677 | ||
| 1990/0227 | } if(waserror()){ unlock(s); | |
| 1990/1009 | streamclose1(s); | |
| 1990/0227 | nexterror(); } /* | |
| 1990/1009 | * identify the stream | |
| 1990/0227 | */ | |
| 1990/1009 | s->type = type; s->dev = dev; s->id = id; | |
| 1990/0227 | /* * hang a device and process q off the stream */ s->inuse = 1; | |
| 1990/0629 |
| |
| 1990/1009 | if(noopen) s->opens = 0; else s->opens = 1; | |
| 1990/0331 | s->hread = 0; | |
| 1990/0227 | q = allocq(&procinfo); s->procq = WR(q); | |
| 1990/0930/sys/src/9/port/stream.c:699,705 – 1990/1009/sys/src/9/port/stream.c:700,706 | ||
| 1990/0227 | Queue *q; /* | |
| 1990/1009 | * if the stream already exists, just increment the reference counts. | |
| 1990/0227 | */ for(s = slist; s < &slist[conf.nstream]; s++) { if(s->inuse && s->type == c->type && s->dev == c->dev | |
| 1990/0930/sys/src/9/port/stream.c:721,727 – 1990/1009/sys/src/9/port/stream.c:722,728 | ||
| 1990/0227 | /* * create a new stream */ | |
| 1990/1009 | c->stream = streamnew(c->type, c->dev, STREAMID(c->qid), qi, 0); | |
| 1990/0227 | } /* | |
| 1990/0930/sys/src/9/port/stream.c:773,791 – 1990/1009/sys/src/9/port/stream.c:774,785 | ||
| 1990/0227 | * stream release its blocks and call its close routine. */ void | |
| 1990/1009 | streamclose1(Stream *s) | |
| 1990/0227 | { Queue *q, *nq; Block *bp; | |
| 1990/03013 |
| |
| 1990/0227 | /* | |
| 1990/03292 |
| |
| 1990/0227 |
| |
| 1990/0629 | * decrement the reference count | |
| 1990/0227 | */ | |
| 1990/03013 | lock(s); | |
| 1990/0930/sys/src/9/port/stream.c:817,822 – 1990/1009/sys/src/9/port/stream.c:811,826 | ||
| 1990/0629 | streamexit(s, 1); | |
| 1990/03013 | unlock(s); | |
| 1990/0227 | } | |
| 1990/1009 | void streamclose(Chan *c) { /* * if no stream, ignore it */ if(!c->stream) return; streamclose1(c->stream); } | |
| 1990/0227 | /* * put a block to be read into the queue. wakeup any waiting reader | |
| 1990/0930/sys/src/9/port/stream.c:1174,1180 – 1990/1009/sys/src/9/port/stream.c:1178,1184 | ||
| 1990/0911 | lock(q); for(bp = q->first; bp; bp = bp->next){ | |
| 1990/1009 | print("%c%d%c", c, bp->wptr-bp->rptr, (bp->flags&S_DELIM)?'D':' '); | |
| 1990/0911 | for(cp = bp->rptr; cp<bp->wptr && cp<bp->rptr+10; cp++) print(" %uo", *cp); print("\n"); | |