diff options
| -rw-r--r-- | CHANGES | 5 | ||||
| -rw-r--r-- | emu/port/devcons.c | 38 | ||||
| -rw-r--r-- | emu/port/devtinyfs.c | 40 | ||||
| -rw-r--r-- | emu/port/inferno.c | 1 | ||||
| -rw-r--r-- | emu/port/pgrp.c | 26 | ||||
| -rw-r--r-- | include/NOTICE | 32 | ||||
| -rw-r--r-- | include/version.h | 2 | ||||
| -rw-r--r-- | man/3/cons | 13 | ||||
| -rw-r--r-- | os/port/devcons.c | 18 | ||||
| -rw-r--r-- | os/port/devtinyfs.c | 2 | ||||
| -rw-r--r-- | os/port/inferno.c | 1 | ||||
| -rw-r--r-- | os/port/pgrp.c | 24 |
12 files changed, 75 insertions, 127 deletions
@@ -1,3 +1,8 @@ +20090824 + delete unused (and somewhat incomplete) pin support +20090822 + in the what were we thinking dept: appl/cmd/touch.b and dis/touch.dis updated to avoid using an Arg after nil'ing it [thanks to cmbrannon] + make progmode propagate to pgrps; recover from exceptions in pgrp creation 20090821 emu/Nt/^(os.c ie-os.c) add #include <excpt.h> 20090819 diff --git a/emu/port/devcons.c b/emu/port/devcons.c index 8e823839..93dc6fd6 100644 --- a/emu/port/devcons.c +++ b/emu/port/devcons.c @@ -27,7 +27,6 @@ enum Qmsec, Qnotquiterandom, Qnull, - Qpin, Qrandom, Qscancode, Qsysctl, @@ -53,7 +52,6 @@ Dirtab contab[] = "msec", {Qmsec}, NUMSIZE, 0444, "notquiterandom", {Qnotquiterandom}, 0, 0444, "null", {Qnull}, 0, 0666, - "pin", {Qpin}, 0, 0666, "random", {Qrandom}, 0, 0444, "scancode", {Qscancode}, 0, 0444, "sysctl", {Qsysctl}, 0, 0644, @@ -283,8 +281,7 @@ consclose(Chan *c) static long consread(Chan *c, void *va, long n, vlong offset) { - ulong l; - int i, send; + int send; char *p, buf[64], ch; if(c->qid.type & QTDIR) @@ -309,12 +306,6 @@ consread(Chan *c, void *va, long n, vlong offset) genrandom(va, n); return n; - case Qpin: - p = "pin set"; - if(up->env->pgrp->pin == Nopin) - p = "no pin"; - return readstr(offset, va, n, p); - case Qhostowner: return readstr(offset, va, n, eve); @@ -333,20 +324,7 @@ consread(Chan *c, void *va, long n, vlong offset) return readstr(offset, va, n, buf); case Qdrivers: - p = malloc(READSTR); - if(p == nil) - error(Enomem); - l = 0; - for(i = 0; devtab[i] != nil; i++) - l += snprint(p+l, READSTR-l, "#%C %s\n", devtab[i]->dc, devtab[i]->name); - if(waserror()){ - free(p); - nexterror(); - } - n = readstr(offset, va, n, p); - poperror(); - free(p); - return n; + return devtabread(c, buf, n, offset); case Qmemory: return poolread(va, n, offset); @@ -490,16 +468,6 @@ conswrite(Chan *c, void *va, long n, vlong offset) case Qnull: break; - case Qpin: - if(up->env->pgrp->pin != Nopin) - error("pin already set"); - if(n >= sizeof(buf)) - n = sizeof(buf)-1; - strncpy(buf, va, n); - buf[n] = '\0'; - up->env->pgrp->pin = atoi(buf); - break; - case Qtime: if(n >= sizeof(buf)) n = sizeof(buf)-1; @@ -611,7 +579,9 @@ Dev consdevtab = { 'c', "cons", + devreset, consinit, + devshutdown, consattach, conswalk, consstat, diff --git a/emu/port/devtinyfs.c b/emu/port/devtinyfs.c index 33689745..8445ad6a 100644 --- a/emu/port/devtinyfs.c +++ b/emu/port/devtinyfs.c @@ -185,7 +185,7 @@ readdata(Tfs *fs, ulong bno, uchar *buf, int *lenp) { if(bno >= fs->nblocks) return 0; - if(devtab[fs->c->type]->read(fs->c, buf, Blen, Blen*bno) != Blen) + if(fs->c->dev->read(fs->c, buf, Blen, Blen*bno) != Blen) error(Eio); return validdata(fs, buf, lenp); } @@ -212,7 +212,7 @@ writedata(Tfs *fs, ulong bno, ulong next, uchar *buf, int len, int last) memmove(md.data, buf, len); md.sum = 0 - checksum((uchar*)&md); - if(devtab[fs->c->type]->write(fs->c, &md, Blen, Blen*bno) != Blen) + if(fs->c->dev->write(fs->c, &md, Blen, Blen*bno) != Blen) error(Eio); } @@ -233,7 +233,7 @@ writedir(Tfs *fs, Tfile *f) PUTS(md->pin, f->pin); md->sum = 0 - checksum(buf); - if(devtab[fs->c->type]->write(fs->c, buf, Blen, Blen*f->bno) != Blen) + if(fs->c->dev->write(fs->c, buf, Blen, Blen*f->bno) != Blen) error(Eio); } @@ -248,7 +248,7 @@ freeblocks(Tfs *fs, ulong bno, ulong bend) while(bno != bend && bno != Notabno){ mapclr(fs, bno); - if(devtab[fs->c->type]->read(fs->c, buf, Blen, Blen*bno) != Blen) + if(fs->c->dev->read(fs->c, buf, Blen, Blen*bno) != Blen) break; md = validdata(fs, buf, 0); if(md == 0) @@ -272,7 +272,7 @@ freefile(Tfs *fs, Tfile *f, ulong bend) /* change file type to free on medium */ if(f->bno != Notabno){ memset(buf, 0x55, Blen); - devtab[fs->c->type]->write(fs->c, buf, Blen, Blen*f->bno); + fs->c->dev->write(fs->c, buf, Blen, Blen*f->bno); mapclr(fs, f->bno); } @@ -332,7 +332,7 @@ newfile(Tfs *fs, char *name) rock.f->bno = mapalloc(rock.fs); rock.f->fbno = Notabno; rock.f->r = 1; - rock.f->pin = up->env->pgrp->pin; + rock.f->pin = Notapin; /* write directory block */ if(waserror()){ @@ -364,7 +364,7 @@ tfsinit(Tfs *fs) Mdir *mdir; Mdata *mdata; - n = devtab[fs->c->type]->stat(fs->c, dbuf, sizeof(dbuf)); + n = fs->c->dev->stat(fs->c, dbuf, sizeof(dbuf)); n = convM2D(dbuf, n, &d, nil); if(n <= 0) error("cannot stat tinyfs medium"); @@ -382,7 +382,7 @@ tfsinit(Tfs *fs) /* find files */ for(bno = 0; bno < fs->nblocks; bno++){ - n = devtab[fs->c->type]->read(fs->c, buf, Blen, Blen*bno); + n = fs->c->dev->read(fs->c, buf, Blen, Blen*bno); if(n != Blen) break; @@ -412,7 +412,7 @@ tfsinit(Tfs *fs) freefile(fs, f, bno); break; } - n = devtab[fs->c->type]->read(fs->c, buf, Blen, Blen*bno); + n = fs->c->dev->read(fs->c, buf, Blen, Blen*bno); if(n != Blen){ freefile(fs, f, bno); break; @@ -453,7 +453,7 @@ tinyfsgen(Chan *c, char *name, Dirtab *tab, int ntab, int i, Dir *dp) USED(ntab); USED(tab); - fs = &tinyfs.fs[c->dev]; + fs = &tinyfs.fs[c->devno]; if(i >= fs->nf) return -1; qid.vers = 0; @@ -525,7 +525,7 @@ tinyfsattach(char *spec) poperror(); c = devattach('F', spec); - c->dev = fs - tinyfs.fs; + c->devno = fs - tinyfs.fs; c->qid.type = QTDIR; c->qid.vers = 0; @@ -538,12 +538,12 @@ tinyfswalk(Chan *c, Chan *nc, char **name, int nname) Tfs *fs; Walkqid *wq; - fs = &tinyfs.fs[c->dev]; + fs = &tinyfs.fs[c->devno]; qlock(&fs->ql); wq = devwalk(c, nc, name, nname, 0, 0, tinyfsgen); if(wq != nil && (nc = wq->clone) != nil && nc->qid.path != Qdir){ - fs = &tinyfs.fs[nc->dev]; + fs = &tinyfs.fs[nc->devno]; fs->f[nc->qid.path-1].r++; } qunlock(&fs->ql); @@ -562,7 +562,7 @@ tinyfsopen(Chan *c, int omode) Tfile *f; volatile struct { Tfs *fs; } rock; - rock.fs = &tinyfs.fs[c->dev]; + rock.fs = &tinyfs.fs[c->devno]; if(c->qid.type & QTDIR){ if(omode != OREAD) @@ -600,7 +600,7 @@ tinyfscreate(Chan *c, char *name, int omode, ulong perm) USED(perm); - rock.fs = &tinyfs.fs[c->dev]; + rock.fs = &tinyfs.fs[c->devno]; qlock(&rock.fs->ql); if(waserror()){ @@ -625,7 +625,7 @@ tinyfsremove(Chan *c) if(c->qid.path == Qdir) error(Eperm); - fs = &tinyfs.fs[c->dev]; + fs = &tinyfs.fs[c->devno]; f = &fs->f[c->qid.path-1]; qlock(&fs->ql); freefile(fs, f, Notabno); @@ -639,7 +639,7 @@ tinyfsclose(Chan *c) Tfile *f, *nf; int i; - rock.fs = &tinyfs.fs[c->dev]; + rock.fs = &tinyfs.fs[c->devno]; qlock(&rock.fs->ql); @@ -703,7 +703,7 @@ tinyfsread(Chan *c, void *a, long n, vlong offset) return devdirread(c, a, n, 0, 0, tinyfsgen); p = a; - rock.fs = &tinyfs.fs[c->dev]; + rock.fs = &tinyfs.fs[c->devno]; f = &rock.fs->f[c->qid.path-1]; if(offset >= f->length) return 0; @@ -783,7 +783,7 @@ tinyfswrite(Chan *c, void *a, long n, vlong offset) return 0; p = a; - rock.fs = &tinyfs.fs[c->dev]; + rock.fs = &tinyfs.fs[c->devno]; f = &rock.fs->f[c->qid.path-1]; qlock(&rock.fs->ql); @@ -879,7 +879,9 @@ Dev tinyfsdevtab = { 'F', "tinyfs", + devreset, devinit, + devshutdown, tinyfsattach, tinyfswalk, tinyfsstat, diff --git a/emu/port/inferno.c b/emu/port/inferno.c index b568f9fa..eddacd20 100644 --- a/emu/port/inferno.c +++ b/emu/port/inferno.c @@ -859,7 +859,6 @@ Sys_pctl(void *fp) np.np->slash = cclone(dot); cnameclose(np.np->slash->name); np.np->slash->name = newcname("/"); - np.np->pin = o->pgrp->pin; /* pin is ALWAYS inherited */ np.np->nodevs = o->pgrp->nodevs; opg = o->pgrp; o->pgrp = np.np; diff --git a/emu/port/pgrp.c b/emu/port/pgrp.c index b3d473f3..55fa6c01 100644 --- a/emu/port/pgrp.c +++ b/emu/port/pgrp.c @@ -15,7 +15,6 @@ newpgrp(void) error(Enomem); p->r.ref = 1; p->pgrpid = incref(&pgrpid); - p->pin = Nopin; p->progmode = 0644; p->privatemem = 0; return p; @@ -44,8 +43,8 @@ closepgrp(Pgrp *p) } } wunlock(&p->ns); - cclose(p->slash); cclose(p->dot); + cclose(p->slash); free(p); } @@ -81,18 +80,23 @@ pgrpcpy(Pgrp *to, Pgrp *from) Mhead *f, **tom, **l, *mh; wlock(&from->ns); + if(waserror()){ + wunlock(&from->ns); + nexterror(); + } order = 0; tom = to->mnthash; for(i = 0; i < MNTHASH; i++) { l = tom++; for(f = from->mnthash[i]; f; f = f->hash) { rlock(&f->lock); - mh = malloc(sizeof(Mhead)); - if(mh == nil) { + if(waserror()){ runlock(&f->lock); - wunlock(&from->ns); - error(Enomem); + nexterror(); } + mh = malloc(sizeof(Mhead)); + if(mh == nil) + error(Enomem); mh->from = f->from; mh->r.ref = 1; incref(&mh->from->r); @@ -101,16 +105,12 @@ pgrpcpy(Pgrp *to, Pgrp *from) link = &mh->mount; for(m = f->mount; m; m = m->next) { n = newmount(mh, m->to, m->mflag, m->spec); - if(n == nil) { - runlock(&f->lock); - wunlock(&from->ns); - error(Enomem); - } m->copy = n; pgrpinsert(&order, m); *link = n; link = &n->next; } + poperror(); runlock(&f->lock); } } @@ -122,11 +122,11 @@ pgrpcpy(Pgrp *to, Pgrp *from) m->copy->mountid = mountid.ref++; unlock(&mountid.lk); - to->pin = from->pin; - + to->progmode = from->progmode; to->slash = cclone(from->slash); to->dot = cclone(from->dot); to->nodevs = from->nodevs; + poperror(); wunlock(&from->ns); } diff --git a/include/NOTICE b/include/NOTICE index a9a7616f..a7f86571 100644 --- a/include/NOTICE +++ b/include/NOTICE @@ -6,20 +6,24 @@ copyright notice that includes the copyright notice and the other notices below. It is fine (and often tidier) to do that in a separate file such as NOTICE, LICENCE or COPYING. -Copyright © 1995-1999 Lucent Technologies Inc. -Portions Copyright © 1997-2000 Vita Nuova Limited -Portions Copyright © 2000-2007 Vita Nuova Holdings Limited + Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. + Revisions Copyright © 2000-2008 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License (`LGPL') as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. -You should have received a copy of the GNU Lesser General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/include/version.h b/include/version.h index a9df1fc3..da14152d 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -#define VERSION "Fourth Edition (20090821)" +#define VERSION "Fourth Edition (20090824)" @@ -16,7 +16,6 @@ cons \- console device .B /dev/msec .B /dev/null .B /dev/notquiterandom -.B /dev/pin .B /dev/pointer .B /dev/random .B /dev/scancode @@ -161,18 +160,6 @@ If there is a visible image representing the pointer's position, that will move too. .PP The -.B pin -file, when read, returns either the string -.B "no pin -if no PIN has been set for authentication, or -.B "pin set -if one has. -The -.B pin -file may be written once with a decimal representation of the PIN -to use on this Inferno machine. -.PP -The .B random device returns as many bytes of random data as are requested in the .BR read . diff --git a/os/port/devcons.c b/os/port/devcons.c index 2f24a36f..28f4558f 100644 --- a/os/port/devcons.c +++ b/os/port/devcons.c @@ -626,7 +626,6 @@ enum{ Qmemory, Qmsec, Qnull, - Qpin, Qrandom, Qnotquiterandom, Qsysname, @@ -650,7 +649,6 @@ static Dirtab consdir[]= "memory", {Qmemory}, 0, 0444, "msec", {Qmsec}, NUMSIZE, 0444, "null", {Qnull}, 0, 0666, - "pin", {Qpin}, 0, 0666, "random", {Qrandom}, 0, 0444, "notquiterandom", {Qnotquiterandom}, 0, 0444, "sysname", {Qsysname}, 0, 0664, @@ -956,12 +954,6 @@ consread(Chan *c, void *buf, long n, vlong offset) else return qread(kscanq, buf, n); - case Qpin: - p = "pin set"; - if(up->env->pgrp->pin == Nopin) - p = "no pin"; - return readstr(offset, buf, n, p); - case Qtime: snprint(tmp, sizeof(tmp), "%.lld", (vlong)mseconds()*1000); return readstr(offset, buf, n, tmp); @@ -1146,16 +1138,6 @@ conswrite(Chan *c, void *va, long n, vlong offset) case Qnull: break; - case Qpin: - if(up->env->pgrp->pin != Nopin) - error("pin already set"); - if(n >= sizeof(buf)) - n = sizeof(buf)-1; - strncpy(buf, va, n); - buf[n] = '\0'; - up->env->pgrp->pin = atoi(buf); - return n; - case Qsysname: if(offset != 0) error(Ebadarg); diff --git a/os/port/devtinyfs.c b/os/port/devtinyfs.c index b63caf3f..19e1651f 100644 --- a/os/port/devtinyfs.c +++ b/os/port/devtinyfs.c @@ -337,7 +337,7 @@ newfile(Tfs *fs, char *name) rock.f->bno = mapalloc(rock.fs); rock.f->fbno = Notabno; rock.f->r = 1; - rock.f->pin = up->env->pgrp->pin; + rock.f->pin = Notapin; /* write directory block */ if(waserror()){ diff --git a/os/port/inferno.c b/os/port/inferno.c index 8858ec1e..7653f2d2 100644 --- a/os/port/inferno.c +++ b/os/port/inferno.c @@ -861,7 +861,6 @@ Sys_pctl(void *fp) np.np->slash = cclone(dot); cnameclose(np.np->slash->name); np.np->slash->name = newcname("/"); - np.np->pin = o->pgrp->pin; /* pin is ALWAYS inherited */ np.np->nodevs = o->pgrp->nodevs; opg = o->pgrp; o->pgrp = np.np; diff --git a/os/port/pgrp.c b/os/port/pgrp.c index 6b2d7d5c..309e2153 100644 --- a/os/port/pgrp.c +++ b/os/port/pgrp.c @@ -16,7 +16,6 @@ newpgrp(void) p = smalloc(sizeof(Pgrp)); p->ref = 1; p->pgrpid = incref(&pgrpid); - p->pin = Nopin; p->progmode = 0644; p->privatemem = 0; return p; @@ -83,18 +82,23 @@ pgrpcpy(Pgrp *to, Pgrp *from) Mhead *f, **tom, **l, *mh; wlock(&from->ns); + if(waserror()){ + wunlock(&from->ns); + nexterror(); + } order = 0; tom = to->mnthash; for(i = 0; i < MNTHASH; i++) { l = tom++; for(f = from->mnthash[i]; f; f = f->hash) { rlock(&f->lock); - mh = malloc(sizeof(Mhead)); - if(mh == nil) { + if(waserror()){ runlock(&f->lock); - wunlock(&from->ns); - error(Enomem); + nexterror(); } + mh = malloc(sizeof(Mhead)); + if(mh == nil) + error(Enomem); mh->from = f->from; mh->ref = 1; incref(mh->from); @@ -103,16 +107,12 @@ pgrpcpy(Pgrp *to, Pgrp *from) link = &mh->mount; for(m = f->mount; m; m = m->next) { n = newmount(mh, m->to, m->mflag, m->spec); - if(n == nil) { - runlock(&f->lock); - wunlock(&from->ns); - error(Enomem); - } m->copy = n; pgrpinsert(&order, m); *link = n; link = &n->next; } + poperror(); runlock(&f->lock); } } @@ -124,12 +124,12 @@ pgrpcpy(Pgrp *to, Pgrp *from) m->copy->mountid = mountid.ref++; unlock(&mountid.l); - to->pin = from->pin; - + to->progmode = from->progmode; to->slash = cclone(from->slash); to->dot = cclone(from->dot); to->nodevs = from->nodevs; + poperror(); wunlock(&from->ns); } |
