| plan 9 kernel history: overview | file list | diff list |
1991/0319/port/sysfile.c (diff list | history)
| 1991/0319/sys/src/9/port/sysfile.c:191,197 – 1991/0411/sys/src/9/port/sysfile.c:191,197 (short | long | prev | next) | ||
|
Bug fix: add explicit read lock and write lock instead of using channel's qlock.
This way a process can write even if another process is blocked doing a read. Add explicit offset to dev read and write to accomodate this.
rsc Fri Mar 4 17:11:43 2005 | ||
| 1990/0227 | } nc = (*devtab[nc->type].open)(nc, OREAD); nc->offset = c->offset; | |
| 1991/0411 | nr = (*devtab[nc->type].read)(nc, va, n, nc->offset); | |
| 1990/0821 | c->offset = nc->offset; /* devdirread e.g. changes it */ | |
| 1990/0227 | close(nc); poperror(); | |
| 1991/0319/sys/src/9/port/sysfile.c:226,234 – 1991/0411/sys/src/9/port/sysfile.c:226,234 | ||
| 1990/0227 | ||
| 1990/1009 | c = fdtochan(arg[0], OREAD); | |
| 1990/1004 | validaddr(arg[1], arg[2], 1); | |
| 1990/0227 |
| |
| 1991/0411 | qlock(&c->rdl); | |
| 1990/0227 | if(waserror()){ | |
| 1991/0411 | qunlock(&c->rdl); | |
| 1990/0227 | nexterror(); } n = arg[2]; | |
| 1991/0319/sys/src/9/port/sysfile.c:240,248 – 1991/0411/sys/src/9/port/sysfile.c:240,248 | ||
| 1990/11211 | if((c->qid.path&CHDIR) && (c->flag&CMOUNT)) | |
| 1990/0227 | n = unionread(c, (void*)arg[1], n); else | |
| 1991/0411 | n = (*devtab[c->type].read)(c, (void*)arg[1], n, c->offset); | |
| 1990/0227 | c->offset += n; | |
| 1991/0411 | qunlock(&c->rdl); | |
| 1990/0227 | return n; } | |
| 1991/0319/sys/src/9/port/sysfile.c:254,269 – 1991/0411/sys/src/9/port/sysfile.c:254,269 | ||
| 1990/0227 | ||
| 1990/1009 | c = fdtochan(arg[0], OWRITE); | |
| 1990/0227 | validaddr(arg[1], arg[2], 0); | |
| 1991/0411 | qlock(&c->wrl); | |
| 1990/0227 | if(waserror()){ | |
| 1991/0411 | qunlock(&c->wrl); | |
| 1990/0227 | nexterror(); } | |
| 1990/11211 | if(c->qid.path & CHDIR) error(Eisdir); | |
| 1990/0227 |
| |
| 1991/0411 | n = (*devtab[c->type].write)(c, (void*)arg[1], arg[2], c->offset); | |
| 1990/0227 | c->offset += n; | |
| 1991/0411 | qunlock(&c->wrl); | |
| 1990/0227 | return n; } | |
| 1991/0319/sys/src/9/port/sysfile.c:280,288 – 1991/0411/sys/src/9/port/sysfile.c:280,290 | ||
| 1990/11211 | error(Eisdir); | |
| 1991/0319 | if(devchar[c->type] == '|') error(Eisstream); | |
| 1990/0227 |
| |
| 1991/0411 | qlock(&c->rdl); qlock(&c->wrl); | |
| 1990/0227 | if(waserror()){ | |
| 1991/0411 | qunlock(&c->rdl); qunlock(&c->wrl); | |
| 1990/0227 | nexterror(); } switch(arg[2]){ | |
| 1991/0319/sys/src/9/port/sysfile.c:301,307 – 1991/0411/sys/src/9/port/sysfile.c:303,310 | ||
| 1990/0227 | break; } off = c->offset; | |
| 1991/0411 | qunlock(&c->rdl); qunlock(&c->wrl); | |
| 1990/0227 | poperror(); return off; } | |