| plan 9 kernel history: overview | file list | diff list |
1991/0419/port/sysfile.c (diff list | history)
| 1990/0227/sys/src/9/port/sysfile.c:126,132 – 1990/0321/sys/src/9/port/sysfile.c:126,132 (short | long) | ||
| 1990/0227 | mnt = c->mnt; lock(pg); if(c->mountid != mnt->mountid){ | |
| 1990/0321 | pprint("unionread: changed underfoot?\n"); | |
| 1990/0227 | unlock(pg); return 0; } | |
| 1990/0321/sys/src/9/port/sysfile.c:406,415 – 1990/03292/sys/src/9/port/sysfile.c:406,411 (short | long) | ||
| 1990/0227 | c[1] = (*d->clone)(c[0], 0); c[0] = (*d->open)(c[0], ORDWR); c[1] = (*d->open)(c[1], ORDWR); | |
| 1990/03292/sys/src/9/port/sysfile.c:283,288 – 1990/0513/sys/src/9/port/sysfile.c:283,289 (short | long) | ||
| 1990/0227 | validaddr(arg[0], 1, 0); c = namec((char*)arg[0], Aaccess, 0, 0); if(waserror()){ | |
| 1990/0513 | print("stat error\n"); | |
| 1990/0227 | close(c); nexterror(); } | |
| 1990/0513/sys/src/9/port/sysfile.c:283,289 – 1990/0617/sys/src/9/port/sysfile.c:283,288 (short | long) | ||
| 1990/0227 | validaddr(arg[0], 1, 0); c = namec((char*)arg[0], Aaccess, 0, 0); if(waserror()){ | |
| 1990/0513 |
| |
| 1990/0227 | close(c); nexterror(); } | |
| 1990/0617/sys/src/9/port/sysfile.c:457,462 – 1990/0703/sys/src/9/port/sysfile.c:457,463 (short | long) | ||
| 1990/0227 | validaddr(arg[0], 1, 0); c = namec((char*)arg[0], Aaccess, 0, 0); if(waserror()){ | |
| 1990/0703 | c->type = 0; /* see below */ | |
| 1990/0227 | close(c); nexterror(); } | |
| 1990/0703/sys/src/9/port/sysfile.c:44,53 – 1990/08141/sys/src/9/port/sysfile.c:44,53 (short | long) | ||
| 1990/0227 | int openmode(ulong o) { | |
| 1990/08141 | if(o >= (OTRUNC|OCEXEC|ORCLOSE|OEXEC)) | |
| 1990/0227 | Err: error(0, Ebadarg); | |
| 1990/08141 | o &= ~(OTRUNC|OCEXEC|ORCLOSE); | |
| 1990/0227 | if(o > OEXEC) goto Err; if(o == OEXEC) | |
| 1990/08141/sys/src/9/port/sysfile.c:148,153 – 1990/0821/sys/src/9/port/sysfile.c:148,154 (short | long) | ||
| 1990/0227 | nc = (*devtab[nc->type].open)(nc, OREAD); nc->offset = c->offset; nr = (*devtab[nc->type].read)(nc, va, n); | |
| 1990/0821 | c->offset = nc->offset; /* devdirread e.g. changes it */ | |
| 1990/0227 | close(nc); poperror(); if(nr > 0) | |
| 1990/08141/sys/src/9/port/sysfile.c:192,198 – 1990/0821/sys/src/9/port/sysfile.c:193,199 | ||
| 1990/0227 | if(c->offset%DIRLEN || n==0) error(0, Ebaddirread); } | |
| 1990/0821 | if((c->qid&CHDIR) && (c->flag&CMOUNT)) | |
| 1990/0227 | n = unionread(c, (void*)arg[1], n); else n = (*devtab[c->type].read)(c, (void*)arg[1], n); | |
| 1990/0821/sys/src/9/port/sysfile.c:299,309 – 1990/0822/sys/src/9/port/sysfile.c:299,305 (short | long) | ||
| 1990/0227 | Chan *c; long mode; | |
| 1990/0822 | postnote(u->p, 1, "access is deprecated", NDebug); | |
| 1990/0227 | return 0; } | |
| 1990/0822/sys/src/9/port/sysfile.c:321,326 – 1990/0918/sys/src/9/port/sysfile.c:321,328 (short | long) | ||
| 1990/0227 | Chan *c0, *c1; ulong flag; long ret; | |
| 1990/0918 | char *p; int t; | |
| 1990/0227 | struct{ Chan *chan; char *spec; | |
| 1990/0822/sys/src/9/port/sysfile.c:331,338 – 1990/0918/sys/src/9/port/sysfile.c:333,344 | ||
| 1990/0227 | error(0, Ebadarg); if(ismount){ bogus.chan = fdtochan(arg[0], 2); | |
| 1990/0918 | p = (char*)arg[3]; t = BY2PG-((ulong)p&(BY2PG-1)); while(vmemchr(p, 0, t) == 0){ p += t; t = BY2PG; } | |
| 1990/0227 | bogus.spec = (char*)arg[3]; ret = devno('M', 0); c0 = (*devtab[ret].attach)((char*)&bogus); | |
| 1990/0918/sys/src/9/port/sysfile.c:181,187 – 1990/1004/sys/src/9/port/sysfile.c:181,187 (short | long) | ||
| 1990/0227 | long n; c = fdtochan(arg[0], 0); | |
| 1990/1004 | validaddr(arg[1], arg[2], 1); | |
| 1990/0227 | qlock(c); if(waserror()){ qunlock(c); | |
| 1990/1004/sys/src/9/port/sysfile.c:31,42 – 1990/1009/sys/src/9/port/sysfile.c:31,42 (short | long) | ||
| 1990/0227 | if(fd<0 || NFD<=fd || (c=u->fd[fd])==0) error(0, Ebadfd); | |
| 1990/1009 | if(mode<0 || c->mode==ORDWR) | |
| 1990/0227 | return c; | |
| 1990/1009 | if((mode&OTRUNC) && c->mode==OREAD) | |
| 1990/0227 | err: error(0, Ebadusefd); | |
| 1990/1009 | if((mode&~OTRUNC) != c->mode) | |
| 1990/0227 | goto err; return c; } | |
| 1990/1004/sys/src/9/port/sysfile.c:56,61 – 1990/1009/sys/src/9/port/sysfile.c:56,100 | ||
| 1990/0227 | } long | |
| 1990/1009 | syspipe(ulong *arg) { int fd[2]; Chan *c[2]; Dev *d; validaddr(arg[0], 2*BY2WD, 1); evenaddr(arg[0]); d = &devtab[devno('|', 0)]; c[0] = (*d->attach)(0); c[1] = 0; fd[0] = -1; fd[1] = -1; if(waserror()){ close(c[0]); if(c[1]) close(c[1]); if(fd[0] >= 0) u->fd[fd[0]]=0; if(fd[1] >= 0) u->fd[fd[1]]=0; nexterror(); } c[1] = (*d->clone)(c[0], 0); (*d->walk)(c[0], "data"); (*d->walk)(c[1], "data1"); c[0] = (*d->open)(c[0], ORDWR); c[1] = (*d->open)(c[1], ORDWR); fd[0] = newfd(); u->fd[fd[0]] = c[0]; fd[1] = newfd(); u->fd[fd[1]] = c[1]; ((long*)arg[0])[0] = fd[0]; ((long*)arg[0])[1] = fd[1]; poperror(); return 0; } long | |
| 1990/0227 | sysdup(ulong *arg) { int fd; | |
| 1990/1004/sys/src/9/port/sysfile.c:180,186 – 1990/1009/sys/src/9/port/sysfile.c:219,225 | ||
| 1990/0227 | Chan *c; long n; | |
| 1990/1009 | c = fdtochan(arg[0], OREAD); | |
| 1990/1004 | validaddr(arg[1], arg[2], 1); | |
| 1990/0227 | qlock(c); if(waserror()){ | |
| 1990/1004/sys/src/9/port/sysfile.c:208,214 – 1990/1009/sys/src/9/port/sysfile.c:247,253 | ||
| 1990/0227 | Chan *c; long n; | |
| 1990/1009 | c = fdtochan(arg[0], OWRITE); | |
| 1990/0227 | validaddr(arg[1], arg[2], 0); qlock(c); if(waserror()){ | |
| 1990/1004/sys/src/9/port/sysfile.c:380,422 – 1990/1009/sys/src/9/port/sysfile.c:419,424 | ||
| 1990/0227 | sysmount(ulong *arg) { return bindmount(arg, 1); | |
| 1990/1009/sys/src/9/port/sysfile.c:21,27 – 1990/11211/sys/src/9/port/sysfile.c:21,27 (short | long) | ||
| 1990/0227 | u->maxfd = i; return i; } | |
| 1990/11211 | error(Enofd); | |
| 1990/0227 | } Chan* | |
| 1990/1009/sys/src/9/port/sysfile.c:30,41 – 1990/11211/sys/src/9/port/sysfile.c:30,41 | ||
| 1990/0227 | Chan *c; if(fd<0 || NFD<=fd || (c=u->fd[fd])==0) | |
| 1990/11211 | error(Ebadfd); | |
| 1990/1009 | if(mode<0 || c->mode==ORDWR) | |
| 1990/0227 | return c; | |
| 1990/1009 | if((mode&OTRUNC) && c->mode==OREAD) | |
| 1990/0227 | err: | |
| 1990/11211 | error(Ebadusefd); | |
| 1990/1009 | if((mode&~OTRUNC) != c->mode) | |
| 1990/0227 | goto err; return c; | |
| 1990/1009/sys/src/9/port/sysfile.c:46,52 – 1990/11211/sys/src/9/port/sysfile.c:46,52 | ||
| 1990/0227 | { | |
| 1990/08141 | if(o >= (OTRUNC|OCEXEC|ORCLOSE|OEXEC)) | |
| 1990/0227 | Err: | |
| 1990/11211 | error(Ebadarg); | |
| 1990/08141 | o &= ~(OTRUNC|OCEXEC|ORCLOSE); | |
| 1990/0227 | if(o > OEXEC) goto Err; | |
| 1990/1009/sys/src/9/port/sysfile.c:227,238 – 1990/11211/sys/src/9/port/sysfile.c:227,238 | ||
| 1990/0227 | nexterror(); } n = arg[2]; | |
| 1990/11211 | if(c->qid.path & CHDIR){ | |
| 1990/0227 | n -= n%DIRLEN; if(c->offset%DIRLEN || n==0) | |
| 1990/11211 | error(Ebaddirread); | |
| 1990/0227 | } | |
| 1990/0821 |
| |
| 1990/11211 | if((c->qid.path&CHDIR) && (c->flag&CMOUNT)) | |
| 1990/0227 | n = unionread(c, (void*)arg[1], n); else n = (*devtab[c->type].read)(c, (void*)arg[1], n); | |
| 1990/1009/sys/src/9/port/sysfile.c:254,261 – 1990/11211/sys/src/9/port/sysfile.c:254,261 | ||
| 1990/0227 | qunlock(c); nexterror(); } | |
| 1990/11211 | if(c->qid.path & CHDIR) error(Eisdir); | |
| 1990/0227 | n = (*devtab[c->type].write)(c, (void*)arg[1], arg[2]); c->offset += n; qunlock(c); | |
| 1990/1009/sys/src/9/port/sysfile.c:271,278 – 1990/11211/sys/src/9/port/sysfile.c:271,278 | ||
| 1990/0227 | long off; c = fdtochan(arg[0], -1); | |
| 1990/11211 | if(c->qid.path & CHDIR) error(Eisdir); | |
| 1990/0227 | qlock(c); if(waserror()){ qunlock(c); | |
| 1990/1009/sys/src/9/port/sysfile.c:365,377 – 1990/11211/sys/src/9/port/sysfile.c:365,379 | ||
| 1990/0227 | struct{ Chan *chan; char *spec; | |
| 1990/11211 | char *auth; | |
| 1990/0227 | }bogus; flag = arg[2]; if(flag>MMASK || (flag&MORDER)==(MBEFORE|MAFTER)) | |
| 1990/11211 | error(Ebadarg); | |
| 1990/0227 | if(ismount){ bogus.chan = fdtochan(arg[0], 2); | |
| 1990/11211 | validaddr(arg[3], 1, 0); | |
| 1990/0918 | p = (char*)arg[3]; t = BY2PG-((ulong)p&(BY2PG-1)); while(vmemchr(p, 0, t) == 0){ | |
| 1990/1009/sys/src/9/port/sysfile.c:379,384 – 1990/11211/sys/src/9/port/sysfile.c:381,394 | ||
| 1990/0918 | t = BY2PG; } | |
| 1990/0227 | bogus.spec = (char*)arg[3]; | |
| 1990/11211 | validaddr(arg[4], 1, 0); p = (char*)arg[4]; t = BY2PG-((ulong)p&(BY2PG-1)); while(vmemchr(p, 0, t) == 0){ p += t; t = BY2PG; } bogus.auth = (char*)arg[4]; | |
| 1990/0227 | ret = devno('M', 0); c0 = (*devtab[ret].attach)((char*)&bogus); }else{ | |
| 1990/1009/sys/src/9/port/sysfile.c:395,404 – 1990/11211/sys/src/9/port/sysfile.c:405,414 | ||
| 1990/0227 | close(c1); nexterror(); } | |
| 1990/11211 | if((c0->qid.path^c1->qid.path) & CHDIR) error(Ebadmount); if(flag && !(c0->qid.path&CHDIR)) error(Ebadmount); | |
| 1990/0227 | ret = mount(c0, c1, flag); close(c0); close(c1); | |
| 1990/1009/sys/src/9/port/sysfile.c:433,457 – 1990/11211/sys/src/9/port/sysfile.c:443,448 | ||
| 1990/0227 | c = namec((char*)arg[0], Acreate, arg[1], arg[2]); u->fd[fd] = c; return fd; | |
| 1990/11211/sys/src/9/port/sysfile.c:29,34 – 1990/1126/sys/src/9/port/sysfile.c:29,35 (short | long) | ||
| 1990/0227 | { Chan *c; | |
| 1990/1126 | c = 0; /* set */ | |
| 1990/0227 | if(fd<0 || NFD<=fd || (c=u->fd[fd])==0) | |
| 1990/11211 | error(Ebadfd); | |
| 1990/1009 | if(mode<0 || c->mode==ORDWR) | |
| 1990/11211/sys/src/9/port/sysfile.c:329,344 – 1990/1126/sys/src/9/port/sysfile.c:330,335 | ||
| 1990/0227 | (*devtab[c->type].stat)(c, (char*)arg[1]); poperror(); close(c); | |
| 1990/0822 |
| |
| 1990/0227 | return 0; } | |
| 1990/1126/sys/src/9/port/sysfile.c:29,35 – 1990/1210/sys/src/9/port/sysfile.c:29,35 (short | long) | ||
|
Created.
rsc Fri Mar 4 12:44:25 2005 | ||
| 1990/0227 | { Chan *c; | |
| 1990/1126 |
| |
| 1990/1210 | c = 0; /* set */ | |
| 1990/0227 | if(fd<0 || NFD<=fd || (c=u->fd[fd])==0) | |
| 1990/11211 | error(Ebadfd); | |
| 1990/1009 | if(mode<0 || c->mode==ORDWR) | |
| 1990/1126/sys/src/9/port/sysfile.c:490,492 – 1990/1210/sys/src/9/port/sysfile.c:490,508 | ||
| 1990/0227 | (*devtab[c->type].wstat)(c, (char*)arg[1]); return 0; } | |
| 1990/1210 | #ifdef asdf long sysfilsys(ulong *arg) { Chan *cin, *cout; cin = fdtochan(arg[0], OREAD); cout = fdtochan(arg[1], OWRITE); validaddr(arg[2], 1, 0); if((cin->qid.path&CHDIR) || (cout->qid.path&CHDIR)) error(Ebadarg); service((char *)arg[2], cin, cout, filsys); return 0; } #endif | |
| 1990/1210/sys/src/9/port/sysfile.c:106,114 – 1991/0221/sys/src/9/port/sysfile.c:106,118 (short | long) | ||
|
Bug fix: check for invalid file descriptors.
rsc Fri Mar 4 17:11:41 2005 | ||
| 1990/0227 | */ c = fdtochan(arg[0], -1); fd = arg[1]; | |
| 1991/0221 | if(fd != -1){ if(fd<0 || NFD<=fd) error(Ebadfd); if(fd > u->maxfd) u->maxfd = fd; | |
| 1990/0227 | oc = u->fd[fd]; | |
| 1991/0221 | }else{ | |
| 1990/0227 | oc = 0; fd = newfd(); } | |
| 1991/0221/sys/src/9/port/sysfile.c:278,283 – 1991/0319/sys/src/9/port/sysfile.c:278,285 (short | long) | ||
|
Disallow seek on pipe.
rsc Fri Mar 4 17:11:42 2005 | ||
| 1990/0227 | c = fdtochan(arg[0], -1); | |
| 1990/11211 | if(c->qid.path & CHDIR) error(Eisdir); | |
| 1991/0319 | if(devchar[c->type] == '|') error(Eisstream); | |
| 1990/0227 | qlock(c); if(waserror()){ qunlock(c); | |
| 1991/0319/sys/src/9/port/sysfile.c:191,197 – 1991/0411/sys/src/9/port/sysfile.c:191,197 (short | long) | ||
|
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; } | |
| 1991/0411/sys/src/9/port/sysfile.c:227,234 – 1991/0417/sys/src/9/port/sysfile.c:227,236 (short | long) | ||
|
Debugging: acquire both locks during read and write.
rsc Fri Mar 4 17:11:43 2005 | ||
| 1990/1009 | c = fdtochan(arg[0], OREAD); | |
| 1990/1004 | validaddr(arg[1], arg[2], 1); | |
| 1991/0411 | qlock(&c->rdl); | |
| 1991/0417 | qlock(&c->wrl); /* BUG BUG BUG */ | |
| 1990/0227 | if(waserror()){ | |
| 1991/0411 | qunlock(&c->rdl); | |
| 1991/0417 | qunlock(&c->wrl); /* BUG BUG BUG */ | |
| 1990/0227 | nexterror(); } n = arg[2]; | |
| 1991/0411/sys/src/9/port/sysfile.c:243,248 – 1991/0417/sys/src/9/port/sysfile.c:245,251 | ||
| 1991/0411 | n = (*devtab[c->type].read)(c, (void*)arg[1], n, c->offset); | |
| 1990/0227 | c->offset += n; | |
| 1991/0411 | qunlock(&c->rdl); | |
| 1991/0417 | qunlock(&c->wrl); /* BUG BUG BUG */ | |
| 1990/0227 | return n; } | |
| 1991/0411/sys/src/9/port/sysfile.c:254,261 – 1991/0417/sys/src/9/port/sysfile.c:257,266 | ||
| 1990/0227 | ||
| 1990/1009 | c = fdtochan(arg[0], OWRITE); | |
| 1990/0227 | validaddr(arg[1], arg[2], 0); | |
| 1991/0417 | qlock(&c->rdl); /* BUG BUG BUG */ | |
| 1991/0411 | qlock(&c->wrl); | |
| 1990/0227 | if(waserror()){ | |
| 1991/0417 | qunlock(&c->rdl); /* BUG BUG BUG */ | |
| 1991/0411 | qunlock(&c->wrl); | |
| 1990/0227 | nexterror(); } | |
| 1991/0411/sys/src/9/port/sysfile.c:263,268 – 1991/0417/sys/src/9/port/sysfile.c:268,274 | ||
| 1990/11211 | error(Eisdir); | |
| 1991/0411 | n = (*devtab[c->type].write)(c, (void*)arg[1], arg[2], c->offset); | |
| 1990/0227 | c->offset += n; | |
| 1991/0417 | qunlock(&c->rdl); /* BUG BUG BUG */ | |
| 1991/0411 | qunlock(&c->wrl); | |
| 1990/0227 | return n; } | |
| 1991/0417/sys/src/9/port/sysfile.c:227,236 – 1991/0419/sys/src/9/port/sysfile.c:227,234 (short | long) | ||
|
Remove debugging.
rsc Fri Mar 4 17:11:43 2005 | ||
| 1990/1009 | c = fdtochan(arg[0], OREAD); | |
| 1990/1004 | validaddr(arg[1], arg[2], 1); | |
| 1991/0411 | qlock(&c->rdl); | |
| 1991/0417 |
| |
| 1990/0227 | if(waserror()){ | |
| 1991/0411 | qunlock(&c->rdl); | |
| 1991/0417 |
| |
| 1990/0227 | nexterror(); } n = arg[2]; | |
| 1991/0417/sys/src/9/port/sysfile.c:245,251 – 1991/0419/sys/src/9/port/sysfile.c:243,248 | ||
| 1991/0411 | n = (*devtab[c->type].read)(c, (void*)arg[1], n, c->offset); | |
| 1990/0227 | c->offset += n; | |
| 1991/0411 | qunlock(&c->rdl); | |
| 1991/0417 |
| |
| 1990/0227 | return n; } | |
| 1991/0417/sys/src/9/port/sysfile.c:257,266 – 1991/0419/sys/src/9/port/sysfile.c:254,261 | ||
| 1990/0227 | ||
| 1990/1009 | c = fdtochan(arg[0], OWRITE); | |
| 1990/0227 | validaddr(arg[1], arg[2], 0); | |
| 1991/0417 |
| |
| 1991/0411 | qlock(&c->wrl); | |
| 1990/0227 | if(waserror()){ | |
| 1991/0417 |
| |
| 1991/0411 | qunlock(&c->wrl); | |
| 1990/0227 | nexterror(); } | |
| 1991/0417/sys/src/9/port/sysfile.c:268,274 – 1991/0419/sys/src/9/port/sysfile.c:263,268 | ||
| 1990/11211 | error(Eisdir); | |
| 1991/0411 | n = (*devtab[c->type].write)(c, (void*)arg[1], arg[2], c->offset); | |
| 1990/0227 | c->offset += n; | |
| 1991/0417 |
| |
| 1991/0411 | qunlock(&c->wrl); | |
| 1990/0227 | return n; } | |
| 1991/0419/sys/src/9/port/sysfile.c:227,232 – 1991/0501/sys/src/9/port/sysfile.c:227,233 (short | long) | ||
|
Whitespace edit.
rsc Fri Mar 4 17:11:44 2005 | ||
| 1990/1009 | c = fdtochan(arg[0], OREAD); | |
| 1990/1004 | validaddr(arg[1], arg[2], 1); | |
| 1991/0411 | qlock(&c->rdl); | |
| 1991/0501 | ||
| 1990/0227 | if(waserror()){ | |
| 1991/0411 | qunlock(&c->rdl); | |
| 1990/0227 | nexterror(); | |
| 1991/0419/sys/src/9/port/sysfile.c:255,260 – 1991/0501/sys/src/9/port/sysfile.c:256,262 | ||
| 1990/1009 | c = fdtochan(arg[0], OWRITE); | |
| 1990/0227 | validaddr(arg[1], arg[2], 0); | |
| 1991/0411 | qlock(&c->wrl); | |
| 1991/0501 | ||
| 1990/0227 | if(waserror()){ | |
| 1991/0411 | qunlock(&c->wrl); | |
| 1990/0227 | nexterror(); | |
| 1991/0501/sys/src/9/port/sysfile.c:243,248 – 1991/0614/sys/src/9/port/sysfile.c:243,249 (short | long) | ||
|
Possible semantics change: insert poperrors in read, write, remove, despite comment at top of file.
Bug fix: poperror bug in mount. rsc Fri Mar 4 17:11:44 2005 | ||
| 1990/0227 | else | |
| 1991/0411 | n = (*devtab[c->type].read)(c, (void*)arg[1], n, c->offset); | |
| 1990/0227 | c->offset += n; | |
| 1991/0614 | poperror(); | |
| 1991/0411 | qunlock(&c->rdl); | |
| 1990/0227 | return n; } | |
| 1991/0501/sys/src/9/port/sysfile.c:265,270 – 1991/0614/sys/src/9/port/sysfile.c:266,272 | ||
| 1990/11211 | error(Eisdir); | |
| 1991/0411 | n = (*devtab[c->type].write)(c, (void*)arg[1], arg[2], c->offset); | |
| 1990/0227 | c->offset += n; | |
| 1991/0614 | poperror(); | |
| 1991/0411 | qunlock(&c->wrl); | |
| 1990/0227 | return n; } | |
| 1991/0501/sys/src/9/port/sysfile.c:305,313 – 1991/0614/sys/src/9/port/sysfile.c:307,315 | ||
| 1990/0227 | break; } off = c->offset; | |
| 1991/0614 | poperror(); | |
| 1991/0411 | qunlock(&c->rdl); qunlock(&c->wrl); | |
| 1990/0227 |
| |
| 1991/0501/sys/src/9/port/sysfile.c:412,419 – 1991/0614/sys/src/9/port/sysfile.c:414,423 | ||
| 1990/11211 | if(flag && !(c0->qid.path&CHDIR)) error(Ebadmount); | |
| 1990/0227 | ret = mount(c0, c1, flag); | |
| 1991/0614 | poperror(); | |
| 1990/0227 | close(c1); | |
| 1991/0614 | poperror(); close(c0); | |
| 1990/0227 | if(ismount){ close(bogus.chan); fdclose(arg[0]); | |
| 1991/0501/sys/src/9/port/sysfile.c:465,470 – 1991/0614/sys/src/9/port/sysfile.c:469,475 | ||
| 1990/0227 | * so fake it up. rootclose() is known to be a nop. */ c->type = 0; | |
| 1991/0614 | poperror(); | |
| 1990/0227 | close(c); return 0; } | |
| 1991/0614/sys/src/9/port/sysfile.c:364,371 – 1991/0615/sys/src/9/port/sysfile.c:364,369 (short | long) | ||
|
Semantics change: require names to be at most NAMELEN in length, instead of unlimited.
rsc Fri Mar 4 17:11:45 2005 | ||
| 1990/0227 | Chan *c0, *c1; ulong flag; long ret; | |
| 1990/0918 |
| |
| 1990/0227 | struct{ Chan *chan; char *spec; | |
| 1991/0614/sys/src/9/port/sysfile.c:378,397 – 1991/0615/sys/src/9/port/sysfile.c:376,387 | ||
| 1990/0227 | if(ismount){ bogus.chan = fdtochan(arg[0], 2); | |
| 1990/11211 | validaddr(arg[3], 1, 0); | |
| 1990/0918 |
| |
| 1991/0615 | if(vmemchr((char*)arg[3], '\0', NAMELEN) == 0) error(Ebadarg); | |
| 1990/0227 | bogus.spec = (char*)arg[3]; | |
| 1990/11211 | validaddr(arg[4], 1, 0); | |
| 1991/0615 | if(vmemchr((char*)arg[4], '\0', NAMELEN) == 0) error(Ebadarg); | |
| 1990/11211 | bogus.auth = (char*)arg[4]; | |
| 1990/0227 | ret = devno('M', 0); c0 = (*devtab[ret].attach)((char*)&bogus); | |
| 1991/0615/sys/src/9/port/sysfile.c:11,26 – 1991/0705/sys/src/9/port/sysfile.c:11,31 (short | long) | ||
| 1990/0227 | */ int | |
| 1991/0705 | newfd(Chan *c) | |
| 1990/0227 | { | |
| 1991/0705 | Fgrp *f = u->p->fgrp; | |
| 1990/0227 | int i; | |
| 1991/0705 | lock(f); | |
| 1990/0227 | for(i=0; i<NFD; i++) | |
| 1991/0705 | if(f->fd[i] == 0){ if(i > f->maxfd) f->maxfd = i; f->fd[i] = c; unlock(f); | |
| 1990/0227 | return i; } | |
| 1991/0705 | unlock(f); | |
| 1990/11211 | error(Enofd); | |
| 1990/0227 | } | |
| 1991/0615/sys/src/9/port/sysfile.c:29,36 – 1991/0705/sys/src/9/port/sysfile.c:34,41 | ||
| 1990/0227 | { Chan *c; | |
| 1990/1210 |
| |
| 1990/0227 |
| |
| 1991/0705 | USED(c); if(fd<0 || NFD<=fd || (c = u->p->fgrp->fd[fd])==0) | |
| 1990/11211 | error(Ebadfd); | |
| 1990/1009 | if(mode<0 || c->mode==ORDWR) | |
| 1990/0227 | return c; | |
| 1991/0615/sys/src/9/port/sysfile.c:62,67 – 1991/0705/sys/src/9/port/sysfile.c:67,73 | ||
| 1990/1009 | int fd[2]; Chan *c[2]; Dev *d; | |
| 1991/0705 | Fgrp *f = u->p->fgrp; | |
| 1990/1009 | validaddr(arg[0], 2*BY2WD, 1); evenaddr(arg[0]); | |
| 1991/0615/sys/src/9/port/sysfile.c:75,83 – 1991/0705/sys/src/9/port/sysfile.c:81,89 | ||
| 1990/1009 | if(c[1]) close(c[1]); if(fd[0] >= 0) | |
| 1991/0705 | f->fd[fd[0]]=0; | |
| 1990/1009 | if(fd[1] >= 0) | |
| 1991/0705 | f->fd[fd[1]]=0; | |
| 1990/1009 | nexterror(); } c[1] = (*d->clone)(c[0], 0); | |
| 1991/0615/sys/src/9/port/sysfile.c:85,94 – 1991/0705/sys/src/9/port/sysfile.c:91,98 | ||
| 1990/1009 | (*d->walk)(c[1], "data1"); c[0] = (*d->open)(c[0], ORDWR); c[1] = (*d->open)(c[1], ORDWR); | |
| 1991/0705 | fd[0] = newfd(c[0]); fd[1] = newfd(c[1]); | |
| 1990/1009 | ((long*)arg[0])[0] = fd[0]; ((long*)arg[0])[1] = fd[1]; poperror(); | |
| 1991/0615/sys/src/9/port/sysfile.c:100,105 – 1991/0705/sys/src/9/port/sysfile.c:104,110 | ||
| 1990/0227 | { int fd; Chan *c, *oc; | |
| 1991/0705 | Fgrp *f = u->p->fgrp; | |
| 1990/0227 | /* * Close after dup'ing, so date > #d/1 works | |
| 1991/0615/sys/src/9/port/sysfile.c:109,125 – 1991/0705/sys/src/9/port/sysfile.c:114,139 | ||
| 1991/0221 | if(fd != -1){ if(fd<0 || NFD<=fd) error(Ebadfd); | |
| 1990/0227 |
| |
| 1991/0221 |
| |
| 1990/0227 |
| |
| 1991/0705 | lock(f); if(fd > f->maxfd) f->maxfd = fd; incref(c); oc = f->fd[fd]; f->fd[fd] = c; unlock(f); if(oc) close(oc); }else { if(waserror()) { close(c); nexterror(); } incref(c); fd = newfd(c); poperror(); | |
| 1990/0227 | } | |
| 1991/0705 | ||
| 1990/0227 | return fd; } | |
| 1991/0615/sys/src/9/port/sysfile.c:127,151 – 1991/0705/sys/src/9/port/sysfile.c:141,183 | ||
| 1990/0227 | sysopen(ulong *arg) { int fd; | |
| 1991/0705 | Chan *c = 0; | |
| 1990/0227 | openmode(arg[1]); /* error check only */ | |
| 1991/0705 | if(waserror()) { if(c) close(c); nexterror(); } | |
| 1990/0227 | validaddr(arg[0], 1, 0); c = namec((char*)arg[0], Aopen, arg[1], 0); | |
| 1991/0705 | fd = newfd(c); poperror(); | |
| 1990/0227 | return fd; } void | |
| 1991/0705 | fdclose(int fd, int flag) | |
| 1990/0227 | { int i; | |
| 1991/0705 | Chan *c; Fgrp *f = u->p->fgrp; | |
| 1990/0227 |
| |
| 1991/0705 | lock(f); c = f->fd[fd]; if(flag){ if(c==0 || !(c->flag&flag)){ unlock(f); return; } } f->fd[fd] = 0; if(fd == f->maxfd) for(i=fd; --i>=0 && f->fd[i]==0; ) f->maxfd = i; unlock(f); close(c); | |
| 1990/0227 | } long | |
| 1991/0615/sys/src/9/port/sysfile.c:154,161 – 1991/0705/sys/src/9/port/sysfile.c:186,193 | ||
| 1990/0227 | Chan *c; c = fdtochan(arg[0], -1); | |
| 1991/0705 | fdclose(arg[0], 0); | |
| 1990/0227 | return 0; } | |
| 1991/0615/sys/src/9/port/sysfile.c:183,190 – 1991/0705/sys/src/9/port/sysfile.c:215,222 | ||
| 1990/0227 | nexterror(); } nc = clone(mc, 0); | |
| 1991/0705 | close(mc); | |
| 1990/0227 | if(waserror()){ close(nc); nexterror(); | |
| 1991/0615/sys/src/9/port/sysfile.c:193,200 – 1991/0705/sys/src/9/port/sysfile.c:225,232 | ||
| 1990/0227 | 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 |
| |
| 1991/0705 | close(nc); | |
| 1990/0227 | if(nr > 0) return nr; /* | |
| 1991/0615/sys/src/9/port/sysfile.c:364,369 – 1991/0705/sys/src/9/port/sysfile.c:396,403 | ||
| 1990/0227 | Chan *c0, *c1; ulong flag; long ret; | |
| 1991/0705 | char *p; int t; | |
| 1990/0227 | struct{ Chan *chan; char *spec; | |
| 1991/0615/sys/src/9/port/sysfile.c:408,417 – 1991/0705/sys/src/9/port/sysfile.c:442,450 | ||
| 1990/0227 | close(c1); | |
| 1991/0614 | poperror(); close(c0); | |
| 1990/0227 |
| |
| 1991/0705 | if(ismount) fdclose(arg[0], 0); | |
| 1990/0227 | return ret; } | |
| 1991/0615/sys/src/9/port/sysfile.c:431,443 – 1991/0705/sys/src/9/port/sysfile.c:464,481 | ||
| 1990/0227 | syscreate(ulong *arg) { int fd; | |
| 1991/0705 | Chan *c = 0; | |
| 1990/0227 | openmode(arg[1]); /* error check only */ | |
| 1991/0705 | if(waserror()) { if(c) close(c); nexterror(); } | |
| 1990/0227 | validaddr(arg[0], 1, 0); c = namec((char*)arg[0], Acreate, arg[1], arg[2]); | |
| 1991/0705 | fd = newfd(c); poperror(); | |
| 1990/0227 | return fd; } | |
| 1991/0705/sys/src/9/port/sysfile.c:124,130 – 1991/0706/sys/src/9/port/sysfile.c:124,130 (short | long) | ||
| 1991/0705 | unlock(f); if(oc) close(oc); | |
| 1991/0706 | }else{ | |
| 1991/0705 | if(waserror()) { close(c); nexterror(); | |
| 1991/0705/sys/src/9/port/sysfile.c:144,150 – 1991/0706/sys/src/9/port/sysfile.c:144,150 | ||
| 1991/0705 | Chan *c = 0; | |
| 1990/0227 | openmode(arg[1]); /* error check only */ | |
| 1991/0705 |
| |
| 1991/0706 | if(waserror()){ | |
| 1991/0705 | if(c) close(c); nexterror(); | |
| 1991/0706/sys/src/9/port/sysfile.c:34,40 – 1991/0904/sys/src/9/port/sysfile.c:34,40 (short | long) | ||
| 1990/0227 | { Chan *c; | |
| 1991/0705 |
| |
| 1991/0904 | c = 0; | |
| 1991/0705 | if(fd<0 || NFD<=fd || (c = u->p->fgrp->fd[fd])==0) | |
| 1990/11211 | error(Ebadfd); | |
| 1990/1009 | if(mode<0 || c->mode==ORDWR) | |
| 1991/0706/sys/src/9/port/sysfile.c:183,191 – 1991/0904/sys/src/9/port/sysfile.c:183,189 | ||
| 1990/0227 | long sysclose(ulong *arg) { | |
| 1991/0904 | fdtochan(arg[0], -1); | |
| 1991/0705 | fdclose(arg[0], 0); | |
| 1990/0227 | return 0; | |
| Too many diffs (26 > 25). Stopping. | ||