diff options
| author | Charles.Forsyth <devnull@localhost> | 2008-01-16 13:53:02 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2008-01-16 13:53:02 +0000 |
| commit | 85cef7b8460d7280ed0d574689ca8b0d38b21721 (patch) | |
| tree | 33f1f9a17c89bb9ce89b91c2589b987353564609 | |
| parent | e3aab25739d35e74577b3a97fe435396435d1088 (diff) | |
20080116-1359
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | emu/port/fns.h | 3 | ||||
| -rw-r--r-- | emu/port/qio.c | 23 |
3 files changed, 27 insertions, 0 deletions
@@ -3,6 +3,7 @@ set but not used changes from Acme-sac mdb(1) changes from Acme-sac ftpfs uses new dial(2) + add qbypass to emu/port/qio.c 20080115 add blowfish to keyring (not yet documented) add explicit public and private key types to keyring (in development: not yet documented) diff --git a/emu/port/fns.h b/emu/port/fns.h index effdbe33..545b578f 100644 --- a/emu/port/fns.h +++ b/emu/port/fns.h @@ -22,6 +22,7 @@ char* clipread(void); int clipwrite(char*); void copen(Chan*); void cmderror(Cmdbuf*, char*); +Block* concatblock(Block*); int cread(Chan*, uchar*, int, vlong); void cwrite(Chan*, uchar*, int, vlong); Chan* cunique(Chan*); @@ -145,6 +146,7 @@ Block* pullupqueue(Queue*, int); void qaddlist(Queue*, Block*); Block* qbread(Queue*, int); long qbwrite(Queue*, Block*); +Queue* qbypass(void (*)(void*, Block*), void*); int qcanread(Queue*); void qclose(Queue*); int qisclosed(Queue*); @@ -185,6 +187,7 @@ void setpointer(int, int); char* skipslash(char*); void srvrtinit(void); void swiproc(Proc*, int); +Block* trimblock(Block*, int, int); long unionread(Chan*, void*, long); void unlock(Lock*); Uqid* uqidalloc(Uqidtab*, Chan*); diff --git a/emu/port/qio.c b/emu/port/qio.c index 1dfa5d32..b900dff3 100644 --- a/emu/port/qio.c +++ b/emu/port/qio.c @@ -24,6 +24,7 @@ struct Queue int eof; /* number of eofs read by user */ void (*kick)(void*); /* restart output */ + void (*bypass)(void*, Block*); /* bypass queue altogether */ void* arg; /* argument to kick */ QLock rlock; /* mutex for reading processes */ @@ -846,6 +847,24 @@ qopen(int limit, int msg, void (*kick)(void*), void *arg) return q; } +/* open a queue to be bypassed */ +Queue* +qbypass(void (*bypass)(void*, Block*), void *arg) +{ + Queue *q; + + q = malloc(sizeof(Queue)); + if(q == 0) + return 0; + + q->limit = 0; + q->arg = arg; + q->bypass = bypass; + q->state = 0; + + return q; +} + static int notempty(void *a) { @@ -1179,6 +1198,10 @@ qbwrite(Queue *q, Block *b) dowakeup = 0; n = BLEN(b); + if(q->bypass){ + (*q->bypass)(q->arg, b); + return n; + } cb.b = b; qlock(&q->wlock); |
