History

20080116-1359

Charles.Forsyth committed 18 years ago

Commit d0bd08a1 parent ff72aa73 files · +27 −0Browse files

Unified · Split

3 files
  1. CHANGES +1 −0
  2. emu/port/fns.h +3 −0
  3. emu/port/qio.c +23 −0
CHANGES+1−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 set but not used changes from Acme-sac
44 mdb(1) changes from Acme-sac
55 ftpfs uses new dial(2)
6+ add qbypass to emu/port/qio.c
67 20080115
78 add blowfish to keyring (not yet documented)
89 add explicit public and private key types to keyring (in development: not yet documented)
emu/port/fns.h+3−0
@@ -22,6 +22,7 @@ char* clipread(void); · 21 unmodified lines
2222 int clipwrite(char*);
2323 void copen(Chan*);
2424 void cmderror(Cmdbuf*, char*);
25+Block* concatblock(Block*);
2526 int cread(Chan*, uchar*, int, vlong);
2627 void cwrite(Chan*, uchar*, int, vlong);
2728 Chan* cunique(Chan*);
@@ -145,6 +146,7 @@ Block* pullupqueue(Queue*, int); · 117 unmodified lines
145146 void qaddlist(Queue*, Block*);
146147 Block* qbread(Queue*, int);
147148 long qbwrite(Queue*, Block*);
149+Queue* qbypass(void (*)(void*, Block*), void*);
148150 int qcanread(Queue*);
149151 void qclose(Queue*);
150152 int qisclosed(Queue*);
@@ -185,6 +187,7 @@ void setpointer(int, int); · 34 unmodified lines
185187 char* skipslash(char*);
186188 void srvrtinit(void);
187189 void swiproc(Proc*, int);
190+Block* trimblock(Block*, int, int);
188191 long unionread(Chan*, void*, long);
189192 void unlock(Lock*);
190193 Uqid* uqidalloc(Uqidtab*, Chan*);
emu/port/qio.c+23−0
@@ -24,6 +24,7 @@ struct Queue · 23 unmodified lines
2424 int eof; /* number of eofs read by user */
2525
2626 void (*kick)(void*); /* restart output */
27+ void (*bypass)(void*, Block*); /* bypass queue altogether */
2728 void* arg; /* argument to kick */
2829
2930 QLock rlock; /* mutex for reading processes */
@@ -846,6 +847,24 @@ qopen(int limit, int msg, void (*kick)(void*), void *arg) · 816 unmodified lines
846847 return q;
847848 }
848849
850+/* open a queue to be bypassed */
851+Queue*
852+qbypass(void (*bypass)(void*, Block*), void *arg)
853+{
854+ Queue *q;
855+
856+ q = malloc(sizeof(Queue));
857+ if(q == 0)
858+ return 0;
859+
860+ q->limit = 0;
861+ q->arg = arg;
862+ q->bypass = bypass;
863+ q->state = 0;
864+
865+ return q;
866+}
867+
849868 static int
850869 notempty(void *a)
851870 {
@@ -1179,6 +1198,10 @@ qbwrite(Queue *q, Block *b) · 327 unmodified lines
11791198
11801199 dowakeup = 0;
11811200 n = BLEN(b);
1201+ if(q->bypass){
1202+ (*q->bypass)(q->arg, b);
1203+ return n;
1204+ }
11821205 cb.b = b;
11831206
11841207 qlock(&q->wlock);