add -W to specify window size.

various other little fixes.
This commit is contained in:
rsc 2004-04-29 17:13:24 +00:00
parent 3d72637f9b
commit be36ff6885
36 changed files with 332 additions and 304 deletions

View file

@ -1,3 +1,4 @@
#define _GNU_SOURCE /* for Linux O_DIRECT */
#include <u.h>
#define NOPLAN9DEFINES
#include <libc.h>
@ -25,6 +26,10 @@ p9create(char *path, int mode, ulong perm)
}else{
umode = (mode&3)|O_CREAT|O_TRUNC;
mode &= ~(3|OTRUNC);
if(mode&ODIRECT){
umode |= O_DIRECT;
mode &= ~ODIRECT;
}
if(mode&OEXCL){
umode |= O_EXCL;
mode &= ~OEXCL;

View file

@ -167,3 +167,4 @@ HFILES=\
%.$O: utf/%.c
$CC $CFLAGS utf/$stem.c
rendez-Linux.$O: rendez-futex.c rendez-signal.c

View file

@ -1,3 +1,4 @@
#define _GNU_SOURCE /* for Linux O_DIRECT */
#include <u.h>
#define NOPLAN9DEFINES
#include <libc.h>
@ -16,6 +17,10 @@ p9open(char *name, int mode)
umode |= O_TRUNC;
mode ^= OTRUNC;
}
if(mode&ODIRECT){
umode |= O_DIRECT;
mode ^= ODIRECT;
}
if(mode){
werrstr("mode not supported");
return -1;

View file

@ -34,8 +34,10 @@ getqlp(void)
for(p = op+1; ; p++){
if(p == &ql.x[nelem(ql.x)])
p = ql.x;
if(p == op)
if(p == op){
fprint(2, "qlock: out of qlp\n");
abort();
}
if(_tas(&(p->inuse)) == 0){
ql.p = p;
p->next = nil;
@ -233,8 +235,10 @@ wunlock(RWLock *q)
QLp *p;
lock(&q->lock);
if(q->writer == 0)
if(q->writer == 0){
fprint(2, "wunlock: not holding lock\n");
abort();
}
p = q->head;
if(p == nil){
q->writer = 0;
@ -252,8 +256,10 @@ wunlock(RWLock *q)
return;
}
if(p->state != QueuingR)
if(p->state != QueuingR){
fprint(2, "wunlock: bad state\n");
abort();
}
/* wake waiting readers */
while(q->head != nil && q->head->state == QueuingR){
@ -274,12 +280,16 @@ rsleep(Rendez *r)
{
QLp *t, *me;
if(!r->l)
if(!r->l){
fprint(2, "rsleep: no lock\n");
abort();
}
lock(&r->l->lock);
/* we should hold the qlock */
if(!r->l->locked)
if(!r->l->locked){
fprint(2, "rsleep: not locked\n");
abort();
}
/* add ourselves to the wait list */
me = getqlp();
@ -309,8 +319,10 @@ rsleep(Rendez *r)
while((*_rendezvousp)((ulong)me, 0x23456) == ~0)
;
me->inuse = 0;
if(!r->l->locked)
if(!r->l->locked){
fprint(2, "rsleep: not locked after wakeup\n");
abort();
}
}
int
@ -323,11 +335,15 @@ rwakeup(Rendez *r)
* put on front so guys that have been waiting will not get starved
*/
if(!r->l)
if(!r->l){
fprint(2, "rwakeup: no lock\n");
abort();
}
lock(&r->l->lock);
if(!r->l->locked)
if(!r->l->locked){
fprint(2, "rwakeup: not locked\n");
abort();
}
t = r->head;
if(t == nil){