Avoid smashing error string. Remove redundant n<0. [rsc] --rw-rw-r-- M 107020 glenda sys 15915 Nov 19 10:56 sys/src/cmd/ramfs.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ramfs.c:791,803 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ramfs.c:791,801 */ n = read9pmsg(mfd[0], mdata, messagesize); if(n < 0){ - errstr(buf, sizeof buf); + rerrstr(buf, sizeof buf); if(buf[0]=='\0' || strstr(buf, "hungup")) exits(""); error("mount read"); } - if(n < 0) - error("mount read"); if(n == 0) continue; if(convM2S(mdata, n, &thdr) == 0) Minor changes. [jmk] --rw-rw-r-- M 107020 glenda sys 50964 Nov 19 20:00 sys/src/9/alphapc/sd53c8xx.c /n/sourcesdump/2005/1119/plan9/sys/src/9/alphapc/sd53c8xx.c:1987,1993 - /n/sourcesdump/2005/1120/plan9/sys/src/9/alphapc/sd53c8xx.c:1987,1993 /* * Because we don't yet have an abstraction for the * addresses as seen from the controller side (and on - * the 386 it doesn't matter), the follwong two lines + * the 386 it doesn't matter), the following two lines * are different between the 386 and alpha copies of * this driver. */ [jmk] --rw-rw-r-- M 107020 presotto sys 7502 Nov 19 19:59 sys/src/9/pc/devlml.c /n/sourcesdump/2005/1119/plan9/sys/src/9/pc/devlml.c:159,165 - /n/sourcesdump/2005/1120/plan9/sys/src/9/pc/devlml.c:159,165 print("zr36067 found at 0x%.8lux", pcidev->mem[0].bar & ~0x0F); regpa = pcidev->mem[0].bar & ~0x0F; - regva = vmap(regpa, pcidev->mem[0].size, 0); + regva = vmap(regpa, pcidev->mem[0].size); if (regva == 0) { print("lml: failed to map registers\n"); return; Fix memory leak. [rsc] --rw-rw-r-- M 107020 glenda sys 6651 Nov 19 19:47 sys/src/lib9p/file.c /n/sourcesdump/2005/1119/plan9/sys/src/lib9p/file.c:310,322 - /n/sourcesdump/2005/1120/plan9/sys/src/lib9p/file.c:310,320 f = allocfile(); f->name = estrdup9p("/"); if(uid == nil){ - if(uid = getuser()) - uid = estrdup9p(uid); + uid = getuser(); + if(uid == nil) + uid = "none"; } - if(uid == nil) - uid = estrdup9p("none"); - else - uid = estrdup9p(uid); + uid = estrdup9p(uid); if(gid == nil) gid = estrdup9p(uid); 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 14280 Nov 19 20:27 sys/src/cmd/troff2html/troff2html.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/troff2html/troff2html.c:7,19 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/troff2html/troff2html.c:7,22 Wid = 20, /* tmac.anhtml sets page width to 20" so we can recognize .nf text */ }; - typedef ulong Char; + typedef uintptr Char; typedef struct Troffchar Troffchar; typedef struct Htmlchar Htmlchar; typedef struct Font Font; typedef struct HTMLfont HTMLfont; - /* a Char is 32 bits. low 16 bits are the rune. higher are attributes */ + /* + * a Char is >= 32 bits. low 16 bits are the rune. higher are attributes. + * must be able to hold a pointer. + */ enum { Italic = 16, /n/sourcesdump/2005/1119/plan9/sys/src/cmd/troff2html/troff2html.c:66,77 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/troff2html/troff2html.c:69,80 /* R must be first; it's the default representation for fonts we don't recognize */ HTMLfont htmlfonts[] = { - "R", nil, 0, - "LucidaSans", nil, 0, - "I", "i", Italic, + "R", nil, 0, + "LucidaSans", nil, 0, + "I", "i", Italic, "LucidaSansI", "i", Italic, - "CW", "tt", CW, - "LucidaCW", "tt", CW, + "CW", "tt", CW, + "LucidaCW", "tt", CW, nil, nil, }; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/troff2html/troff2html.c:78,121 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/troff2html/troff2html.c:81,124 #define TABLE "" char* - onattr[8*sizeof(ulong)] = + onattr[8*sizeof(int)] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - "", /* italic */ - "", /* bold */ + "", /* italic */ + "", /* bold */ "", /* cw */ - "<+table border=0 cellpadding=0 cellspacing=0>
\n", /* indent1 */ - "<+table border=0 cellpadding=0 cellspacing=0>
\n", /* indent2 */ - "<+table border=0 cellpadding=0 cellspacing=0>
\n", /* indent3 */ + "<+table border=0 cellpadding=0 cellspacing=0>
\n", /* indent1 */ + "<+table border=0 cellpadding=0 cellspacing=0>
\n", /* indent2 */ + "<+table border=0 cellpadding=0 cellspacing=0>
\n", /* indent3 */ 0, 0, 0, "

", /* heading 25 */ - "", /* anchor 26 */ + "", /* anchor 26 */ }; char* - offattr[8*sizeof(ulong)] = + offattr[8*sizeof(int)] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - "", /* italic */ - "", /* bold */ - "", /* cw */ - "<-/table>", /* indent1 */ - "<-/table>", /* indent2 */ - "<-/table>", /* indent3 */ + "", /* italic */ + "", /* bold */ + "", /* cw */ + "<-/table>", /* indent1 */ + "<-/table>", /* indent2 */ + "<-/table>", /* indent3 */ 0, 0, 0, - "", /* heading 25 */ - "", /* anchor 26 */ + "", /* heading 25 */ + "", /* anchor 26 */ }; - Font *font[Nfont]; + Font *font[Nfont]; - Biobuf bout; + Biobuf bout; int debug = 0; /* troff state */ /n/sourcesdump/2005/1119/plan9/sys/src/cmd/troff2html/troff2html.c:126,141 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/troff2html/troff2html.c:129,144 int ps = 1; int res = 720; - int didP = 0; - int atnewline = 1; - int prevlineH = 0; - ulong attr = 0; /* or'ed into each Char */ + int didP = 0; + int atnewline = 1; + int prevlineH = 0; + Char attr = 0; /* or'ed into each Char */ - Char *chars; - int nchars; - int nalloc; + Char *chars; + int nchars; + int nalloc; char** anchors; /* allocated in order */ - int nanchors; + int nanchors; char *filename; int cno; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/troff2html/troff2html.c:245,251 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/troff2html/troff2html.c:248,254 } void - emitul(ulong ul) + emitchar(Char c) { if(nalloc == nchars){ nalloc += 10000; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/troff2html/troff2html.c:253,265 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/troff2html/troff2html.c:256,268 if(chars == nil) sysfatal("malloc failed: %r"); } - chars[nchars++] = ul; + chars[nchars++] = c; } void emit(Rune r) { - emitul(r | attr); + emitchar(r | attr); /* * Close man page references early, so that * .IR proof (1), /n/sourcesdump/2005/1119/plan9/sys/src/cmd/troff2html/troff2html.c:272,279 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/troff2html/troff2html.c:275,282 void emitstr(char *s) { - emitul(Estring); - emitul((ulong)s); + emitchar(Estring); + emitchar((Char)s); } int indentlevel; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/troff2html/troff2html.c:312,320 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/troff2html/troff2html.c:315,324 } void - setattr(ulong a) + setattr(Char a) { - int on, off, i, j; + Char on, off; + int i, j; on = a & ~attr; off = attr & ~a; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/troff2html/troff2html.c:348,353 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/troff2html/troff2html.c:352,359 if(j == Anchor) onattr[j] = anchors[nanchors++]; iputs(&bout, onattr[j]); + if(nnest >= nelem(nest)) + sysfatal("nesting too deep"); nest[nnest++] = j; } } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/troff2html/troff2html.c:358,364 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/troff2html/troff2html.c:364,370 flush(void) { int i; - ulong c, a; + Char c, a; nanchors = 0; for(i=0; i2 && strcmp(fld[2], "

")==0){ /* avoid triggering extra
*/ didP = 1; /* clear all font attributes before paragraph */ - emitul(' ' | (attr & ~(0xFFFF|((1<"); /* next emittec char will turn font attributes back on */ }else if(nfld>2 && strcmp(fld[2], "

")==0) 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 23687 Nov 19 20:17 sys/src/cmd/webcookies.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:25,67 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:25,67 char* dom; /* starts with . */ char* path; char* version; - char* comment; /* optional, may be nil */ + char* comment; /* optional, may be nil */ - uint expire; /* time of expiration: ~0 means when webcookies dies */ - int secure; - int explicitdom; /* dom was explicitly set */ - int explicitpath; /* path was explicitly set */ - int netscapestyle; + uint expire; /* time of expiration: ~0 means when webcookies dies */ + int secure; + int explicitdom; /* dom was explicitly set */ + int explicitpath; /* path was explicitly set */ + int netscapestyle; /* internal info */ - int deleted; - int mark; - int ondisk; + int deleted; + int mark; + int ondisk; }; struct Jar { Cookie *c; - int nc; - int mc; + int nc; + int mc; - Qid qid; - int dirty; - char *file; - char *lockfile; + Qid qid; + int dirty; + char *file; + char *lockfile; }; struct { - char *s; + char *s; int offset; int ishttp; } stab[] = { "domain", offsetof(Cookie, dom), 1, - "path", offsetof(Cookie, path), 1, - "name", offsetof(Cookie, name), 0, - "value", offsetof(Cookie, value), 0, - "comment", offsetof(Cookie, comment), 1, - "version", offsetof(Cookie, version), 1, + "path", offsetof(Cookie, path), 1, + "name", offsetof(Cookie, name), 0, + "value", offsetof(Cookie, value), 0, + "comment", offsetof(Cookie, comment), 1, + "version", offsetof(Cookie, version), 1, }; struct { /n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:68,75 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:68,75 char *s; int offset; } itab[] = { - "expire", offsetof(Cookie, expire), - "secure", offsetof(Cookie, secure), + "expire", offsetof(Cookie, expire), + "secure", offsetof(Cookie, secure), "explicitdomain", offsetof(Cookie, explicitdom), "explicitpath", offsetof(Cookie, explicitpath), "netscapestyle", offsetof(Cookie, netscapestyle), /n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:110,116 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:110,116 first = 1; for(j=0; jfid->file->aux){ + switch((uintptr)r->fid->file->aux){ case Xhttp: syncjar(jar); a = emalloc9p(sizeof(Aux)); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:1039,1045 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:1039,1045 Aux *a; a = r->fid->aux; - switch((int)r->fid->file->aux){ + switch((uintptr)r->fid->file->aux){ case Xhttp: if(a->state == NeedUrl){ respond(r, "must write url before read"); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:1071,1077 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:1071,1077 Jar *j; a = r->fid->aux; - switch((int)r->fid->file->aux){ + switch((uintptr)r->fid->file->aux){ case Xhttp: if(a->state == NeedUrl){ if(r->ifcall.count >= sizeof buf){ /n/sourcesdump/2005/1119/plan9/sys/src/cmd/webcookies.c:1157,1163 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/webcookies.c:1157,1163 a = fid->aux; if(a == nil) return; - switch((int)fid->file->aux){ + switch((uintptr)fid->file->aux){ case Xhttp: parsehttp(jar, a->inhttp, a->dom, a->path); break; 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 10774 Nov 19 20:09 sys/src/cmd/sam/cmd.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/cmd.c:50,59 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/cmd.c:50,61 Rune *linep = line; Rune *terminp = termline; Rune *termoutp = termline; - List cmdlist; - List addrlist; - List relist; - List stringlist; + + List cmdlist = { 'p' }; + List addrlist = { 'p' }; + List relist = { 'p' }; + List stringlist = { 'p' }; + int eof; void /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/cmd.c:244,250 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/cmd.c:246,252 Cmd *p; p = emalloc(sizeof(Cmd)); - inslist(&cmdlist, cmdlist.nused, (long)p); + inslist(&cmdlist, cmdlist.nused, p); return p; } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/cmd.c:254,260 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/cmd.c:256,262 Addr *p; p = emalloc(sizeof(Addr)); - inslist(&addrlist, addrlist.nused, (long)p); + inslist(&addrlist, addrlist.nused, p); return p; } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/cmd.c:264,270 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/cmd.c:266,272 String *p; p = emalloc(sizeof(String)); - inslist(&relist, relist.nused, (long)p); + inslist(&relist, relist.nused, p); Strinit(p); return p; } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/cmd.c:275,281 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/cmd.c:277,283 String *p; p = emalloc(sizeof(String)); - inslist(&stringlist, stringlist.nused, (long)p); + inslist(&stringlist, stringlist.nused, p); Strinit(p); return p; } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/cmd.c:286,294 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/cmd.c:288,296 int i; while(cmdlist.nused > 0) - free(cmdlist.ucharpptr[--cmdlist.nused]); + free(cmdlist.voidpptr[--cmdlist.nused]); while(addrlist.nused > 0) - free(addrlist.ucharpptr[--addrlist.nused]); + free(addrlist.voidpptr[--addrlist.nused]); while(relist.nused > 0){ i = --relist.nused; Strclose(relist.stringpptr[i]); [jmk] --rw-rw-r-- M 107020 glenda sys 1431 Nov 19 20:09 sys/src/cmd/sam/list.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/list.c:3,18 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/list.c:3,22 /* * Check that list has room for one more element. */ - void - growlist(List *l) + static void + growlist(List *l, int esize) { - if(l->listptr==0 || l->nalloc==0){ + uchar *p; + + if(l->listptr == nil || l->nalloc == 0){ l->nalloc = INCR; - l->listptr = emalloc(INCR*sizeof(long)); + l->listptr = emalloc(INCR*esize); l->nused = 0; - }else if(l->nused == l->nalloc){ - l->listptr = erealloc(l->listptr, (l->nalloc+INCR)*sizeof(long)); - memset((void*)(l->longptr+l->nalloc), 0, INCR*sizeof(long)); + } + else if(l->nused == l->nalloc){ + p = erealloc(l->listptr, (l->nalloc+INCR)*esize); + l->listptr = p; + memset(p+l->nalloc, 0, INCR*esize); l->nalloc += INCR; } } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/list.c:23,30 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/list.c:27,47 void dellist(List *l, int i) { - memmove(&l->longptr[i], &l->longptr[i+1], (l->nused-(i+1))*sizeof(long)); + Posn *pp; + void **vpp; + l->nused--; + + switch(l->type){ + case 'P': + pp = l->posnptr+i; + memmove(pp, pp+1, (l->nused-i)*sizeof(*pp)); + break; + case 'p': + vpp = l->voidpptr+i; + memmove(vpp, vpp+1, (l->nused-i)*sizeof(*vpp)); + break; + } } /* /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/list.c:31,41 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/list.c:48,77 * Add a new element, whose position is i, to the list */ void - inslist(List *l, int i, long val) + inslist(List *l, int i, ...) { - growlist(l); - memmove(&l->longptr[i+1], &l->longptr[i], (l->nused-i)*sizeof(long)); - l->longptr[i] = val; + Posn *pp; + void **vpp; + va_list list; + + + va_start(list, i); + switch(l->type){ + case 'P': + growlist(l, sizeof(*pp)); + pp = l->posnptr+i; + memmove(pp+1, pp, (l->nused-i)*sizeof(*pp)); + *pp = va_arg(list, Posn); + break; + case 'p': + growlist(l, sizeof(*vpp)); + vpp = l->voidpptr+i; + memmove(vpp+1, vpp, (l->nused-i)*sizeof(*vpp)); + *vpp = va_arg(list, void*); + break; + } + va_end(list); + l->nused++; } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/list.c:44,47 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/list.c:80,96 { free(l->listptr); free(l); + } + + List* + listalloc(int type) + { + List *l; + + l = emalloc(sizeof(List)); + l->type = type; + l->nalloc = 0; + l->nused = 0; + + return l; } [jmk] --rw-rw-r-- M 107020 glenda sys 14291 Nov 19 20:09 sys/src/cmd/sam/mesg.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/mesg.c:13,22 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/mesg.c:13,30 int noflush; int tversion; - long inlong(void); - long invlong(void); int inshort(void); + long inlong(void); + vlong invlong(void); int inmesg(Tmesg); + + void outshort(int); + void outlong(long); + void outvlong(vlong); + void outcopy(int, void*); + void outsend(void); + void outstart(Hmesg); + void setgenstr(File*, Posn, Posn); #ifdef DEBUG /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/mesg.c:90,101 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/mesg.c:98,119 { char buf[32]; - sprint(buf, "%ld", n); + snprint(buf, sizeof(buf), "%ld", n); journal(out, buf); } + + void + journalv(int out, vlong v) + { + char buf[32]; + + sprint(buf, sizeof(buf), "%lld", v); + journal(out, buf); + } #else #define journal(a, b) #define journaln(a, b) + #define journalv(a, b) #endif int /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/mesg.c:176,181 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/mesg.c:194,200 int i, m; short s; long l, l1; + vlong v; File *f; Posn p0, p1, p; Range r; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/mesg.c:204,218 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/mesg.c:223,237 break; case Tstartcmdfile: - l = invlong(); /* for 64-bit pointers */ - journaln(0, l); + v = invlong(); /* for 64-bit pointers */ + journalv(0, v); Strdupl(&genstr, samname); cmd = newfile(); cmd->unread = 0; - outTsv(Hbindname, cmd->tag, l); + outTsv(Hbindname, cmd->tag, v); outTs(Hcurrent, cmd->tag); logsetname(cmd, &genstr); - cmd->rasp = emalloc(sizeof(List)); + cmd->rasp = listalloc('P'); cmd->mod = 0; if(cmdstr.n){ loginsert(cmd, 0L, cmdstr.s, cmdstr.n); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/mesg.c:263,269 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/mesg.c:282,288 termlocked++; f = whichfile(inshort()); if(!f->rasp) /* this might be a duplicate message */ - f->rasp = emalloc(sizeof(List)); + f->rasp = listalloc('P'); current(f); outTsv(Hbindname, f->tag, invlong()); /* for 64-bit pointers */ outTs(Hcurrent, f->tag); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/mesg.c:353,363 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/mesg.c:372,382 break; case Tstartnewfile: - l = invlong(); + v = invlong(); Strdupl(&genstr, empty); f = newfile(); - f->rasp = emalloc(sizeof(List)); - outTsv(Hbindname, f->tag, l); + f->rasp = listalloc('P'); + outTsv(Hbindname, f->tag, v); logsetname(f, &genstr); outTs(Hcurrent, f->tag); current(f); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/mesg.c:593,608 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/mesg.c:612,627 return n; } - long + vlong invlong(void) { - ulong n; + vlong v; - n = (inp[7]<<24) | (inp[6]<<16) | (inp[5]<<8) | inp[4]; - n = (n<<16) | (inp[3]<<8) | inp[2]; - n = (n<<16) | (inp[1]<<8) | inp[0]; + v = (inp[7]<<24) | (inp[6]<<16) | (inp[5]<<8) | inp[4]; + v = (v<<16) | (inp[3]<<8) | inp[2]; + v = (v<<16) | (inp[1]<<8) | inp[0]; inp += 8; - return n; + return v; } void /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/mesg.c:732,743 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/mesg.c:751,762 } void - outTsv(Hmesg type, int s, Posn l) + outTsv(Hmesg type, int s, vlong v) { outstart(type); outshort(s); - outvlong((void*)l); - journaln(1, l); + outvlong(v); + journalv(1, v); outsend(); } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/mesg.c:773,786 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/mesg.c:792,805 } void - outvlong(void *v) + outvlong(vlong v) { int i; - ulong l; - l = (ulong) v; - for(i = 0; i < 8; i++, l >>= 8) - *outp++ = l; + for(i = 0; i < 8; i++){ + *outp++ = v; + v >>= 8; + } } void [jmk] --rw-rw-r-- M 107020 glenda sys 1844 Nov 19 20:09 sys/src/cmd/sam/multi.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/multi.c:1,6 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/multi.c:1,6 #include "sam.h" - List file; + List file = { 'p' }; ushort tag; File * /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/multi.c:9,15 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/multi.c:9,15 File *f; f = fileopen(); - inslist(&file, 0, (long)f); + inslist(&file, 0, f); f->tag = tag++; if(downloaded) outTs(Hnewname, f->tag); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/multi.c:88,94 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/multi.c:88,94 break; } } - inslist(&file, i, (long)f); + inslist(&file, i, f); if(downloaded) outTsS(Hmovname, f->tag, &f->name); } [jmk] --rw-rw-r-- M 107020 glenda sys 5618 Nov 19 20:09 sys/src/cmd/sam/rasp.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/rasp.c:177,183 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/rasp.c:177,183 } #define M 0x80000000L - #define P(i) r->longptr[i] + #define P(i) r->posnptr[i] #define T(i) (P(i)&M) /* in terminal */ #define L(i) (P(i)&~M) /* length of this piece */ [jmk] --rw-rw-r-- M 107020 glenda sys 12016 Nov 19 20:09 sys/src/cmd/sam/sam.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/sam.c:14,20 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/sam.c:14,20 File *flist; File *cmd; jmp_buf mainloop; - List tempfile; + List tempfile = { 'p' }; int quitok = TRUE; int downloaded; int dflag; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/sam.c:73,79 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/sam.c:73,78 Strinit0(&genstr); Strinit0(&rhs); Strinit0(&curwd); - tempfile.listptr = emalloc(1); /* so it can be freed later */ Strinit0(&plan9cmd); home = getenv(HOME); disk = diskinit(); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/sam.c:707,716 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/sam.c:706,716 settempfile(void) { if(tempfile.nalloc < file.nused){ - free(tempfile.listptr); - tempfile.listptr = emalloc(sizeof(*tempfile.filepptr)*file.nused); + if(tempfile.filepptr) + free(tempfile.filepptr); + tempfile.filepptr = emalloc(sizeof(File*)*file.nused); tempfile.nalloc = file.nused; } + memmove(tempfile.filepptr, file.filepptr, sizeof(File*)*file.nused); tempfile.nused = file.nused; - memmove(&tempfile.filepptr[0], &file.filepptr[0], file.nused*sizeof(File*)); } [jmk] --rw-rw-r-- M 107020 glenda sys 9345 Nov 19 20:09 sys/src/cmd/sam/sam.h /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/sam.h:64,91 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/sam.h:64,89 Rune *s; }; - struct List /* code depends on a long being able to hold a pointer */ + struct List { + int type; int nalloc; int nused; union{ - void *listp; - Block *blkp; - long *longp; - uchar* *ucharp; - String* *stringp; - File* *filep; - long listv; + void* listp; + Block* blkp; + void** voidp; + Posn* posnp; + String**stringp; + File** filep; }g; }; #define listptr g.listp - #define blkptr g.blkp - #define longptr g.longp - #define ucharpptr g.ucharp + #define voidpptr g.voidp + #define posnptr g.posnp #define stringpptr g.stringp #define filepptr g.filep - #define listval g.listv enum { /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/sam.h:262,269 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/sam.h:260,268 int getname(File*, String*, int); long getnum(int); void hiccough(char*); - void inslist(List*, int, long); + void inslist(List*, int, ...); Address lineaddr(Posn, Address, int); + List *listalloc(int); void listfree(List*); void load(File*); File *lookfile(String*); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/sam/sam.h:396,406 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/sam/sam.h:395,399 void outTsllS(Hmesg, int, long, long, String*); void outTsll(Hmesg, int, long, long); void outTsl(Hmesg, int, long); - void outTsv(Hmesg, int, long); - void outstart(Hmesg); - void outcopy(int, void*); - void outshort(int); - void outlong(long); - void outvlong(void*); - void outsend(void); + void outTsv(Hmesg, int, vlong); void outflush(void); Add getcallerpc. [jmk] --rw-rw-r-- M 107020 jmk sys 50 Nov 19 20:14 sys/src/libc/68020/getcallerpc.s [jmk] --rw-rw-r-- M 107020 glenda sys 632 Nov 19 20:14 sys/src/libc/68020/mkfile /n/sourcesdump/2005/1119/plan9/sys/src/libc/68020/mkfile:4,9 - /n/sourcesdump/2005/1120/plan9/sys/src/libc/68020/mkfile:4,10 LIB=/$objtype/lib/libc.a SFILES=\ argv0.s\ + getcallerpc.$O\ getfcr.s\ main9.s\ main9p.s\ [jmk] --rw-rw-r-- M 107020 jmk sys 48 Nov 19 20:12 sys/src/libc/arm/getcallerpc.s [jmk] --rw-rw-r-- M 107020 glenda sys 402 Nov 19 20:11 sys/src/libc/arm/mkfile /n/sourcesdump/2005/1119/plan9/sys/src/libc/arm/mkfile:5,10 - /n/sourcesdump/2005/1120/plan9/sys/src/libc/arm/mkfile:5,11 SFILES=\ argv0.s\ div.s\ + getcallerpc.$O\ getfcr.s\ main9.s\ main9p.s\ [jmk] --rw-rw-r-- M 107020 jmk sys 49 Nov 19 20:14 sys/src/libc/sparc/getcallerpc.s [jmk] --rw-rw-r-- M 107020 glenda sys 451 Nov 19 20:15 sys/src/libc/sparc/mkfile /n/sourcesdump/2005/1119/plan9/sys/src/libc/sparc/mkfile:4,9 - /n/sourcesdump/2005/1120/plan9/sys/src/libc/sparc/mkfile:4,10 LIB=/$objtype/lib/libc.a SFILES=\ argv0.s\ + getcallerpc.$O\ getfcr.s\ main9.s\ main9p.s\ - [rsc] --rw-rw-r-- M 107020 rsc sys 3122 Nov 19 21:48 sys/src/cmd/vnc/compat.c [rsc] --rw-rw-r-- M 107020 rsc sys 3122 Nov 19 21:48 sys/src/cmd/vnc/compat.c [jmk] --rw-rw-r-- M 107020 rsc sys 6786 Nov 19 22:14 sys/src/cmd/vnc/devcons.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/vnc/devcons.c:289,296 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/vnc/devcons.c:289,295 static long consread(Chan *c, void *buf, long n, vlong off) { - char *cbuf, ch; - int i, eol; + char ch; int send; if(n <= 0) 64-bit fixes [jmk] --rw-rw-r-- M 107020 glenda sys 3752 Nov 19 20:04 sys/src/cmd/rc/io.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/rc/io.c:28,34 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/rc/io.c:28,35 poct(f, va_arg(ap, unsigned)); break; case 'p': - phex(f, (long)va_arg(ap, char *)); break; /*unportable*/ + pptr(f, va_arg(ap, void*)); + break; case 'Q': pquo(f, va_arg(ap, char *)); break; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/rc/io.c:94,102 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/rc/io.c:95,109 } void - phex(io *f, long p) + pptr(io *f, void *v) { int n; + uintptr p; + + p = (uintptr)v; + if(sizeof(uintptr) == sizeof(uvlong) && p>>32) + for(n = 60;n>=32;n-=4) pchr(f, "0123456789ABCDEF"[(p>>n)&0xF]); + for(n = 28;n>=0;n-=4) pchr(f, "0123456789ABCDEF"[(p>>n)&0xF]); } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/rc/io.c:109,115 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/rc/io.c:116,122 } void - pdec(io *f, long n) + pdec(io *f, int n) { if(n<0){ n=-n; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/rc/io.c:131,137 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/rc/io.c:138,144 } void - poct(io *f, ulong n) + poct(io *f, unsigned n) { if(n>7) poct(f, n>>3); [jmk] --rw-rw-r-- M 107020 glenda sys 535 Nov 19 20:04 sys/src/cmd/rc/io.h /n/sourcesdump/2005/1119/plan9/sys/src/cmd/rc/io.h:13,21 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/rc/io.h:13,21 void closeio(io*); void flush(io*); int fullbuf(io*, int); - void pdec(io*, long); - void poct(io*, ulong); - void phex(io*, long); + void pdec(io*, int); + void poct(io*, unsigned); + void pptr(io*, void*); void pquo(io*, char*); void pwrd(io*, char*); void pstr(io*, char*); [jmk] --rw-rw-r-- M 107020 glenda sys 9330 Nov 19 20:04 sys/src/cmd/rc/plan9.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/rc/plan9.c:350,356 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/rc/plan9.c:350,356 int Globsize(char *p) { - ulong isglob = 0, globlen = NDIR+1; + int isglob = 0, globlen = NDIR+1; for(;*p;p++){ if(*p==GLOB){ p++; [jmk] --rw-rw-r-- M 107020 rsc sys 8697 Nov 19 20:04 sys/src/cmd/rc/win32.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/rc/win32.c:307,313 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/rc/win32.c:307,313 int Globsize(char *p) { - ulong isglob = 0, globlen = NDIR+1; + int isglob = 0, globlen = NDIR+1; for(;*p;p++){ if(*p==GLOB){ p++; 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 12581 Nov 19 20:09 sys/src/cmd/samterm/mesg.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/samterm/mesg.c:21,27 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/samterm/mesg.c:21,27 void inmesg(Hmesg, int); int inshort(int); long inlong(int); - long invlong(int); + vlong invlong(int); void hsetdot(int, long, long); void hmoveto(int, long); void hsetsnarf(int); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/samterm/mesg.c:323,329 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/samterm/mesg.c:323,329 void startfile(Text *t) { - outTsv(Tstartfile, t->tag, t); /* for 64-bit pointers */ + outTsv(Tstartfile, t->tag, (vlong)t); /* for 64-bit pointers */ setlock(); } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/samterm/mesg.c:331,337 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/samterm/mesg.c:331,337 startnewfile(int type, Text *t) { t->tag = Untagged; - outTv(type, t); /* for 64-bit pointers */ + outTv(type, (vlong)t); /* for 64-bit pointers */ } int /n/sourcesdump/2005/1119/plan9/sys/src/cmd/samterm/mesg.c:347,361 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/samterm/mesg.c:347,361 ((long)indata[n+2]<<16)|((long)indata[n+3]<<24); } - long + vlong invlong(int n) { - long l; + vlong v; - l = (indata[n+7]<<24) | (indata[n+6]<<16) | (indata[n+5]<<8) | indata[n+4]; - l = (l<<16) | (indata[n+3]<<8) | indata[n+2]; - l = (l<<16) | (indata[n+1]<<8) | indata[n]; - return l; + v = (indata[n+7]<<24) | (indata[n+6]<<16) | (indata[n+5]<<8) | indata[n+4]; + v = (v<<16) | (indata[n+3]<<8) | indata[n+2]; + v = (v<<16) | (indata[n+1]<<8) | indata[n]; + return v; } void /n/sourcesdump/2005/1119/plan9/sys/src/cmd/samterm/mesg.c:410,428 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/samterm/mesg.c:410,428 } void - outTsv(Tmesg type, int s1, void *l1) + outTsv(Tmesg type, int s1, vlong v1) { outstart(type); outshort(s1); - outvlong(l1); + outvlong(v1); outsend(); } void - outTv(Tmesg type, void *l1) + outTv(Tmesg type, vlong v1) { outstart(type); - outvlong(l1); + outvlong(v1); outsend(); } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/samterm/mesg.c:490,504 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/samterm/mesg.c:490,504 } void - outvlong(void *v) + outvlong(vlong v) { int i; - ulong l; uchar buf[8]; - l = (ulong) v; - for(i = 0; i < sizeof(buf); i++, l >>= 8) - buf[i] = l; + for(i = 0; i < sizeof(buf); i++){ + buf[i] = v; + v >>= 8; + } outcopy(8, buf); } [jmk] --rw-rw-r-- M 107020 glenda sys 3773 Nov 19 20:09 sys/src/cmd/samterm/samterm.h /n/sourcesdump/2005/1119/plan9/sys/src/cmd/samterm/samterm.h:169,179 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/samterm/samterm.h:169,179 void outTslS(Tmesg, int, long, Rune*); void outTsll(Tmesg, int, long, long); void outTsl(Tmesg, int, long); - void outTsv(Tmesg, int, void*); - void outTv(Tmesg, void*); + void outTsv(Tmesg, int, vlong); + void outTv(Tmesg, vlong); void outstart(Tmesg); void outcopy(int, uchar*); void outshort(int); void outlong(long); - void outvlong(void*); + void outvlong(vlong); void outsend(void); 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 8706 Nov 19 20:18 sys/src/cmd/vl/pass.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/vl/pass.c:133,139 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/vl/pass.c:133,139 continue; /* size should be 19 max */ if(strlen(s->name) >= 10) /* has loader address */ - sprint(literal, "$%lux.%lux", (long)s, p->from.offset); + sprint(literal, "$%p.%lux", s, p->from.offset); else sprint(literal, "$%s.%d.%lux", s->name, s->version, p->from.offset); } else { Add getcallerpc. [jmk] --rw-rw-r-- M 107020 jmk sys 76 Nov 19 20:39 sys/src/ape/lib/9/386/getcallerpc.c [jmk] --rw-rw-r-- M 107020 jmk sys 50 Nov 19 20:39 sys/src/ape/lib/9/68020/getcallerpc.s 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 17151 Nov 19 20:54 sys/src/cmd/9660srv/9660srv.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/9660srv/9660srv.c:159,165 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/9660srv/9660srv.c:159,165 if(getdrec(root, rd) >= 0){ n = rd->reclen-(34+rd->namelen); s = (uchar*)rd->name + rd->namelen; - if((ulong)s & 1){ + if((uintptr)s & 1){ s++; n--; } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/9660srv/9660srv.c:620,626 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/9660srv/9660srv.c:620,626 sysl = dp->reclen-(34+dp->namelen); s = (uchar*)dp->name + dp->namelen; - if(((ulong)s) & 1) { + if(((uintptr)s) & 1) { s++; sysl--; } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/9660srv/9660srv.c:649,655 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/9660srv/9660srv.c:649,655 memset(d->gid, 0, ONAMELEN); memmove(d->gid, s+1, nl); s += 1 + *s; - if(((ulong)s) & 1) + if(((uintptr)s) & 1) s++; d->mode = l32(s); if(d->mode & DMDIR) /n/sourcesdump/2005/1119/plan9/sys/src/cmd/9660srv/9660srv.c:707,713 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/9660srv/9660srv.c:707,713 s += fs->suspoff; sysl -= fs->suspoff; for(; sysl >= 4 && have != (Hname|Hmode); sysl -= l, s += l){ - if(s[0] == 0 && ((ulong)s & 1)){ + if(s[0] == 0 && ((uintptr)s & 1)){ /* MacOS pads individual entries, contrary to spec */ s++; sysl--; 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 25875 Nov 19 20:55 sys/src/cmd/aux/depend.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/aux/depend.c:5,10 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/aux/depend.c:5,17 #include #include + typedef struct Args Args; + + struct Args { + int argc; + char **argv; + }; + typedef struct Dfile Dfile; typedef struct Fid Fid; typedef struct File File; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/aux/depend.c:258,268 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/aux/depend.c:265,277 int srv; char service[128]; struct Fsarg fsarg; + Args *args; int argc; char **argv; - argc = (int)((void**)a)[0]; - argv = ((void**)a)[1]; + args = a; + argc = args->argc; + argv = args->argv; fmtinstall('F', fcallfmt); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/aux/depend.c:272,278 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/aux/depend.c:281,287 break; }ARGEND if(argc != 2){ - fprint(2, "usage: %s [-d] svc-name directory", argv0); + fprint(2, "usage: %s [-d] svc-name directory\n", argv0); exits("usage"); } snprint(service, sizeof service, "#s/%s", argv[0]); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/aux/depend.c:307,318 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/aux/depend.c:316,327 void threadmain(int argc, char *argv[]) { - static void *a[2]; + static Args args; - a[0] = (void*)argc; - a[1] = argv; + args.argc = argc; + args.argv = argv; rfork(RFNAMEG); - proccreate(realmain, a, 16*1024); + proccreate(realmain, &args, 16*1024); } char* Add for libraries. [jmk] --rw-rw-r-- M 107020 glenda sys 454 Nov 19 20:52 sys/src/cmd/cc/compat.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/cc/compat.c:40,42 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/cc/compat.c:40,47 memset(v, 0, size); return v; } + + void + setmalloctag(void*, ulong) + { + } [jmk] --rw-rw-r-- M 107020 glenda sys 26833 Nov 19 20:52 sys/src/cmd/cc/dcl.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/cc/dcl.c:374,382 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/cc/dcl.c:374,381 a = a->left; } if(!sametype(t, a->type)) { - diag(a, "initialization of incompatible pointers: %s", - s->name); - print("%T and %T\n", t, a->type); + diag(a, "initialization of incompatible pointers: %s\n%T and %T", + s->name, t, a->type); } if(a->op == OADDR) a = a->left; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/cc/dcl.c:1535,1540 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/cc/dcl.c:1534,1540 { Node *p, *r, *q, *m; long w; + Type *zt; if(debug['i']) { print("contig v = %ld; s = %s\n", v, s->name); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/cc/dcl.c:1558,1564 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/cc/dcl.c:1558,1564 stkoff = maxround(stkoff, autoffset); symadjust(s, n, v - s->offset); } - if(w <= 4) + if(w <= ewidth[TIND]) goto no; if(n->op == OAS) diag(Z, "oops in contig"); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/cc/dcl.c:1572,1581 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/cc/dcl.c:1572,1581 if(n->left->type) if(n->left->type->width == w) goto no; - while(w & 3) + while(w & ewidth[TIND]) w++; /* is this a bug?? */ /* - * insert the following code + * insert the following code, where long becomes vlong if pointers are fat * *(long**)&X = (long*)((char*)X + sizeof(X)); do { /n/sourcesdump/2005/1119/plan9/sys/src/cmd/cc/dcl.c:1587,1595 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/cc/dcl.c:1587,1597 for(q=n; q->op != ONAME; q=q->left) ; + zt = ewidth[TIND] > ewidth[TLONG]? types[TVLONG]: types[TLONG]; + p = new(ONAME, Z, Z); *p = *q; - p->type = typ(TIND, types[TLONG]); + p->type = typ(TIND, zt); p->xoffset = s->offset; r = new(ONAME, Z, Z); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/cc/dcl.c:1602,1608 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/cc/dcl.c:1604,1610 m = new(OCONST, Z, Z); m->vconst = 0; - m->type = types[TLONG]; + m->type = zt; q = new(OAS, q, m); 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 10050 Nov 19 20:57 sys/src/cmd/hoc/code.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/hoc/code.c:165,171 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/hoc/code.c:165,171 execerror(sp->name, "call nested too deeply"); fp++; fp->sp = sp; - fp->nargs = (int)pc[1]; + fp->nargs = (int)(uintptr)pc[1]; fp->retpc = pc + 2; fp->argn = stackp - 1; /* last argument */ if(fp->nargs != sp->u.defn->nargs) 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 9340 Nov 19 20:52 sys/src/cmd/kl/pass.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/kl/pass.c:131,137 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/kl/pass.c:131,137 continue; /* size should be 19 max */ if(strlen(s->name) >= 10) /* has loader address */ - sprint(literal, "$%lux.%lux", (long)s, p->from.offset); + sprint(literal, "$%p.%lux", s, p->from.offset); else sprint(literal, "$%s.%d.%lux", s->name, s->version, p->from.offset); } else { 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 41032 Nov 19 21:00 sys/src/cmd/ms2html.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:25,30 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:25,32 }; char *delim = "$$"; + char *basename; + char *title; int eqnmode; int quiet; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:38,45 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:40,48 int ifwastrue[Maxif]; int list, listnum, example; - int hangingau, hangingdt, hanginghead; + int hangingau, hangingdt, hanginghead, hangingcenter; int indirective, paragraph, sol, titleseen, ignore_nl, weBref; + void dohangingcenter(void); typedef struct Goobie Goobie; typedef struct Goobieif Goobieif; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1363,1369 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1366,1372 static void usage(void) { - sysfatal("Usage: %s\n", argv0); + sysfatal("usage: ms2html [-q] [-b basename] [-d '$$'] [-t title]\n"); } void /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1371,1376 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1374,1385 { quiet = 1; ARGBEGIN { + case 't': + title = EARGF(usage()); + break; + case 'b': + basename = EARGF(usage()); + break; case 'q': quiet = 0; break; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1580,1585 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1589,1595 g_SH(int, char**) { dohanginghead(); + dohangingcenter(); closel(); closefont(); Bprint(&bout, "", HH); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1594,1599 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1604,1610 closel(); closefont(); + dohangingcenter(); if(argc == 1) level = 0; else { /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1624,1655 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1635,1679 closefont(); if(!titleseen){ - /* get base part of filename */ - p = strrchr(ssp->filename, '/'); - if(p == nil) - p = ssp->filename; - else - p++; - strncpy(name, p, sizeof(name)); - name[sizeof(name)-1] = 0; - - /* dump any extensions */ - np = strchr(name, '.'); - if(np) - *np = 0; - + if(!title){ + /* get base part of filename */ + p = strrchr(ssp->filename, '/'); + if(p == nil) + p = ssp->filename; + else + p++; + strncpy(name, p, sizeof(name)); + name[sizeof(name)-1] = 0; + + /* dump any extensions */ + np = strchr(name, '.'); + if(np) + *np = 0; + title = p; + } Bprint(&bout, "\n"); - Bprint(&bout, "%s\n", p); + Bprint(&bout, "%s\n", title); Bprint(&bout, "\n"); Bprint(&bout, "\n"); titleseen = 1; } + Bprint(&bout, "
"); + hangingcenter = 1; Bprint(&bout, "", 1); hanginghead = 1; } void + dohangingcenter(void) + { + if(hangingcenter){ + Bprint(&bout, "
"); + hangingcenter = 1; + } + } + + void g_AU(int, char**) { closel(); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1895,1901 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1919,1926 g_AB(int, char**) { closel(); - Bprint(&bout, "

ABSTRACT

\n"); + dohangingcenter(); + Bprint(&bout, "

ABSTRACT

\n"); } void /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:2071,2082 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:2096,2111 else return; - p = strrchr(sstack[0].filename, '/'); - if(p != nil) - p++; - else - p = sstack[0].filename; - snprint(name, sizeof(name), "%s.%d%d.gif", p, getpid(), gif++); + if(basename) + p = basename; + else{ + p = strrchr(sstack[0].filename, '/'); + if(p != nil) + p++; + else + p = sstack[0].filename; + } + snprint(name, sizeof(name), "%s.%d.gif", p, gif++); fd = create(name, OWRITE, 0664); if(fd < 0){ fprint(2, "ms2html: can't create %s: %r\n", name); /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:2106,2113 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:2135,2142 close(fd); close(pfd[0]); fprint(pfd[1], ".ll 7i\n"); - fprint(pfd[1], ".EQ\ndelim %s\n.EN\n", delim); - fprint(pfd[1], ".%s\n", argv[0]); + /* fprint(pfd[1], ".EQ\ndelim %s\n.EN\n", delim); */ + /* fprint(pfd[1], ".%s\n", argv[0]); */ for(;;){ p = Brdline(&ssp->in, '\n'); if(p == nil) Add getcallerpc. [jmk] --rw-rw-r-- M 107020 jmk sys 48 Nov 19 20:39 sys/src/ape/lib/9/alpha/getcallerpc.s 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 6044 Nov 19 20:48 sys/src/cmd/1c/gc.h /n/sourcesdump/2005/1119/plan9/sys/src/cmd/1c/gc.h:318,323 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/1c/gc.h:318,324 void fpbranch(void); void patch(Prog*, long); void gpseudo(int, Sym*, int, long); + void gpseudotree(int, Sym*, Node*); void indx(Node*); void bcomplex(Node*); [jmk] --rw-rw-r-- M 107020 glenda sys 15407 Nov 19 20:49 sys/src/cmd/1c/swt.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/1c/swt.c:882,888 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/1c/swt.c:882,888 p->from.displace = 4; return; } - gpseudo(ADATA, s, D_TREE, (long)a); + gpseudotree(ADATA, s, a); p->from.offset += o; p->from.displace = w; } [jmk] --rw-rw-r-- M 107020 glenda sys 17123 Nov 19 20:49 sys/src/cmd/1c/txt.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/1c/txt.c:638,647 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/1c/txt.c:638,647 } else { p->from.type = gf; if(gf == D_CONST) { - p->from.offset = (long)f; + p->from.offset = (long)(uintptr)f; if(typefd[i]) { p->from.type = D_FCONST; - p->from.dval = (long)f; + p->from.dval = (long)(uintptr)f; } } } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/1c/txt.c:651,657 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/1c/txt.c:651,657 } else { p->to.type = gt; if(gt == D_CONST) - p->to.offset = (long)t; + p->to.offset = (long)(uintptr)t; } if(o == OBIT) { p->from.field = f->type->nbits; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/1c/txt.c:803,813 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/1c/txt.c:803,825 if(a == ADATA) pc--; p->as = a; - if(g != D_TREE) { - p->to.type = g; - p->to.offset = v; - } else - naddr((Node*)v, &p->to, D_NONE); + p->to.type = g; + p->to.offset = v; + p->from.sym = s; + p->from.type = D_EXTERN; + if(s->class == CSTATIC) + p->from.type = D_STATIC; + } + + void + gpseudotree(int a, Sym *s, Node *n) + { + + nextpc(); + if(a == ADATA) + pc--; + p->as = a; + naddr(n, &p->to, D_NONE); p->from.sym = s; p->from.type = D_EXTERN; if(s->class == CSTATIC) 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 11861 Nov 19 20:33 sys/src/cmd/ql/pass.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/ql/pass.c:131,137 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/ql/pass.c:131,137 continue; /* size should be 19 max */ if(strlen(s->name) >= 10) /* has loader address */ - sprint(literal, "$%lux.%lux", (long)s, p->from.offset); + sprint(literal, "$%p.%lux", s, p->from.offset); else sprint(literal, "$%s.%d.%lux", s->name, s->version, p->from.offset); } else { 64-bit fixes. [jmk] --rwxrwxr-- M 107020 glenda sys 8676 Nov 19 20:33 sys/src/cmd/7l/pass.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/7l/pass.c:130,138 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/7l/pass.c:130,138 continue; /* size should be 19 max */ if(strlen(s->name) >= 10) /* has loader address */ - sprint(literal, "$%lux.%lux", (long)s, (long)p->from.offset); + sprint(literal, "$%p.%llux", s, p->from.offset); else - sprint(literal, "$%s.%d.%lux", s->name, s->version, (long)p->from.offset); + sprint(literal, "$%s.%d.%llux", s->name, s->version, p->from.offset); } else { if(p->from.name != D_NONE) continue; 64-bit fixes. [jmk] --rw-rw-r-- M 107020 presotto sys 12318 Nov 19 20:57 sys/src/cmd/fossil/flfmt9660.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/fossil/flfmt9660.c:515,521 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/fossil/flfmt9660.c:515,521 ind++; memset(&d, 0, sizeof d); p = c->name + c->namelen; - if(((ulong)p) & 1) + if(((uintptr)p) & 1) p++; sysl = (uchar*)c + c->len - p; if(sysl <= 0) /n/sourcesdump/2005/1119/plan9/sys/src/cmd/fossil/flfmt9660.c:523,529 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/fossil/flfmt9660.c:523,529 d.name = getname(&p); d.uid = getname(&p); d.gid = getname(&p); - if((ulong)p & 1) + if((uintptr)p & 1) p++; d.mode = little(p, 4); if(d.name[0] == 0) Add getcallerpc. [jmk] --rw-rw-r-- M 107020 jmk sys 48 Nov 19 20:39 sys/src/ape/lib/9/arm/getcallerpc.s Add getcallerpc. [jmk] --rw-rw-r-- M 107020 jmk sys 47 Nov 19 20:39 sys/src/ape/lib/9/mips/getcallerpc.s Add getcallerpc, sort. [jmk] --rw-rw-r-- M 107020 glenda sys 392 Nov 19 20:39 sys/src/ape/lib/9/mkfile /n/sourcesdump/2005/1119/plan9/sys/src/ape/lib/9/mkfile:4,18 - /n/sourcesdump/2005/1120/plan9/sys/src/ape/lib/9/mkfile:4,20 LIB=/$objtype/lib/ape/lib9.a OFILES=errstr.$O\ bind.$O\ + getcallerpc.$O\ + getfcr.$O\ mount.$O\ - unmount.$O\ + rendezvous.$O\ rfork.$O\ segattach.$O\ segdetach.$O\ segflush.$O\ segfree.$O\ - rendezvous.$O\ - getfcr.$O\ + setmalloctag.$O\ + unmount.$O\ from.displace = 4; return; } - gpseudo(ADATA, s, D_TREE, (long)a); + gpseudotree(ADATA, s, a); p->from.offset += o; p->from.displace = w; } [jmk] --rw-rw-r-- M 107020 glenda sys 17847 Nov 19 20:50 sys/src/cmd/2c/txt.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/2c/txt.c:674,683 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/2c/txt.c:674,683 } else { p->from.type = gf; if(gf == D_CONST) { - p->from.offset = (long)f; + p->from.offset = (long)(uintptr)f; if(typefd[i]) { p->from.type = D_FCONST; - p->from.dval = (long)f; + p->from.dval = (long)(uintptr)f; } } } /n/sourcesdump/2005/1119/plan9/sys/src/cmd/2c/txt.c:687,693 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/2c/txt.c:687,693 } else { p->to.type = gt; if(gt == D_CONST) - p->to.offset = (long)t; + p->to.offset = (long)(uintptr)t; } if(o == OBIT) { p->from.field = f->type->nbits; /n/sourcesdump/2005/1119/plan9/sys/src/cmd/2c/txt.c:839,849 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/2c/txt.c:839,862 if(a == ADATA) pc--; p->as = a; - if(g != D_TREE) { - p->to.type = g; - p->to.offset = v; - } else - naddr((Node*)v, &p->to, D_NONE); + if(g == D_TREE) + abort(); /* obsolete */ + p->to.type = g; + p->to.offset = v; + p->from.sym = s; + p->from.type = D_EXTERN; + if(s->class == CSTATIC) + p->from.type = D_STATIC; + } + + void + gpseudotree(int a, Sym *s, Node *n) + { + nextpc(); + if(a == ADATA) + pc--; + p->as = a; + naddr(n, &p->to, D_NONE); p->from.sym = s; p->from.type = D_EXTERN; if(s->class == CSTATIC) Put date in title. [jmk] --rw-rw-r-- M 107020 glenda sys 4522 Nov 19 21:11 sys/lib/dist/mkfile /n/sourcesdump/2005/1119/plan9/sys/lib/dist/mkfile:19,25 - /n/sourcesdump/2005/1120/plan9/sys/lib/dist/mkfile:19,28 bind pc/cddisk cdstub/bootdisk.img if(! test -f $d/bootdisk.img) bind -a cdstub $d - disk/mk9660 -9cj -v 'Plan 9 4th Ed.' -s $d \ + title=`{date | sed 's/(...) (...) (..) (..:..):.. (...) (....)/Plan 9 - \2 \3 \6 \4/'} + title=$"title + echo 'CD:' $title + disk/mk9660 -9cj -v $title -s $d \ -b bootdisk.img $target /sys/lib/dist/web.protect/%.iso.bz2: /n/fsother/dist/%.iso.bz2 /n/sourcesdump/2005/1119/plan9/sys/lib/dist/mkfile:138,140 - /n/sourcesdump/2005/1120/plan9/sys/lib/dist/mkfile:141,144 mail -s 'non-group-writable files on fs '^$dd 9trouble /net/ipifc/clone + if(~ $#dmamode 0) + dmamode=ask + if(~ $dmamode ask){ + echo -n 'use DMA for ide drives[yes]: ' + dmamode=`{read} + if(~ $#dmamode 0) + dmamode=yes + } + if(~ $dmamode yes) + for(i in /dev/sd*/ctl) + if(test -f $i) + {echo dma on; echo rwm on} >$i + if(~ $installmode ask){ echo -n 'install mode is (text, graphics)[graphics]: ' installmode=`{read} 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 2402 Nov 19 21:11 sys/man/6/snap /n/sourcesdump/2005/1119/plan9/sys/man/6/snap:18,24 - /n/sourcesdump/2005/1120/plan9/sys/man/6/snap:18,24 check that this line begins with the specified prefix. .PP Throughout the rest of the snapshot, decimal strings are - always right-justified, blank-padded to 11 characters, + always right-justified, blank-padded to at least 11 characters, and followed by a single space character. .PP The rest of the snapshot is one or more records, Add -d flag for bargraph. [jmk] --rw-rw-r-- M 107020 glenda sys 15346 Nov 19 21:03 sys/src/cmd/venti/dat.h /n/sourcesdump/2005/1119/plan9/sys/src/cmd/venti/dat.h:502,504 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/venti/dat.h:502,506 extern int readonly; /* only allowed to read the disk data */ extern Stats stats; extern u8int zeroScore[VtScoreSize]; + + extern int chattyzero; [jmk] --rw-rw-r-- M 107020 glenda sys 2213 Nov 19 21:03 sys/src/cmd/venti/fmtarenas.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/venti/fmtarenas.c:29,34 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/venti/fmtarenas.c:29,37 tabSize = 64 * 1024; /* BUG: should be determine from number of arenas */ zero = 1; ARGBEGIN{ + case 'd': + chattyzero++; + break; case 'a': asize = unittoull(ARGF()); if(asize == TWID64) [jmk] --rw-rw-r-- M 107020 glenda sys 1326 Nov 19 21:03 sys/src/cmd/venti/fmtisect.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/venti/fmtisect.c:26,31 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/venti/fmtisect.c:26,34 setSize = 64 * 1024; zero = 1; ARGBEGIN{ + case 'd': + chattyzero++; + break; case 'b': blockSize = unittoull(ARGF()); if(blockSize == ~0) [jmk] --rw-rw-r-- M 107020 glenda sys 877 Nov 19 21:03 sys/src/cmd/venti/zeropart.c /n/sourcesdump/2005/1119/plan9/sys/src/cmd/venti/zeropart.c:2,7 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/venti/zeropart.c:2,13 #include "dat.h" #include "fns.h" + int chattyzero; + + enum + { + HugeIoSize = 2*1024*1024 + }; void zeroPart(Part *part, int blockSize) { /n/sourcesdump/2005/1119/plan9/sys/src/cmd/venti/zeropart.c:8,28 - /n/sourcesdump/2005/1120/plan9/sys/src/cmd/venti/zeropart.c:14,42 ZBlock *b; u64int addr; int w; + int iosize; + iosize = HugeIoSize; + {char *p = getenv("XXXIOSIZE"); if(p) iosize = atoi(p); assert(iosize>0);} fprint(2, "clearing the partition\n"); - b = allocZBlock(MaxIoSize, 1); + b = allocZBlock(iosize, 1); w = 0; - for(addr = PartBlank; addr + MaxIoSize <= part->size; addr += MaxIoSize){ - if(!writePart(part, addr, b->data, MaxIoSize)) + for(addr = PartBlank; addr + iosize <= part->size; addr += iosize){ + if(!writePart(part, addr, b->data, iosize)) fatal("can't initialize %s, writing block %d failed: %r", part->name, w); w++; + if(chattyzero) + print("%lld %lld\n", addr, part->size); } - for(; addr + blockSize <= part->size; addr += blockSize) + for(; addr + blockSize <= part->size; addr += blockSize){ if(!writePart(part, addr, b->data, blockSize)) fatal("can't initialize %s: %r", part->name); + if(chattyzero) + print("%lld %lld\n", addr, part->size); + } freeZBlock(b); } 64-bit fixes. [jmk] --rw-rw-r-- M 107020 glenda sys 1160 Nov 19 21:15 sys/src/libip/ptclbsum.c /n/sourcesdump/2005/1119/plan9/sys/src/libip/ptclbsum.c:17,23 - /n/sourcesdump/2005/1120/plan9/sys/src/libip/ptclbsum.c:17,23 mdsum = 0; x = 0; - if((ulong)addr & 1) { + if((uintptr)addr & 1) { if(len) { hisum += addr[0]; len--;