Add troff2png for htmlroff(1). [rsc] --rwxrwxr-x M 1428987 rsc sys 228 Jan 28 09:00 rc/bin/troff2png Small htmlroff fixes. [rsc] --rw-rw-r-- M 1428987 rsc sys 1831 Jan 27 16:07 sys/man/1/htmlroff [rsc] --rw-rw-r-- M 1428987 rsc sys 6608 Jan 28 09:30 sys/man/6/htmlroff [rsc] --rw-rw-r-- M 1428987 rsc sys 1711 Jan 28 09:22 sys/man/6/mhtml [rsc] --rw-rw-r-- M 1428987 rsc sys 6608 Jan 28 09:30 sys/man/6/htmlroff /n/sourcesdump/2006/0128/plan9/sys/man/6/htmlroff:305,317 - /n/sourcesdump/2006/0129/plan9/sys/man/6/htmlroff:305,317 The redirection stops on encountering the line .IR stop , optionally followed by white space and extra text. - This is a dangerous and clusmy request, as + This is a dangerous and clumsy request, as .I htmlroff stops interpreting its input during the redirection, so .I stop must be found in the input itself, not in a macro that the input might appear to call. - Although clusmy, + Although clumsy, .B .inputpipe allows input files to invoke .I troff [rsc] --rw-rw-r-- M 1428987 rsc sys 1711 Jan 28 09:22 sys/man/6/mhtml /n/sourcesdump/2006/0128/plan9/sys/man/6/mhtml:48,54 - /n/sourcesdump/2006/0129/plan9/sys/man/6/mhtml:48,54 tag, opens and closes the .B section, and opens - .B . + .BR . It invokes the .B .HEAD macro inside the [rsc] --rw-rw-r-- M 1428987 rsc sys 1625 Jan 28 09:33 sys/src/cmd/htmlroff/util.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/htmlroff/util.c:78,84 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/htmlroff/util.c:78,84 { va_list arg; - fprint(2, "%L: "); + fprint(2, "htmlroff: %L: "); va_start(arg, fmt); vfprint(2, fmt, arg); va_end(arg); Add more character sets to tcs(1). [rsc] --rw-rw-r-- M 1428987 rsc sys 16466 Jan 27 12:26 sys/src/cmd/tcs/8859.h [rsc] --rw-rw-r-- M 1428987 rsc sys 19274 Jan 27 12:26 sys/src/cmd/tcs/misc.h [rsc] --rw-rw-r-- M 1428987 rsc sys 44069 Jan 27 12:26 sys/src/cmd/tcs/ms.h More changes for htmlroff. [rsc] --rw-rw-r-- M 1428987 glenda sys 22383 Jan 28 09:23 sys/doc/lp.ms [diffs elided - too long] [diff -c /n/sourcesdump/2006/0128/plan9/sys/doc/lp.ms /n/sourcesdump/2006/0129/plan9/sys/doc/lp.ms] Kernel changes: - add background ccloses to make all processes killable - move away from vlongs in timer for performance - new event ctl message. [rsc] --rw-rw-r-- M 1428987 glenda sys 12062 Jan 28 09:29 sys/man/3/proc /n/sourcesdump/2006/0128/plan9/sys/man/3/proc:351,357 - /n/sourcesdump/2006/0129/plan9/sys/man/3/proc:351,363 perform a schedulability test and start scheduling the process as a real-time process if the test succeeds. If the test fails, the .B write - will fail with error set to the reason for failure. For details on real time, read on. + will fail with error set to the reason for failure. + .TP 10n + .B event + Add a user event to the + .B /proc/trace + file. + .PD .PP Real-time processes are periodically .IR released , [rsc] --rw-rw-r-- M 1428987 glenda sys 34790 Jan 28 09:24 sys/src/9/port/chan.c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/chan.c:487,492 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/chan.c:487,568 } /* + * Queue a chan to be closed by one of the clunk procs. + */ + struct { + Chan *head; + Chan *tail; + int nqueued; + int nclosed; + Lock l; + QLock q; + Rendez r; + } clunkq; + void closeproc(void*); + + void + ccloseq(Chan *c) + { + if(c->flag&CFREE) + panic("cclose %lux", getcallerpc(&c)); + + DBG("ccloseq %p name=%s ref=%ld\n", c, c->path->s, c->ref); + + if(decref(c)) + return; + + lock(&clunkq.l); + clunkq.nqueued++; + c->next = nil; + if(clunkq.head) + clunkq.tail->next = c; + else + clunkq.head = c; + clunkq.tail = c; + unlock(&clunkq.l); + + if(!wakeup(&clunkq.r)) + kproc("closeproc", closeproc, nil); + } + + static int + clunkwork(void*) + { + return clunkq.head != nil; + } + + void + closeproc(void*) + { + Chan *c; + + for(;;){ + qlock(&clunkq.q); + if(clunkq.head == nil){ + if(!waserror()){ + tsleep(&clunkq.r, clunkwork, nil, 5000); + poperror(); + } + if(clunkq.head == nil){ + qunlock(&clunkq.q); + pexit("no work", 1); + } + } + lock(&clunkq.l); + c = clunkq.head; + clunkq.head = c->next; + clunkq.nclosed++; + unlock(&clunkq.l); + qunlock(&clunkq.q); + if(!waserror()){ + devtab[c->type]->close(c); + poperror(); + } + chanfree(c); + } + } + + /* * Make sure we have the only copy of c. (Copy on write.) */ Chan* /n/sourcesdump/2006/0128/plan9/sys/src/9/port/chan.c:1691,1693 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/chan.c:1767,1770 free(m); } } + [rsc] --rw-rw-r-- M 1428987 glenda sys 14579 Jan 28 09:26 sys/src/9/port/devloopback.c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devloopback.c:143,149 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devloopback.c:143,149 lb->ref++; if(lb->ref == 1){ for(chan = 0; chan < 2; chan++){ - lb->link[chan].ci.mode = Tabsolute; + lb->link[chan].ci.mode = Trelative; lb->link[chan].ci.a = &lb->link[chan]; lb->link[chan].ci.f = linkintr; lb->link[chan].limit = Loopqlim; /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devloopback.c:685,691 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devloopback.c:685,691 if(!tin || tin > tout && tout) tin = tout; - link->ci.ns = tin; + link->ci.ns = tin - now; if(tin){ if(tin < now) panic("loopback unfinished business"); [rsc] --rw-rw-r-- M 1428987 glenda sys 30866 Jan 28 09:23 sys/src/9/port/devsd.c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devsd.c:636,641 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devsd.c:636,642 sdev = sdgetdev(DEV(c->qid)); if(sdev == nil) error(Enonexist); + unit = sdev->unit[UNIT(c->qid)]; switch(TYPE(c->qid)){ /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devsd.c:646,651 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devsd.c:647,653 c->qid.vers = unit->vers; if(tas(&unit->rawinuse) != 0){ c->flag &= ~COPEN; + decref(&sdev->r); error(Einuse); } unit->state = Rawcmd; /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devsd.c:655,660 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devsd.c:657,663 if(waserror()){ qunlock(&unit->ctl); c->flag &= ~COPEN; + decref(&sdev->r); nexterror(); } pp = &unit->part[PART(c->qid)]; /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devsd.c:704,711 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devsd.c:707,716 ulong bno, max, nb, offset; sdev = sdgetdev(DEV(c->qid)); - if(sdev == nil) + if(sdev == nil){ + decref(&sdev->r); error(Enonexist); + } unit = sdev->unit[UNIT(c->qid)]; if(unit == nil) error(Enonexist); /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devsd.c:1101,1107 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devsd.c:1106,1112 if(unit->sectors){ if(unit->dev->ifc->rctl == nil) l += snprint(p+l, m-l, - "geometry %ld %ld\n", + "geometry %lud %ld\n", unit->sectors, unit->secsize); pp = unit->part; for(i = 0; i < unit->npart; i++){ [jmk] --rw-rw-r-- M 1428987 glenda sys 13489 Jan 28 13:22 sys/src/9/port/edf.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/edf.c /n/sourcesdump/2006/0129/plan9/sys/src/9/port/edf.c] [rsc] --rw-rw-r-- M 1428987 glenda sys 4760 Jan 28 09:24 sys/src/9/port/pgrp.c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/pgrp.c:211,223 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/pgrp.c:211,262 if(decref(f) != 0) return; + /* + * If we get into trouble, forceclosefgrp + * will bail us out. + */ + up->closingfgrp = f; for(i = 0; i <= f->maxfd; i++) - if(c = f->fd[i]) + if(c = f->fd[i]){ + f->fd[i] = nil; cclose(c); + } + up->closingfgrp = nil; free(f->fd); free(f); } + + /* + * Called from sleep because up is in the middle + * of closefgrp and just got a kill ctl message. + * This usually means that up has wedged because + * of some kind of deadly embrace with mntclose + * trying to talk to itself. To break free, hand the + * unclosed channels to the close queue. Once they + * are finished, the blocked cclose that we've + * interrupted will finish by itself. + */ + void + forceclosefgrp(void) + { + int i; + Chan *c; + Fgrp *f; + + if(up->procctl != Proc_exitme || up->closingfgrp == nil){ + print("bad forceclosefgrp call"); + return; + } + + f = up->closingfgrp; + for(i = 0; i <= f->maxfd; i++) + if(c = f->fd[i]){ + f->fd[i] = nil; + ccloseq(c); + } + } + Mount* newmount(Mhead *mh, Chan *to, int flag, char *spec) [rsc] --rw-rw-r-- M 1428987 glenda sys 4211 Jan 28 09:26 sys/src/9/port/portclock.c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/portclock.c:17,23 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/portclock.c:17,23 ulong intrcount[MAXMACH]; ulong fcallcount[MAXMACH]; - static uvlong + static vlong tadd(Timers *tt, Timer *nt) { Timer *t, **last; /n/sourcesdump/2006/0128/plan9/sys/src/9/port/portclock.c:29,40 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/portclock.c:29,38 panic("timer"); break; case Trelative: - assert(nt->tns > 0); + if(nt->tns <= 0) + nt->tns = 1; nt->twhen = fastticks(nil) + ns2fastticks(nt->tns); break; - case Tabsolute: - nt->twhen = tod2fastticks(nt->tns); - break; case Tperiodic: assert(nt->tns >= 100000); /* At least 100 µs period */ if(nt->twhen == 0){ /n/sourcesdump/2006/0128/plan9/sys/src/9/port/portclock.c:94,108 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/portclock.c:92,97 Timers *tt; vlong when; - if (nt->tmode == Tabsolute){ - when = todget(nil); - if (nt->tns <= when){ - // if (nt->tns + MS2NS(10) <= when) /* small deviations will happen */ - // print("timeradd (%lld %lld) %lld too early 0x%lux\n", - // when, nt->tns, when - nt->tns, getcallerpc(&nt)); - nt->tns = when; - } - } /* Must lock Timer struct before Timers struct */ ilock(nt); if(tt = nt->tt){ [rsc] --rw-rw-r-- M 1428987 glenda sys 22535 Jan 28 09:26 sys/src/9/port/portdat.h /n/sourcesdump/2006/0128/plan9/sys/src/9/port/portdat.h:506,512 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/portdat.h:506,511 enum { /* Mode */ Trelative, /* timer programmed in ns from now */ - Tabsolute, /* timer programmed in ns since epoch */ Tperiodic, /* periodic timer, period in ns */ }; /n/sourcesdump/2006/0128/plan9/sys/src/9/port/portdat.h:630,635 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/portdat.h:629,636 Egrp *egrp; /* Environment group */ Fgrp *fgrp; /* File descriptor group */ Rgrp *rgrp; /* Rendez group */ + + Fgrp *closingfgrp; /* used during teardown */ ulong parentpid; ulong time[6]; /* User, Sys, Real; child U, S, R */ [rsc] --rw-rw-r-- M 1428987 glenda sys 6279 Jan 28 09:54 sys/src/9/pc/i8253.c [rsc] --rw-rw-r-- M 1428987 glenda sys 5704 Jan 28 09:52 sys/src/9/port/alloc.c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/alloc.c:95,100 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/alloc.c:95,101 pv = p->private; ilock(&pv->lk); + pv->lk.pc = getcallerpc(&p); pv->msg[0] = 0; } [rsc] --rw-rw-r-- M 1428987 glenda sys 7265 Jan 28 09:50 sys/src/9/port/fault.c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/fault.c:11,17 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/fault.c:11,17 Segment *s; char *sps; - if(up && up->nlocks.ref) print("fault nlocks %ld\n", up->nlocks.ref); + if(up->nlocks.ref) print("fault nlocks %ld\n", up->nlocks.ref); sps = up->psstate; up->psstate = "Fault"; [rsc] --rw-rw-r-- M 1428987 glenda sys 5336 Jan 28 09:45 sys/src/9/port/tod.c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/tod.c:31,43 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/tod.c:31,46 /* frequency of the tod clock */ #define TODFREQ 1000000000ULL + #define MicroFREQ 1000000ULL struct { int init; // true if initialized ulong cnt; Lock; - uvlong multiplier; // t = off + (multiplier*ticks)>>31 - uvlong divider; // ticks = (divider*(ticks-off))>>31 + uvlong multiplier; // ns = off + (multiplier*ticks)>>31 + uvlong divider; // ticks = (divider*(ns-off))>>31 + uvlong umultiplier; // µs = (µmultiplier*ticks)>>31 + uvlong udivider; // ticks = (µdivider*µs)>>31 vlong hz; // frequency of fast clock vlong last; // last reading of fast clock vlong off; // offset from epoch to last /n/sourcesdump/2006/0128/plan9/sys/src/9/port/tod.c:72,78 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/tod.c:75,82 /* calculate multiplier for time conversion */ tod.multiplier = mk64fract(TODFREQ, f); tod.divider = mk64fract(f, TODFREQ); - + tod.umultiplier = mk64fract(MicroFREQ, f); + tod.udivider = mk64fract(f, MicroFREQ); iunlock(&tod); } /n/sourcesdump/2006/0128/plan9/sys/src/9/port/tod.c:211,216 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/tod.c:215,242 x = x/TODFREQ; i = x; return i; + } + + uvlong + fastticks2us(uvlong ticks) + { + uvlong res; + + if(!tod.init) + todinit(); + mul64fract(&res, ticks, tod.umultiplier); + return res; + } + + uvlong + us2fastticks(uvlong us) + { + uvlong res; + + if(!tod.init) + todinit(); + mul64fract(&res, us, tod.udivider); + return res; } // convert milliseconds to fast ticks [rsc] --rw-rw-r-- M 1428987 glenda sys 11079 Jan 28 12:32 sys/src/9/port/portfns.h /n/sourcesdump/2006/0128/plan9/sys/src/9/port/portfns.h:31,36 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/portfns.h:31,37 void cinit(void); Chan* cclone(Chan*); void cclose(Chan*); + void ccloseq(Chan*); void closeegrp(Egrp*); void closefgrp(Fgrp*); void closepgrp(Pgrp*); /n/sourcesdump/2006/0128/plan9/sys/src/9/port/portfns.h:102,107 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/portfns.h:103,109 void exit(int); uvlong fastticks(uvlong*); uvlong fastticks2ns(uvlong); + uvlong fastticks2us(uvlong); int fault(ulong, int); void fdclose(int, int); Chan* fdtochan(int, int, int, int); /n/sourcesdump/2006/0128/plan9/sys/src/9/port/portfns.h:108,113 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/portfns.h:110,116 int findmount(Chan**, Mhead**, int, int, Qid); int fixfault(Segment*, ulong, int, int); void flushmmu(void); + void forceclosefgrp(void); void forkchild(Proc*, Ureg*); void forkret(void); void free(void*); /n/sourcesdump/2006/0128/plan9/sys/src/9/port/portfns.h:336,342 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/portfns.h:339,344 void todinit(void); void todset(vlong, vlong, int); Block* trimblock(Block*, int, int); - void tnsleep(Rendez*, int (*)(void*), void*, vlong); void tsleep(Rendez*, int (*)(void*), void*, ulong); int uartctl(Uart*, char*); int uartgetc(void); /n/sourcesdump/2006/0128/plan9/sys/src/9/port/portfns.h:351,356 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/portfns.h:353,359 void uncachepage(Page*); long unionread(Chan*, void*, long); void unlock(Lock*); + uvlong us2fastticks(uvlong); void userinit(void); ulong userpc(void); long userwrite(char*, int); [rsc] --rw-rw-r-- M 1428987 glenda sys 28497 Jan 28 12:29 sys/src/9/port/devproc.c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devproc.c:62,67 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devproc.c:62,68 CMadmit, CMextra, CMexpel, + CMevent, }; enum{ /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devproc.c:125,130 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devproc.c:126,132 CMadmit, "admit", 1, CMextra, "extra", 1, CMexpel, "expel", 1, + CMevent, "event", 1, }; /* Segment type from portdat.h */ /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devproc.c:1289,1294 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devproc.c:1291,1297 Cmdtab *ct; vlong time; char *e; + void (*pt)(Proc*, int, vlong); if(p->kp) /* no ctl requests to kprocs */ error(Eperm); /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devproc.c:1317,1329 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devproc.c:1320,1332 unbreak(p); break; case Stopped: - postnote(p, 0, "sys: killed", NExit); p->procctl = Proc_exitme; + postnote(p, 0, "sys: killed", NExit); ready(p); break; default: - postnote(p, 0, "sys: killed", NExit); p->procctl = Proc_exitme; + postnote(p, 0, "sys: killed", NExit); } break; case CMnohang: /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devproc.c:1402,1411 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devproc.c:1405,1414 case CMperiod: if(p->edf == nil) edfinit(p); - if(e=parsetime(&time, cb->f[1])) + if(e=parsetime(&time, cb->f[1])) /* time in ns */ error(e); edfstop(p); - p->edf->T = time; + p->edf->T = time/1000; /* Edf times are in µs */ break; case CMdeadline: if(p->edf == nil) /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devproc.c:1413,1419 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devproc.c:1416,1422 if(e=parsetime(&time, cb->f[1])) error(e); edfstop(p); - p->edf->D = time; + p->edf->D = time/1000; break; case CMcost: if(p->edf == nil) /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devproc.c:1421,1427 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devproc.c:1424,1430 if(e=parsetime(&time, cb->f[1])) error(e); edfstop(p); - p->edf->C = time; + p->edf->C = time/1000; break; case CMsporadic: if(p->edf == nil) /n/sourcesdump/2006/0128/plan9/sys/src/9/port/devproc.c:1447,1452 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/devproc.c:1450,1460 case CMexpel: if(p->edf) edfstop(p); + break; + case CMevent: + pt = proctrace; + if(up->trace && pt) + pt(up, SUser, 0); break; } [rsc] --rw-rw-r-- M 1428987 sape sys 1195 Jan 28 12:24 sys/src/9/port/edf.h /n/sourcesdump/2006/0128/plan9/sys/src/9/port/edf.h:16,44 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/edf.h:16,45 typedef struct Edf Edf; struct Edf { + /* All times in µs */ /* time intervals */ - vlong D; /* Deadline */ - vlong Delta; /* Inherited deadline */ - vlong T; /* period */ - vlong C; /* Cost */ - vlong S; /* Slice: time remaining in this period */ - /* times */ - vlong r; /* (this) release time */ - vlong d; /* (this) deadline */ - vlong t; /* Start of next period, t += T at release */ - vlong s; /* Time at which this proc was last scheduled */ + long D; /* Deadline */ + long Delta; /* Inherited deadline */ + long T; /* period */ + long C; /* Cost */ + long S; /* Slice: time remaining in this period */ + /* times (only low-order bits of absolute time) */ + long r; /* (this) release time */ + long d; /* (this) deadline */ + long t; /* Start of next period, t += T at release */ + long s; /* Time at which this proc was last scheduled */ /* for schedulability testing */ - vlong testDelta; - int testtype; /* Release or Deadline */ - vlong testtime; + long testDelta; + int testtype; /* Release or Deadline */ + long testtime; Proc *testnext; /* other */ ushort flags; Timer; /* Stats */ - vlong edfused; - vlong extraused; - vlong aged; + long edfused; + long extraused; + long aged; ulong periods; ulong missed; }; /n/sourcesdump/2006/0128/plan9/sys/src/9/port/edf.h:45,51 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/edf.h:46,52 extern Lock edftestlock; /* for atomic admitting/expelling */ - #pragma varargck type "t" vlong + #pragma varargck type "t" long #pragma varargck type "U" uvlong /* Interface: */ [rsc] --rw-rw-r-- M 1428987 glenda sys 479 Jan 28 12:30 sys/src/9/port/master /n/sourcesdump/2006/0128/plan9/sys/src/9/port/master:9,15 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/master:9,14 D ssl E sdp F flash - F tinyfs I ip K kprof L lpt /n/sourcesdump/2006/0128/plan9/sys/src/9/port/master:20,26 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/master:19,24 U usb V lml V tv - X loopback Y pccard a tls b irq /n/sourcesdump/2006/0128/plan9/sys/src/9/port/master:43,49 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/master:41,46 w wd y i82365 y pcmcia - z mntstats | pipe ¤ cap κ kbmap [rsc] --rw-rw-r-- M 1428987 glenda sys 28053 Jan 28 12:29 sys/src/9/port/proc.c /n/sourcesdump/2006/0128/plan9/sys/src/9/port/proc.c:776,781 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/proc.c:776,783 if(up->notepending) { up->notepending = 0; splx(s); + if(up->procctl == Proc_exitme && up->closingfgrp) + forceclosefgrp(); error(Eintr); } /n/sourcesdump/2006/0128/plan9/sys/src/9/port/proc.c:1320,1326 - /n/sourcesdump/2006/0129/plan9/sys/src/9/port/proc.c:1322,1329 p->nerrlab = 0; p->slash = up->slash; p->dot = up->dot; - incref(p->dot); + if(p->dot) + incref(p->dot); memmove(p->note, up->note, sizeof(p->note)); p->nnote = up->nnote; [rsc] --rw-rw-r-- M 1428987 presotto sys 19884 Jan 28 12:31 sys/src/9/ppc/devflash.c /n/sourcesdump/2006/0128/plan9/sys/src/9/ppc/devflash.c:813,819 - /n/sourcesdump/2006/0129/plan9/sys/src/9/ppc/devflash.c:813,819 * If someone learns better, please email me, though * I doubt it will be much faster. - presotto@bell-labs.com */ - static ulong + static long ise_wbwrite(Flash *flash, Fword *p, int n, ulong off, ulong baddr, ulong *status) { Fword x; [rsc] --rw-rw-r-- M 1428987 presotto sys 17084 Jan 28 12:31 sys/src/9/ppc/trap.c /n/sourcesdump/2006/0128/plan9/sys/src/9/ppc/trap.c:225,232 - /n/sourcesdump/2006/0129/plan9/sys/src/9/ppc/trap.c:225,234 if(!user) panic("syscall in kernel: srr1 0x%4.4luX\n", ureg->srr1); syscall(ureg); - if (up->delaysched) + if (up->delaysched){ sched(); + splhi(); + } kexit(ureg); return; /* syscall() calls notify itself, don't do it again */ [jmk] --rw-rw-r-- M 1428987 glenda sys 13489 Jan 28 13:22 sys/src/9/port/edf.c [jmk] --rw-rw-r-- M 1428987 glenda bitsy 5941 Jan 28 21:12 sys/src/9/bitsy/dat.h /n/sourcesdump/2006/0128/plan9/sys/src/9/bitsy/dat.h:32,37 - /n/sourcesdump/2006/0129/plan9/sys/src/9/bitsy/dat.h:32,41 */ #define AOUT_MAGIC (E_MAGIC) + enum { + Lockcycles = 0, /* Don't measure lock latencies */ + }; + struct Lock { ulong key; /n/sourcesdump/2006/0128/plan9/sys/src/9/bitsy/dat.h:40,45 - /n/sourcesdump/2006/0129/plan9/sys/src/9/bitsy/dat.h:44,50 Proc *p; Mach *m; ushort isilock; + uvlong lockcycles; /* Measure lock latencies */ }; struct Label [jmk] --rw-rw-r-- M 1428987 glenda bitsy 16830 Jan 28 21:10 sys/src/9/bitsy/devflash.c /n/sourcesdump/2006/0128/plan9/sys/src/9/bitsy/devflash.c:728,734 - /n/sourcesdump/2006/0129/plan9/sys/src/9/bitsy/devflash.c:728,734 * If someone learns better, please email me, though * I doubt it will be much faster. - presotto@bell-labs.com */ - static ulong + static int ise_wbwrite(ulong *p, int n, ulong off, ulong baddr, ulong *status) { ulong x, start; Use htmlroff in doc mkfiles. [rsc] --rw-rw-r-- M 1428987 glenda sys 214 Jan 28 09:41 sys/doc/8½/mkfile /n/sourcesdump/2006/0128/plan9/sys/doc/8½/mkfile:4,8 - /n/sourcesdump/2006/0129/plan9/sys/doc/8½/mkfile:4,9 {echo $FONTS; cat 8½.ms} | tbl | troff -ms -mpictures -mnihongo | lp -dstdout >8½.ps ../cleanps 8½.ps - 8½.html:D: - {echo $FONTS; cat 8½.ms} | tbl | ms2html >8½.html + 8½.html:D: 8½.ms + tbl 8½.ms | htmlroff -ms -mhtml >8½.html + [rsc] --rw-rw-r-- M 1428987 glenda sys 295 Jan 28 09:41 sys/doc/acme/mkfile /n/sourcesdump/2006/0128/plan9/sys/doc/acme/mkfile:8,12 - /n/sourcesdump/2006/0129/plan9/sys/doc/acme/mkfile:8,12 ../cleanps acme.ps acme.html:D: acme.ms - {echo $FONTS; cat acme.ms} | ms2html >acme.html + htmlroff -ms -mhtml acme.ms >acme.html [rsc] --rw-rw-r-- M 1428987 glenda sys 273 Jan 28 09:41 sys/doc/fs/mkfile /n/sourcesdump/2006/0128/plan9/sys/doc/fs/mkfile:18,21 - /n/sourcesdump/2006/0129/plan9/sys/doc/fs/mkfile:18,22 {echo $FONTS; cat $OBJ } | troff -ms >fs.trout fs.html:D: - {echo $FONTS; cat $OBJ } | ms2html >fs.html + htmlroff -ms -mhtml $OBJ >fs.html + [rsc] --rw-rw-r-- M 1428987 glenda sys 206 Jan 28 09:41 sys/doc/il/mkfile /n/sourcesdump/2006/0128/plan9/sys/doc/il/mkfile:5,8 - /n/sourcesdump/2006/0129/plan9/sys/doc/il/mkfile:5,9 ../cleanps il.ps il.html:D: il.ms transition.pic - {echo $FONTS; cat il.ms} | pic | ms2html >il.html + pic il.ms | htmlroff -ms -mhtml >il.html + [rsc] --rw-rw-r-- M 1428987 glenda sys 334 Jan 28 09:41 sys/doc/net/mkfile /n/sourcesdump/2006/0128/plan9/sys/doc/net/mkfile:14,17 - /n/sourcesdump/2006/0129/plan9/sys/doc/net/mkfile:14,18 pic tree > tree.pout net.html:D: $DEPS - { echo $FONTS; cat net.ms } | tbl | ms2html > net.html + tbl net.ms | htmlroff -ms -mhtml >net.html + [rsc] --rw-rw-r-- M 1428987 glenda sys 566 Jan 28 09:41 sys/doc/sam/mkfile /n/sourcesdump/2006/0128/plan9/sys/doc/sam/mkfile:11,14 - /n/sourcesdump/2006/0129/plan9/sys/doc/sam/mkfile:11,15 troff -ms sam.tut > sam.tut.out sam.html:D: sam.ms fig1.ps fig2.ps fig3.ps fig4.ps fig5.pic fig6.pic fig7.pic refs - {echo $FONTS; cat sam.ms refs} | pic | tbl | ms2html >sam.html + pic sam.ms refs | tbl | htmlroff -ms -mhtml >sam.html + Fix a few floating-point conversions in 8c. [rsc] --rw-rw-r-- M 1428987 glenda sys 23789 Jan 28 09:53 sys/src/cmd/8c/txt.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/8c/txt.c:791,799 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/8c/txt.c:791,797 case CASE( TFLOAT, TSHORT): case CASE( TFLOAT, TUSHORT): case CASE( TFLOAT, TINT): - case CASE( TFLOAT, TUINT): case CASE( TFLOAT, TLONG): - case CASE( TFLOAT, TULONG): case CASE( TFLOAT, TIND): case CASE( TDOUBLE,TCHAR): /n/sourcesdump/2006/0128/plan9/sys/src/cmd/8c/txt.c:801,820 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/8c/txt.c:799,806 case CASE( TDOUBLE,TSHORT): case CASE( TDOUBLE,TUSHORT): case CASE( TDOUBLE,TINT): - case CASE( TDOUBLE,TUINT): case CASE( TDOUBLE,TLONG): - case CASE( TDOUBLE,TULONG): case CASE( TDOUBLE,TIND): - - case CASE( TVLONG, TCHAR): - case CASE( TVLONG, TUCHAR): - case CASE( TVLONG, TSHORT): - case CASE( TVLONG, TUSHORT): - case CASE( TVLONG, TINT): - case CASE( TVLONG, TUINT): - case CASE( TVLONG, TLONG): - case CASE( TVLONG, TULONG): - case CASE( TVLONG, TIND): if(fproundflg) { regsalloc(&nod, ®node); gins(AFMOVLP, f, &nod); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/8c/txt.c:834,846 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/8c/txt.c:820,845 return; /* + * float to ulong + */ + case CASE( TDOUBLE, TULONG): + case CASE( TFLOAT, TULONG): + case CASE( TDOUBLE, TUINT): + case CASE( TFLOAT, TUINT): + regsalloc(&nod, ®node); + gmove(f, &fregnode0); + gins(AFADDD, nodfconst(-2147483648.), &fregnode0); + gins(AFMOVLP, f, &nod); + gins(ASUBL, nodconst(-2147483648), &nod); + gmove(&nod, t); + return; + + /* * ulong to float */ case CASE( TULONG, TDOUBLE): - case CASE( TULONG, TVLONG): case CASE( TULONG, TFLOAT): case CASE( TUINT, TDOUBLE): - case CASE( TUINT, TVLONG): case CASE( TUINT, TFLOAT): regalloc(&nod, f, f); gmove(f, &nod); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/8c/txt.c:873,886 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/8c/txt.c:872,877 case CASE( TINT, TDOUBLE): case CASE( TLONG, TDOUBLE): case CASE( TIND, TDOUBLE): - - case CASE( TCHAR, TVLONG): - case CASE( TUCHAR, TVLONG): - case CASE( TSHORT, TVLONG): - case CASE( TUSHORT,TVLONG): - case CASE( TINT, TVLONG): - case CASE( TLONG, TVLONG): - case CASE( TIND, TVLONG): regsalloc(&nod, ®node); gmove(f, &nod); gins(AFMOVL, &nod, &fregnode0); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/8c/txt.c:891,905 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/8c/txt.c:882,890 */ case CASE( TFLOAT, TFLOAT): case CASE( TDOUBLE,TFLOAT): - case CASE( TVLONG, TFLOAT): case CASE( TFLOAT, TDOUBLE): case CASE( TDOUBLE,TDOUBLE): - case CASE( TVLONG, TDOUBLE): - - case CASE( TFLOAT, TVLONG): - case CASE( TDOUBLE,TVLONG): - case CASE( TVLONG, TVLONG): a = AFMOVD; break; } if(a == AMOVL || a == AFMOVD) Handle not having graphics better. [rsc] --rw-rw-r-- M 1428987 rsc sys 6066 Jan 28 09:54 sys/src/cmd/aux/statusbar.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/aux/statusbar.c:200,211 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/aux/statusbar.c:200,214 textmode = 1; rbar = Rect(0, 0, 60, 1); }else{ - initdraw(0, 0, "bar"); + if(initdraw(0, 0, "bar") < 0) + exits("initdraw"); initcolor(); einit(Emouse|Ekeyboard); eresized(0); } bar(&b); + + exits(0); } Formatting nits. [rsc] --rw-rw-r-- M 1428987 glenda sys 640 Jan 28 09:53 sys/include/trace.h /n/sourcesdump/2006/0128/plan9/sys/include/trace.h:19,24 - /n/sourcesdump/2006/0129/plan9/sys/include/trace.h:19,24 typedef struct Traceevent Traceevent; struct Traceevent { ulong pid; - ulong etype; /* Event type */ - vlong time; /* time stamp */ + ulong etype; /* Event type */ + vlong time; /* time stamp */ }; Update ms2html man page. [rsc] --rw-rw-r-- M 1428987 glenda sys 1252 Jan 28 09:34 sys/man/1/ms2html /n/sourcesdump/2006/0128/plan9/sys/man/1/ms2html:2,10 - /n/sourcesdump/2006/0129/plan9/sys/man/1/ms2html:2,22 .SH NAME ms2html, html2ms \- convert between troff's ms macros and html .SH SYNOPSIS - .B ms2html < input > output + .B ms2html + [ + .B -q + ] [ + .B -b + .I basename + ] [ + .B -d + .I delims + ] [ + .B -t + .I title + ] .br - .B html2ms < input > output + .B html2ms .SH DESCRIPTION .I Ms2html converts the /n/sourcesdump/2006/0128/plan9/sys/man/1/ms2html:28,37 - /n/sourcesdump/2006/0129/plan9/sys/man/1/ms2html:40,74 macro, unknown to .IR ms (6), and take its value. + Options are: + .TF q + .IP q + suppresses warnings about malformed input; + .IP b + sets the HTML base name to + .IR basename ; + .IP d + sets the + .IR eqn (1) + delimiters to + .IR delim ; + .IP t + sets the HTML title to + .IR title . + .PD + .PP + .I Html2ms + reads HTML from standard input and converts it + to + .IR ms (6) + source on standard output. .SH SOURCE .B /sys/src/cmd/ms2html.c .br .B /sys/src/cmd/html2ms.c + .SH SEE ALSO + .IR htmlroff (1), + .IR ms (6) .SH BUGS .PP Ms2html doesn't understand a number of troff Update example. [rsc] --rw-rw-r-- M 1428987 glenda sys 13853 Jan 28 09:55 sys/man/8/prep /n/sourcesdump/2006/0128/plan9/sys/man/8/prep:668,674 - /n/sourcesdump/2006/0129/plan9/sys/man/8/prep:668,675 Create a Plan 9 boot floppy on a previously formatted diskette: .IP .EX - disk/format -b /386/pbs -df /dev/fd0disk /386/9load /tmp/plan9.ini + disk/format -b /386/pbs -df /dev/fd0disk \e + /386/9load /tmp/plan9.ini /386/9pcf.gz .EE .PP Initialize the blank hard disk /n/sourcesdump/2006/0128/plan9/sys/man/8/prep:678,684 - /n/sourcesdump/2006/0129/plan9/sys/man/8/prep:679,686 disk/mbr -m /386/mbr /dev/sdC0/data disk/fdisk -baw /dev/sdC0/data disk/prep -bw -a^(9fat fs cache swap) /dev/sdC0/plan9 - disk/format -b /386/pbslba -d -r 2 /dev/sdC0/9fat 9load 9pcdisk plan9.ini + disk/format -b /386/pbslba -d -r 2 /dev/sdC0/9fat \e + /386/9load /386/9pcf /tmp/plan9.ini .EE .PP .SH SOURCE Add needstack to libthread. [rsc] --rw-rw-r-- M 1428987 glenda sys 3616 Jan 28 10:48 sys/include/thread.h /n/sourcesdump/2006/0128/plan9/sys/include/thread.h:69,74 - /n/sourcesdump/2006/0129/plan9/sys/include/thread.h:69,75 int nbsend(Channel *c, void *v); int nbsendp(Channel *c, void *v); int nbsendul(Channel *c, ulong v); + void needstack(int); int proccreate(void (*f)(void *arg), void *arg, uint stacksize); int procrfork(void (*f)(void *arg), void *arg, uint stacksize, int flag); void** procdata(void); [rsc] --rw-rw-r-- M 1428987 glenda sys 3342 Jan 28 10:47 sys/src/libthread/sched.c /n/sourcesdump/2006/0128/plan9/sys/src/libthread/sched.c:78,83 - /n/sourcesdump/2006/0129/plan9/sys/src/libthread/sched.c:78,101 } void + needstack(int n) + { + int x; + Proc *p; + Thread *t; + + p = _threadgetproc(); + t = p->thread; + + if((uchar*)&x - n < (uchar*)t->stk){ + fprint(2, "%s %d: &x=%p n=%d t->stk=%p\n", + argv0, getpid(), &x, n, t->stk); + fprint(2, "%s %d: stack overflow\n", argv0, getpid()); + abort(); + } + } + + void _sched(void) { Proc *p; /n/sourcesdump/2006/0128/plan9/sys/src/libthread/sched.c:86,93 - /n/sourcesdump/2006/0129/plan9/sys/src/libthread/sched.c:104,110 Resched: p = _threadgetproc(); if((t = p->thread) != nil){ - if((uchar*)&p < t->stk) /* stack overflow */ - abort(); + needstack(128); _threaddebug(DBGSCHED, "pausing, state=%s", psstate(t->state)); if(setjmp(t->sched)==0) longjmp(p->sched, 1); Add fpr to print floating-point registers. [rsc] --rw-rw-r-- M 1428987 glenda sys 3268 Jan 28 11:01 sys/lib/acid/386 /n/sourcesdump/2006/0128/plan9/sys/lib/acid/386:59,64 - /n/sourcesdump/2006/0129/plan9/sys/lib/acid/386:59,84 gpr(); } + defn fpr() + { + print("F0\t", *fmt(F0, 'g'), "\n"); + print("F1\t", *fmt(F1, 'g'), "\n"); + print("F2\t", *fmt(F2, 'g'), "\n"); + print("F3\t", *fmt(F3, 'g'), "\n"); + print("F4\t", *fmt(F4, 'g'), "\n"); + print("F5\t", *fmt(F5, 'g'), "\n"); + print("F6\t", *fmt(F6, 'g'), "\n"); + print("F7\t", *fmt(F7, 'g'), "\n"); + print("control\t", *fmt(E0, 'x'), "\n"); + print("status\t", *fmt(E1, 'x'), "\n"); + print("tag\t", *fmt(E2, 'x'), "\n"); + print("ip offset\t", *fmt(E3, 'X'), "\n"); + print("cs selector\t", *fmt(E4, 'x'), "\n"); + print("opcode\t", *fmt(E4>>8, 'x'), "\n"); + print("data operand offset\t", *fmt(E5, 'x'), "\n"); + print("operand selector\t", *fmt(E6, 'x'), "\n"); + } + defn mmregs() { print("MM0\t", *MM0, " MM1\t", *MM1, "\n"); 8-bit safety in tbl. [rsc] --rw-rw-r-- M 1428987 glenda sys 1414 Jan 28 10:55 sys/src/cmd/tbl/tc.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/tbl/tc.c:22,33 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/tbl/tc.c:22,39 continue; s = table[ilin][icol].col; if (point(s)) - while (*s) - had[*s++] = 1; + while (*s) { + if((unsigned char)*s < 128) + had[(unsigned char)*s] = 1; + s++; + } s = table[ilin][icol].rcol; if (point(s)) - while (*s) - had[*s++] = 1; + while (*s) { + if((unsigned char)*s < 128) + had[(unsigned char)*s] = 1; + s++; + } } } /* choose first funny character */ Fiddling. [rsc] --rw-rw-r-- M 1428987 sape sys 30760 Jan 28 10:54 sys/src/games/music/jukebox/music.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0128/plan9/sys/src/games/music/jukebox/music.c /n/sourcesdump/2006/0129/plan9/sys/src/games/music/jukebox/music.c] [rsc] --rw-rw-r-- M 1428987 sape sys 1585 Jan 28 12:25 sys/src/games/music/playlistfs/boilerplate.c /n/sourcesdump/2006/0128/plan9/sys/src/games/music/playlistfs/boilerplate.c:65,71 - /n/sourcesdump/2006/0129/plan9/sys/src/games/music/playlistfs/boilerplate.c:65,71 * broadcast and putting themselves back on the * queue before the broadcast has finished */ - marker.eventc = nil; + marker.eventc = nil; /* Only markers have eventc == nil */ sendp(q, &marker); while((w = recvp(q)) != &marker){ if(w->eventc == nil){ Don't profile getcallerpc. [rsc] --rw-rw-r-- M 1428987 glenda sys 52 Jan 28 10:48 sys/src/libc/power/getcallerpc.s /n/sourcesdump/2006/0128/plan9/sys/src/libc/power/getcallerpc.s:1,4 - /n/sourcesdump/2006/0129/plan9/sys/src/libc/power/getcallerpc.s:1,4 - TEXT getcallerpc(SB), $-4 + TEXT getcallerpc(SB),1,$-4 MOVW 0(R1), R3 RETURN Add != operator to snoopy, remove various stupid functions. [rsc] --rw-rw-r-- M 1428987 glenda sys 4086 Jan 28 10:50 sys/man/8/snoopy /n/sourcesdump/2006/0128/plan9/sys/man/8/snoopy:64,69 - /n/sourcesdump/2006/0129/plan9/sys/man/8/snoopy:64,70 .EX \fIexpr\fP: \fIprotocol\fP | \fIfield\fP '=' \fIvalue\fP + | \fIfield\fP '!=' \fIvalue\fP | \fIprotocol\fP '(' \fIexpr\fP ')' | '(' \fIexpr\fP ')' | \fIexpr\fP '||' \fIexpr\fP [rsc] --rw-rw-r-- M 1428987 glenda sys 8958 Jan 28 10:49 sys/src/cmd/ip/snoopy/dhcp.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/dhcp.c:103,120 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/dhcp.c:103,108 OP9auth= 129, // plan9 auth servers }; - static void - p_compile(Filter *f) - { - sysfatal("unknown bootp field: %s", f->s); - } - - static int - p_filter(Filter *, Msg *) - { - return 0; - } - /* * convert a byte array to hex */ /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/dhcp.c:471,478 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/dhcp.c:459,466 Proto dhcp = { "dhcp", - p_compile, - p_filter, + nil, + nil, p_seprint, nil, nil, [rsc] --rw-rw-r-- M 1428987 glenda sys 1078 Jan 28 10:49 sys/src/cmd/ip/snoopy/dump.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/dump.c:10,21 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/dump.c:10,15 { } - static int - p_filter(Filter *, Msg *) - { - return 0; - } - static char tohex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/dump.c:81,87 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/dump.c:75,81 { "dump", p_compile, - p_filter, + nil, p_seprint, nil, nil, [rsc] --rw-rw-r-- M 1428987 glenda sys 1739 Jan 28 10:49 sys/src/cmd/ip/snoopy/filter.y /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/filter.y:12,17 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/filter.y:12,18 %term LOR %term LAND %term WORD + %term NE %right '!' %left '|' %left '&' /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/filter.y:27,32 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/filter.y:28,41 { $$ = $1; } | WORD '=' WORD { $2->l = $1; $2->r = $3; $$ = $2; } + | WORD NE WORD + { $2->l = newfilter(); + $2->l->op = '='; + $2->l->l = $1; + $2->l->r = $3; + $2->op = '!'; + $$ = $2; + } | WORD '(' expr ')' { $1->l = $3; free($2); free($4); $$ = $1; } | '(' expr ')' /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/filter.y:84,100 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/filter.y:93,110 } yylp++; - if(*yylp == c) - switch(c){ - case '&': - c = LAND; - yylp++; - break; - case '|': - c = LOR; - yylp++; - break; - } + if(c == '!' && *yylp == '='){ + c = NE; + yylp++; + } + else if(c == '&' && *yylp == '&'){ + c = LAND; + yylp++; + } + else if(c == '|' && *yylp == '|'){ + c = LOR; + yylp++; + } yylval->op = c; return c; } [rsc] --rw-rw-r-- M 1428987 glenda sys 2261 Jan 28 10:49 sys/src/cmd/ip/snoopy/il.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/il.c:102,109 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/il.c:102,108 static char* pkttype(int t) { - char b[10]; - + static char b[10]; if(t > 6){ sprint(b, "%d", t); [rsc] --rw-rw-r-- M 1428987 glenda sys 15607 Jan 28 10:49 sys/src/cmd/ip/snoopy/main.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/main.c:233,239 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/main.c:233,239 return 0; m->needroot = 0; }else{ - if(m->pr != nil && !(m->pr->filter)(f, m)) + if(m->pr && (m->pr->filter==nil || !(m->pr->filter)(f, m))) return 0; } if(f->l == nil) /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/main.c:650,657 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/main.c:650,660 _compile(f->r, last); break; case WORD: - if(last != nil) + if(last != nil){ + if(last->compile == nil) + sysfatal("unknown %s subprotocol: %s", f->pr->name, f->s); (*last->compile)(f); + } if(f->l) _compile(f->l, f->pr); break; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/main.c:658,663 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/main.c:661,669 case '=': if(last == nil) sysfatal("internal error: compilewalk: badly formed tree"); + + if(last->compile == nil) + sysfatal("unknown %s field: %s", f->pr->name, f->s); (*last->compile)(f); break; default: [rsc] --rw-rw-r-- M 1428987 glenda sys 879 Jan 28 10:50 sys/src/cmd/ip/snoopy/mkfile /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/mkfile:53,58 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/mkfile:53,60 main.c\ ${POBJS:%.$O=%.c}\ + CLEANFILES=protos.c protos.h + s); - } - static int - p_filter(Filter *, Msg *) - { - return 0; - } - - static int p_seprint(Msg *m) { Fcall f; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/ninep.c:44,51 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/ninep.c:32,39 Proto ninep = { "ninep", - p_compile, - p_filter, + nil, + nil, p_seprint, nil, nil, [rsc] --rw-rw-r-- M 1428987 glenda sys 7369 Jan 28 10:49 sys/src/cmd/ip/snoopy/ospf.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/ospf.c:90,96 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/ospf.c:90,96 }; char* - seprintospfhello(char *p, char *e, void *a, int) + seprintospfhello(char *p, char *e, void *a) { Ospfhello *h = a; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/ospf.c:327,344 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/ospf.c:327,332 return seprint(p, e, ")"); } - static void - p_compile(Filter *f) - { - sysfatal("unknown ospf field: %s", f->s); - } - - static int - p_filter(Filter *, Msg *) - { - return 0; - } - int p_seprint(Msg *m) { /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/ospf.c:366,372 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/ospf.c:354,360 switch (ospf->type) { case OSPFhello: - p = seprintospfhello(p, e, ospf->data, x); + p = seprintospfhello(p, e, ospf->data); break; case OSPFdd: p = seprintospfdatadesc(p, e, ospf->data, x); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/ospf.c:392,399 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/ospf.c:380,387 Proto ospf = { "ospf", - p_compile, - p_filter, + nil, + nil, p_seprint, nil, nil, [rsc] --rw-rw-r-- M 1428987 jmk sys 1818 Jan 28 10:49 sys/src/cmd/ip/snoopy/rtcp.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/rtcp.c:31,50 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/rtcp.c:31,37 REPORTLEN = 24, }; - - static void - p_compile(Filter *f) - { - sysfatal("unknown rtcp field: %s", f->s); - } - static int - p_filter(Filter *, Msg *) - { - return 0; - } - - static int p_seprint(Msg *m) { Hdr*h; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/rtcp.c:86,93 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/rtcp.c:73,80 Proto rtcp = { "rtcp", - p_compile, - p_filter, + nil, + nil, p_seprint, nil, nil, [rsc] --rw-rw-r-- M 1428987 jmk sys 1021 Jan 28 10:49 sys/src/cmd/ip/snoopy/rtp.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/rtp.c:17,36 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/rtp.c:17,23 RTPLEN = 12, // Minimum size of an RTP header }; - - static void - p_compile(Filter *f) - { - sysfatal("unknown rtp field: %s", f->s); - } - static int - p_filter(Filter *, Msg *) - { - return 0; - } - - static int p_seprint(Msg *m) { Hdr*h; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/ip/snoopy/rtp.c:65,72 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/ip/snoopy/rtp.c:52,59 Proto rtp = { "rtp", - p_compile, - p_filter, + nil, + nil, p_seprint, nil, nil, Various 64-bit fixes. [rsc] --rw-rw-r-- M 1428987 jmk sys 8788 Jan 28 10:53 sys/src/cmd/cc/scon.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/cc/scon.c:1,5 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/cc/scon.c:1,18 #include "cc.h" + static Node* + acast(Type *t, Node *n) + { + if(n->type->etype != t->etype || n->op == OBIT) { + n = new1(OCAST, n, Z); + if(nocast(n->left->type, t)) + *n = *n->left; + n->type = t; + } + return n; + } + + void evconst(Node *n) { /n/sourcesdump/2006/0128/plan9/sys/src/cmd/cc/scon.c:426,435 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/cc/scon.c:439,446 if(c2 % c1) continue; r = trm[j].node; - if(r->type->etype != et) { - r = new1(OCAST, r, Z); - r->type = t; - } + if(r->type->etype != et) + r = acast(t, r); c2 = trm[j].mult/trm[i].mult; if(c2 != 1 && c2 != -1) { r = new1(OMUL, r, new(OCONST, Z, Z)); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/cc/scon.c:438,447 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/cc/scon.c:449,456 r->right->vconst = c2; } l = trm[i].node; - if(l->type->etype != et) { - l = new1(OCAST, l, Z); - l->type = t; - } + if(l->type->etype != et) + l = acast(t, l); r = new1(OADD, l, r); r->type = t; if(c2 == -1) /n/sourcesdump/2006/0128/plan9/sys/src/cmd/cc/scon.c:468,477 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/cc/scon.c:477,484 if(c1 == 0) continue; r = trm[i].node; - if(r->type->etype != et || r->op == OBIT) { - r = new1(OCAST, r, Z); - r->type = t; - } + if(r->type->etype != et || r->op == OBIT) + r = acast(t, r); if(c1 != 1 && c1 != -1) { r = new1(OMUL, r, new(OCONST, Z, Z)); r->type = t; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/cc/scon.c:576,582 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/cc/scon.c:583,589 if(n != Z) if(!typefd[n->type->etype]) - if(!typev[n->type->etype]) + if(!typev[n->type->etype] || ewidth[TVLONG] == ewidth[TIND]) switch(n->op) { case OCAST: [rsc] --rw-rw-r-- M 1428987 glenda sys 34377 Jan 28 10:53 sys/src/cmd/cc/sub.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/cc/sub.c:684,690 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/cc/sub.c:684,690 if(n->op == OSUB) if(i == TIND && j == TIND) { w = n->right->type->link->width; - if(w < 1) + if(w < 1 || n->left->type->link == T || n->left->type->link->width < 1) goto bad; n->type = types[ewidth[TIND] <= ewidth[TLONG]? TLONG: TVLONG]; if(1 && ewidth[TIND] > ewidth[TLONG]){ Add IP-based checking to fossil. [rsc] --rw-rw-r-- M 1428987 jmk sys 4438 Jan 28 11:32 sys/src/cmd/fossil/9.h /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9.h:44,57 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9.h:44,62 MsgF = 4, }; + enum { + ConNoneAllow = 1<<0, + ConNoAuthCheck = 1<<1, + ConNoPermCheck = 1<<2, + ConWstatAllow = 1<<3, + ConIPCheck = 1<<4, + }; struct Con { char* name; uchar* data; /* max, not negotiated */ int isconsole; /* immutable */ - int noauth; /* immutable */ - int noperm; /* immutable */ - int wstatallow; /* immutable */ - + int flags; /* immutable */ + char remote[128]; /* immutable */ VtLock* lock; int state; int fd; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9.h:191,197 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9.h:196,202 /* * 9proc.c */ - extern Con* conAlloc(int, char*); + extern Con* conAlloc(int, char*, int); extern void conInit(void); extern void msgFlush(Msg*); extern void msgInit(void); [rsc] --rw-rw-r-- M 1428987 rsc sys 3863 Jan 28 11:32 sys/src/cmd/fossil/9auth.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9auth.c:84,93 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9auth.c:84,99 * authentication. */ vtRLock(con->alock); - if(!con->isconsole && - (strcmp(fid->uname, unamenone) != 0 || !con->aok)){ + if(con->isconsole){ + /* anything goes */ + }else if((con->flags&ConNoneAllow) || con->aok){ + consPrint("attach %s as %s: allowing as none\n", fsysGetName(fsys), fid->uname); + vtMemFree(fid->uname); + fid->uname = vtStrDup(unamenone); + }else{ vtRUnlock(con->alock); consPrint("attach %s as %s: connection not authenticated, not console\n", fsysGetName(fsys), fid->uname); + vtSetError("cannot attach as none before authentication"); return 0; } vtRUnlock(con->alock); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9auth.c:94,99 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9auth.c:100,106 if((fid->uid = uidByUname(fid->uname)) == nil){ consPrint("attach %s as %s: unknown uname\n", fsysGetName(fsys), fid->uname); + vtSetError("unknown user"); return 0; } return 1; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9auth.c:101,106 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9auth.c:108,114 if((afid = fidGet(con, t->afid, 0)) == nil){ consPrint("attach %s as %s: bad afid\n", fsysGetName(fsys), fid->uname); + vtSetError("bad authentication fid"); return 0; } /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9auth.c:111,121 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9auth.c:119,131 if(!(afid->qid.type & QTAUTH)){ consPrint("attach %s as %s: afid not an auth file\n", fsysGetName(fsys), fid->uname); fidPut(afid); + vtSetError("bad authentication fid"); return 0; } if(strcmp(afid->uname, fid->uname) != 0 || afid->fsys != fsys){ consPrint("attach %s as %s: afid is for %s as %s\n", fsysGetName(fsys), fid->uname, fsysGetName(afid->fsys), afid->uname); fidPut(afid); + vtSetError("attach/auth mismatch"); return 0; } /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9auth.c:125,130 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9auth.c:135,141 vtUnlock(afid->alock); consPrint("attach %s as %s: %R\n", fsysGetName(fsys), fid->uname); fidPut(afid); + vtSetError("authentication protocol not finished"); return 0; } } /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9auth.c:134,139 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9auth.c:145,151 if((fid->uid = uidByUname(afid->cuname)) == nil){ consPrint("attach %s as %s: unknown cuname %s\n", fsysGetName(fsys), fid->uname, afid->cuname); fidPut(afid); + vtSetError("unknown user"); return 0; } [rsc] --rw-rw-r-- M 1428987 rsc sys 3024 Jan 28 12:31 sys/src/cmd/fossil/9lstn.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9lstn.c:5,10 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9lstn.c:5,11 typedef struct Lstn Lstn; typedef struct Lstn { int afd; + int flags; char* address; char dir[NETPATHLEN]; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9lstn.c:45,51 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9lstn.c:46,52 Lstn *lstn; int dfd, lfd; char newdir[NETPATHLEN]; - + vtThreadSetName("listen"); lstn = a; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9lstn.c:54,71 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9lstn.c:55,70 fprint(2, "listen: listen '%s': %r", lstn->dir); break; } - if((dfd = accept(lfd, newdir)) >= 0) - conAlloc(dfd, newdir); + conAlloc(dfd, newdir, lstn->flags); else - fprint(2, "listen: accept '%s': %r", newdir); - close(lfd); + fprint(2, "listen: accept %s: %r\n", newdir); } lstnFree(lstn); } static Lstn* - lstnAlloc(char* address) + lstnAlloc(char* address, int flags) { int afd; Lstn *lstn; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9lstn.c:89,94 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9lstn.c:88,94 lstn = vtMemAllocZ(sizeof(Lstn)); lstn->afd = afd; lstn->address = vtStrDup(address); + lstn->flags = flags; memmove(lstn->dir, dir, NETPATHLEN); if(lbox.tail != nil){ /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9lstn.c:114,125 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9lstn.c:114,125 static int cmdLstn(int argc, char* argv[]) { - int dflag; + int dflag, flags; Lstn *lstn; - char *usage = "usage: listen [-d] [address]"; + char *usage = "usage: listen [-dIN] [address]"; dflag = 0; - + flags = 0; ARGBEGIN{ default: return cliError(usage); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9lstn.c:126,131 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9lstn.c:126,137 case 'd': dflag = 1; break; + case 'I': + flags |= ConIPCheck; + break; + case 'N': + flags |= ConNoneAllow; + break; }ARGEND switch(argc){ /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9lstn.c:139,145 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9lstn.c:145,151 break; case 1: if(!dflag){ - if(lstnAlloc(argv[0]) == nil) + if(lstnAlloc(argv[0], flags) == nil) return 0; break; } [rsc] --rw-rw-r-- M 1428987 rsc sys 22935 Jan 28 11:32 sys/src/cmd/fossil/9p.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9p.c /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9p.c] [rsc] --rw-rw-r-- M 1428987 rsc sys 15148 Jan 28 12:31 sys/src/cmd/fossil/9proc.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9proc.c:63,69 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9proc.c:63,69 } con->state = ConDead; con->aok = 0; - con->noauth = con->noperm = con->wstatallow = 0; + con->flags = 0; con->isconsole = 0; vtLock(cbox.alock); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9proc.c:502,510 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9proc.c:502,512 } Con* - conAlloc(int fd, char* name) + conAlloc(int fd, char* name, int flags) { Con *con; + char buf[128], *p; + int rfd, n; vtLock(cbox.alock); while(cbox.ahead == nil){ /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9proc.c:558,565 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9proc.c:560,578 con->name = vtStrDup(name); else con->name = vtStrDup("unknown"); - con->aok = 0; - con->noauth = con->noperm = con->wstatallow = 0; + con->remote[0] = 0; + snprint(buf, sizeof buf, "%s/remote", con->name); + if((rfd = open(buf, OREAD)) >= 0){ + n = read(rfd, buf, sizeof buf-1); + close(rfd); + if(n > 0){ + buf[n] = 0; + if((p = strchr(buf, '\n')) != nil) + *p = 0; + strecpy(con->remote, con->remote+sizeof con->remote, buf); + } + } + con->flags = flags; con->isconsole = 0; vtUnlock(cbox.alock); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9proc.c:692,698 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9proc.c:705,711 cmdWho(int argc, char* argv[]) { char *usage = "usage: who"; - int i; + int i, l1, l2, l; Con *con; Fid *fid, *last; /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/9proc.c:705,712 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/9proc.c:718,733 return cliError(usage); vtRLock(cbox.clock); + l1 = 0; + l2 = 0; for(con=cbox.chead; con; con=con->cnext){ - consPrint("\t%q:", con->name); + if((l = strlen(con->name)) > l1) + l1 = l; + if((l = strlen(con->remote)) > l2) + l2 = l; + } + for(con=cbox.chead; con; con=con->cnext){ + consPrint("\t%-*s %-*s", l1, con->name, l2, con->remote); vtLock(con->fidlock); last = nil; for(i=0; isrvfd, -1); else{ - con = conAlloc(fd[1], srv->mntpnt); + con = conAlloc(fd[1], srv->mntpnt, conflags); if(con == nil) r = 0; - else{ + else r = 1; - con->noauth = Aflag; - con->noperm = Pflag; - con->wstatallow = Wflag; - } } if(r == 0){ close(fd[1]); [rsc] --rw-rw-r-- M 1428987 rsc sys 7985 Jan 28 11:32 sys/src/cmd/fossil/Ccmd.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/fossil/Ccmd.c:446,452 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/fossil/Ccmd.c:446,452 if(pipe(cbox.confd) < 0) return 0; - if((cbox.con = conAlloc(cbox.confd[1], "console")) == nil){ + if((cbox.con = conAlloc(cbox.confd[1], "console", 0)) == nil){ close(cbox.confd[0]); close(cbox.confd[1]); cbox.confd[0] = cbox.confd[1] = -1; [rsc] --rw-rw-r-- M 1428987 rsc sys 18276 Jan 28 11:37 sys/man/8/fossilcons /n/sourcesdump/2006/0128/plan9/sys/man/8/fossilcons:33,39 - /n/sourcesdump/2006/0129/plan9/sys/man/8/fossilcons:33,39 .PP .B listen [ - .B -d + .B -INd ] [ .I address /n/sourcesdump/2006/0128/plan9/sys/man/8/fossilcons:400,405 - /n/sourcesdump/2006/0129/plan9/sys/man/8/fossilcons:400,427 .I listen to remove the listener at the given address. + By default, the user + .I none + is only allowed to attach on a connection after + at least one other user has successfully attached. + The + .B -N + flag allows connections from + .I none + at any time. + The + .B -I + flag causes + .I fossil + to check the IP address of incoming connections + against + .BR /mnt/ipok , + rejecting attaches from disallowed addresses. + This mechanism is not intended for general use. + The server + .I sources.cs.bell-labs.com + uses it to comply with U.S. crytography + export regulations. .PP .I Msg prints the maximum internal 9P message queue size [rsc] --rw-rw-r-- M 1428987 rsc sys 3024 Jan 28 12:31 sys/src/cmd/fossil/9lstn.c [rsc] --rw-rw-r-- M 1428987 rsc sys 15148 Jan 28 12:31 sys/src/cmd/fossil/9proc.c Look in /nvram. [rsc] --rw-rw-r-- M 1428987 glenda sys 8809 Jan 28 12:26 sys/src/libauthsrv/readnvram.c /n/sourcesdump/2006/0128/plan9/sys/src/libauthsrv/readnvram.c:40,45 - /n/sourcesdump/2006/0129/plan9/sys/src/libauthsrv/readnvram.c:40,46 "mips", "#r/nvram", 1024+900, sizeof(Nvrsafe), "power", "#F/flash/flash0", 0x440000, sizeof(Nvrsafe), "power", "#r/nvram", 4352, sizeof(Nvrsafe), /* OK for MTX-604e */ + "power", "/nvram", 0, sizeof(Nvrsafe), /* OK for Ucu */ "debug", "/tmp/nvram", 0, sizeof(Nvrsafe), }; Add contact info. [rsc] --rw-rw-r-- M 1428987 rsc drawterm 1002 Jan 28 12:25 sys/src/cmd/unix/drawterm/README /n/sourcesdump/2006/0128/plan9/sys/src/cmd/unix/drawterm/README:19,24 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/unix/drawterm/README:19,25 --------- See http://swtch.com/drawterm/ + SOURCE ------ Use CVS: cvs -d :pserver:anoncvs@cvs.pdos.csail.mit.edu:/cvs co drawterm /n/sourcesdump/2006/0128/plan9/sys/src/cmd/unix/drawterm/README:25,30 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/unix/drawterm/README:26,37 On the web at http://cvs.pdos.csail.mit.edu/cvs/drawterm In the Plan 9 distribution: /sys/src/cmd/unix/drawterm + + HELP + ---- + Email Russ Cox with bug reports or problems. + + TO DO: ------ /n/sourcesdump/2006/0128/plan9/sys/src/cmd/unix/drawterm/README:34,37 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/unix/drawterm/README:41,46 9term window instead. - Should implement /dev/label. + + Clean up _MAGIC handling. [jmk] --rw-rw-r-- M 1428987 glenda sys 8621 Jan 28 12:56 sys/include/mach.h /n/sourcesdump/2006/0128/plan9/sys/include/mach.h:217,225 - /n/sourcesdump/2006/0129/plan9/sys/include/mach.h:217,226 typedef struct Fhdr { char *name; /* identifier of executable */ - uchar type; /* file type - see codes above*/ + uchar type; /* file type - see codes above */ uchar hdrsz; /* header size */ - uchar spare[2]; + uchar _magic; /* _MAGIC() magic */ + uchar spare; long magic; /* magic number */ uvlong txtaddr; /* text address */ vlong txtoff; /* start of text in file */ Better error messages. [jmk] --rw-rw-r-- M 1428987 glenda sys 4930 Jan 28 12:57 sys/src/cmd/venti/config.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/config.c:113,123 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/config.c:113,123 config->naparts++; }else if(i == 2 && strcmp(flds[0], "index") == 0){ if(!nameOk(flds[1])){ - setErr(EAdmin, "illegal index name %s in config file %s", flds[1], config); + setErr(EAdmin, "illegal index name %s in config file %s", flds[1], file); break; } if(config->index != nil){ - setErr(EAdmin, "duplicate indices in config file %s", config); + setErr(EAdmin, "duplicate indices in config file %s", file); break; } config->index = estrdup(flds[1]); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/config.c:124,134 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/config.c:124,134 }else if(i == 2 && strcmp(flds[0], "bcmem") == 0){ if(!numOk(flds[1])){ setErr(EAdmin, "illegal size %s in config file %s", - flds[1], config); + flds[1], file); break; } if(config->bcmem != 0){ - setErr(EAdmin, "duplicate bcmem lines in config file %s", config); + setErr(EAdmin, "duplicate bcmem lines in config file %s", file); break; } config->bcmem = unittoull(flds[1]); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/config.c:135,145 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/config.c:135,145 }else if(i == 2 && strcmp(flds[0], "mem") == 0){ if(!numOk(flds[1])){ setErr(EAdmin, "illegal size %s in config file %s", - flds[1], config); + flds[1], file); break; } if(config->mem != 0xFFFFFFFFUL){ - setErr(EAdmin, "duplicate mem lines in config file %s", config); + setErr(EAdmin, "duplicate mem lines in config file %s", file); break; } config->mem = unittoull(flds[1]); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/config.c:146,156 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/config.c:146,156 }else if(i == 2 && strcmp(flds[0], "icmem") == 0){ if(!numOk(flds[1])){ setErr(EAdmin, "illegal size %s in config file %s", - flds[1], config); + flds[1], file); break; } if(config->icmem != 0){ - setErr(EAdmin, "duplicate icmem lines in config file %s", config); + setErr(EAdmin, "duplicate icmem lines in config file %s", file); break; } config->icmem = unittoull(flds[1]); /n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/config.c:158,183 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/config.c:158,183 config->queueWrites = 1; }else if(i == 2 && strcmp(flds[0], "httpaddr") == 0){ if(!nameOk(flds[1])){ - setErr(EAdmin, "illegal http address '%s' in configuration file %s", flds[1], config); + setErr(EAdmin, "illegal http address '%s' in configuration file %s", flds[1], file); break; } if(config->haddr){ - setErr(EAdmin, "duplicate httpaddr lines in configuration file %s", config); + setErr(EAdmin, "duplicate httpaddr lines in configuration file %s", file); break; } config->haddr = estrdup(flds[1]); }else if(i == 2 && strcmp(flds[0], "addr") == 0){ if(!nameOk(flds[1])){ - setErr(EAdmin, "illegal venti address '%s' in configuration file %s", flds[1], config); + setErr(EAdmin, "illegal venti address '%s' in configuration file %s", flds[1], file); break; } if(config->vaddr){ - setErr(EAdmin, "duplicate addr lines in configuration file %s", config); + setErr(EAdmin, "duplicate addr lines in configuration file %s", file); break; } config->vaddr = estrdup(flds[1]); }else{ - setErr(EAdmin, "illegal line '%s' in configuration file %s", line, config); + setErr(EAdmin, "illegal line '%s' in configuration file %s", line, file); break; } free(line); [jmk] --rw-rw-r-- M 1428987 glenda sys 2524 Jan 28 12:57 sys/src/cmd/venti/fmtindex.c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/venti/fmtindex.c:43,49 - /n/sourcesdump/2006/0129/plan9/sys/src/cmd/venti/fmtindex.c:43,49 file = argv[0]; if(!runConfig(file, &conf)) - fatal("can't intialization config %s: %R", file); + fatal("can't run config %s: %R", file); if(conf.index == nil) fatal("no index specified in %s", file); if(!nameOk(conf.index)) Handle kernel load addresses better. [jmk] --rw-rw-r-- M 1428987 glenda sys 2085 Jan 28 12:56 sys/src/libmach/2.c /n/sourcesdump/2006/0128/plan9/sys/src/libmach/2.c:76,82 - /n/sourcesdump/2006/0129/plan9/sys/src/libmach/2.c:76,82 0, /* value */ 0x2000, /* page size */ 0x80000000ULL, /* kernel base */ - 0, /* kernel text mask */ + 0x80000000ULL, /* kernel text mask */ 0x7FFFFFFFULL, /* user stack top */ 2, /* quantization of pc */ 4, /* szaddr */ [jmk] --rw-rw-r-- M 1428987 glenda sys 1564 Jan 28 12:56 sys/src/libmach/5.c /n/sourcesdump/2006/0128/plan9/sys/src/libmach/5.c:54,60 - /n/sourcesdump/2006/0129/plan9/sys/src/libmach/5.c:54,60 0, /* static base register value */ 0x1000, /* page size */ 0xC0000000ULL, /* kernel base */ - 0, /* kernel text mask */ + 0xC0000000ULL, /* kernel text mask */ 0x7FFFFFFFULL, /* user stack top */ 4, /* quantization of pc */ 4, /* szaddr */ [jmk] --rw-rw-r-- M 1428987 jmk sys 3482 Jan 28 12:56 sys/src/libmach/6.c /n/sourcesdump/2006/0128/plan9/sys/src/libmach/6.c:107,113 - /n/sourcesdump/2006/0129/plan9/sys/src/libmach/6.c:107,113 0, /* static base register value */ 0x1000, /* page size */ 0xFFFFFFFF80110000ULL, /* kernel base */ - 0, /* kernel text mask */ + 0xFFFF800000000000ULL, /* kernel text mask */ 0x00007FFFFFFFF000ULL, /* user stack top */ 1, /* quantization of pc */ 8, /* szaddr */ [jmk] --rw-rw-r-- M 1428987 glenda sys 3310 Jan 28 12:57 sys/src/libmach/7.c /n/sourcesdump/2006/0128/plan9/sys/src/libmach/7.c:104,110 - /n/sourcesdump/2006/0129/plan9/sys/src/libmach/7.c:104,110 0, /* static base register value */ 0x2000, /* page size */ 0x80000000ULL, /* kernel base */ - 0, /* kernel text mask */ + 0xF0000000ULL, /* kernel text mask */ 0x7FFFFFFFULL, /* user stack top */ 4, /* quantization of pc */ 4, /* szaddr */ [jmk] --rw-rw-r-- M 1428987 glenda sys 2071 Jan 28 12:57 sys/src/libmach/8.c /n/sourcesdump/2006/0128/plan9/sys/src/libmach/8.c:69,75 - /n/sourcesdump/2006/0129/plan9/sys/src/libmach/8.c:69,75 0, /* static base register value */ 0x1000, /* page size */ 0x80100000ULL, /* kernel base */ - 0, /* kernel text mask */ + 0xF0000000ULL, /* kernel text mask */ 0x7FFFFFFFULL, /* user stack top */ 1, /* quantization of pc */ 4, /* szaddr */ [jmk] --rw-rw-r-- M 1428987 glenda sys 16006 Jan 28 12:56 sys/src/libmach/executable.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0128/plan9/sys/src/libmach/executable.c /n/sourcesdump/2006/0129/plan9/sys/src/libmach/executable.c] [jmk] --rw-rw-r-- M 1428987 glenda sys 3381 Jan 28 12:57 sys/src/libmach/k.c /n/sourcesdump/2006/0128/plan9/sys/src/libmach/k.c:108,114 - /n/sourcesdump/2006/0129/plan9/sys/src/libmach/k.c:108,114 0, /* value */ 0x1000, /* page size */ 0xE0000000ULL, /* kernel base */ - 0, /* kernel text mask */ + 0xE0000000ULL, /* kernel text mask */ 0x7FFFFFFFULL, /* user stack top */ 4, /* quantization of pc */ 4, /* szaddr */ [jmk] --rw-rw-r-- M 1428987 glenda sys 26745 Jan 28 12:56 sys/src/libmach/sym.c /n/sourcesdump/2006/0128/plan9/sys/src/libmach/sym.c:103,109 - /n/sourcesdump/2006/0129/plan9/sys/src/libmach/sym.c:103,109 nsym = 0; size = 0; for(p = symbols; size < fp->symsz; p++, nsym++) { - if(fp->magic & HDR_MAGIC){ + if(fp->_magic && (fp->magic & HDR_MAGIC)){ svalsz = 8; if(Bread(&b, &vl, 8) != 8) return symerrmsg(8, "symbol"); [jmk] --rw-rw-r-- M 1428987 jmk sys 3447 Jan 28 12:56 sys/src/libmach/u.c /n/sourcesdump/2006/0128/plan9/sys/src/libmach/u.c:109,115 - /n/sourcesdump/2006/0129/plan9/sys/src/libmach/u.c:109,115 0, /* value */ 0x2000, /* page size */ 0x80000000ULL, /* kernel base */ - 0, /* kernel text mask */ + 0x80000000ULL, /* kernel text mask */ 0x7FFFFFFFULL, /* user stack top */ 4, /* quantization of pc */ 4, /* szaddr */ Clean up -c and -s. [rsc] --rw-rw-r-- M 1428987 glenda sys 21811 Jan 28 15:02 sys/src/cmd/replica/applylog.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0128/plan9/sys/src/cmd/replica/applylog.c /n/sourcesdump/2006/0129/plan9/sys/src/cmd/replica/applylog.c] [rsc] --rw-rw-r-- M 1428987 glenda sys 843 Jan 28 15:03 rc/bin/replica/defs /n/sourcesdump/2006/0128/plan9/rc/bin/replica/defs:19,24 - /n/sourcesdump/2006/0129/plan9/rc/bin/replica/defs:19,28 opt=() while(! ~ $#* 0 && ~ $1 -*){ + if(~ $1 -s -c){ # take one argument + opt=($opt $1) + shift + } opt=($opt $1) shift } [rsc] --rw-rw-r-- M 1428987 glenda sys 21811 Jan 28 15:02 sys/src/cmd/replica/applylog.c [rsc] --rwxrwxr-x M 1428987 rsc sys 272 Jan 28 15:03 usr/glenda/bin/rc/pull /n/sourcesdump/2006/0128/plan9/usr/glenda/bin/rc/pull:3,8 - /n/sourcesdump/2006/0129/plan9/usr/glenda/bin/rc/pull:3,12 rfork e flags=() while(! ~ $#* 0 && ~ $1 -*){ + if(~ $1 -c -s){ + flags=($flags $1) + shift + } flags=($flags $1) shift } [rsc] --rw-rw-r-- M 1428987 glenda sys 843 Jan 28 15:03 rc/bin/replica/defs [rsc] --rw-rw-r-- M 1428987 glenda sys 7209 Jan 28 15:12 sys/man/1/replica /n/sourcesdump/2006/0128/plan9/sys/man/1/replica:4,13 - /n/sourcesdump/2006/0129/plan9/sys/man/1/replica:4,21 .SH SYNOPSIS .B replica/pull [ - .B -cnsv + .B -nv ] + [ + .B -c .I name + ]... [ + .B -s + .I name + ]... + .I name + [ .I path ... ] /n/sourcesdump/2006/0128/plan9/sys/man/1/replica:160,174 - /n/sourcesdump/2006/0129/plan9/sys/man/1/replica:168,184 .B -c flag to .I pull - causes updates to be resolved using the client's copy, + specifies that conflicts for paths beginning with + .I name + should be resolved using the client's copy, while .B -s specifies the server's copy. - Typically these flags are only used when - invoking - .I pull - with a specific list of files that are known - to be conflicting. + The + .B -c + and + .B -s + options may be repeated. .PP .I Replica/changes prints a list of local changes made on the client /n/sourcesdump/2006/0128/plan9/sys/man/1/replica:283,291 - /n/sourcesdump/2006/0129/plan9/sys/man/1/replica:293,328 To update your system, make sure you are connected to the internet and run .EX - disk/kfscmd allow replica/pull /dist/replica/network - disk/kfscmd disallow + .EE + If conflicts are reported (say you have made local changes to + .B /rc/bin/cpurc + and + .BR /rc/bin/termrc , + but only want to keep the + .B cpurc + changes), + use + .EX + replica/pull -c rc/bin/cpurc -s rc/bin/termrc /dist/replica/network + .EE + to instruct + .I pull + to ignore the server's change to + .BR cpurc . + .PP + The script + .B /usr/glenda/bin/rc/pull + runs + .I pull + with the + .B -v + flag and with + .B /dist/replica/network + inserted at the right point on the command line. + Logged in as glenda, one can repeat the above example with: + .EX + pull -c rc/bin/cpurc -s rc/bin/cpurc .EE .PP To see a list of changes made to the local file system [rsc] --rw-rw-r-- M 1428987 glenda sys 6383 Jan 28 15:12 sys/man/8/replica /n/sourcesdump/2006/0128/plan9/sys/man/8/replica:34,41 - /n/sourcesdump/2006/0129/plan9/sys/man/8/replica:34,49 .br .B replica/applylog [ - .B -cnsuv + .B -nuv ] + [ + .B -c + .I name + ]... + [ + .B -s + .I name + ]... .I clientdb .I clientroot .I serverroot /n/sourcesdump/2006/0128/plan9/sys/man/8/replica:217,230 - /n/sourcesdump/2006/0129/plan9/sys/man/8/replica:225,239 .B -c flag is given, .I applylog - still takes no action, but does so silently and will not + still takes no action for files beginning with the given names, + but does so silently and will not report the conflicts in the future. (The conflict is resolved in favor of the client.) - If the + The .B -s - flag is given, + is similar but causes .I applylog - overwrites the local changes. + to overwrite the local changes. (The conflict is resolved in favor of the server.) .PP .I Applychanges [rsc] --rw-rw-r-- M 1428987 glenda sys 21811 Jan 28 15:02 sys/src/cmd/replica/applylog.c Add for /sys/doc/mkfile [rsc] --rwxrwxr-x M 1428987 rsc sys 48 Jan 28 20:35 sys/doc/mkdirlist [rsc] --rwxrwxr-x M 1428987 rsc sys 50 Jan 28 20:35 sys/doc/mkfilelist