64-bit fixes. [rsc] --rw-rw-r-- M 451989 glenda sys 4273 Nov 6 10:04 sys/src/cmd/acid/acid.h /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/acid.h:37,43 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/acid.h:37,42 Extern int iop; Extern char symbol[Strsize]; Extern int interactive; - Extern Node* code; Extern int na; Extern int wtflag; Extern Map* cormap; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/acid.h:45,59 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/acid.h:44,55 Extern Lsym* hash[Hashsize]; Extern long dogc; Extern Rplace* ret; - Extern char* filename; Extern char* aout; Extern int gotint; - Extern long flen; Extern Gc* gcl; Extern int stacked; Extern jmp_buf err; Extern Node* prnt; - Extern Node* fomt; Extern List* tracelist; Extern int initialising; Extern int quiet; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/acid.h:182,188 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/acid.h:178,184 void catcher(void*, char*); void checkqid(int, int); void cmd(void); - Node* con(int); + Node* con(vlong); List* construct(Node*); void ctrace(int); void decl(Node*); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/acid.h:194,211 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/acid.h:190,206 void error(char*, ...); void execute(Node*); void fatal(char*, ...); - ulong findframe(ulong); void flatten(Node**, Node*); void gc(void); char* getstatus(int); void* gmalloc(long); - void indir(Map*, ulong, char, Node*); + void indir(Map*, uvlong, char, Node*); void installbuiltin(void); void kinit(void); int Lfmt(Fmt*); int listcmp(List*, List*); int listlen(List*); - List* listvar(char*, long); + List* listvar(char*, vlong); void loadmodule(char*); void loadvars(void); Lsym* look(char*); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/acid.h:224,233 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/acid.h:219,227 void pstr(String*); void pushfile(char*); void pushstr(Node*); - ulong raddr(char*); void readtext(char*); void restartio(void); - vlong rget(Map*, char*); + uvlong rget(Map*, char*); String *runenode(Rune*); int scmp(String*, String*); void sproc(int); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/acid.h:236,242 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/acid.h:230,236 String* strnode(char*); String* strnodlen(char*, int); char* system(void); - void trlist(Map*, ulong, ulong, Symbol*); + void trlist(Map*, uvlong, uvlong, Symbol*); void unwind(void); void userinit(void); void varreg(void); [rsc] --rw-rw-r-- M 451989 glenda sys 20193 Nov 6 10:04 sys/src/cmd/acid/builtin.c /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:343,349 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:343,349 { int n, i; Node res; - ulong f[10]; + uvlong f[10]; List **tail, *l; if(args == 0) /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:370,376 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:370,376 { int n; Node res; - ulong bounds[2]; + uvlong bounds[2]; List *l; if(args == 0) /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:425,438 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:425,438 c = *p; *p++ = '\0'; - r->ival = file2pc(res.string->string, atoi(p)); + r->ival = file2pc(res.string->string, strtol(p, 0, 0)); p[-1] = c; - if(r->ival == -1) + if(r->ival == ~0) error("filepc(filename:line): can't find address"); r->op = OCONST; r->type = TINT; - r->fmt = 'D'; + r->fmt = 'V'; } void /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:674,681 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:674,681 r->op = OCONST; r->type = TINT; - r->ival = strtoul(res.string->string, 0, 0); - r->fmt = 'D'; + r->ival = strtoull(res.string->string, 0, 0); + r->fmt = 'V'; } void /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:683,689 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:683,689 { Node res; Node *av[Maxarg]; - int ival; + vlong ival; char buf[128], *fmt; if(args == 0) /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:696,703 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:696,703 expr(av[0], &res); if(res.type != TINT) error("itoa(integer): arg type"); - ival = (int)res.ival; - fmt = "%d"; + ival = res.ival; + fmt = "%lld"; if(na == 2){ expr(av[1], &res); if(res.type != TSTRING) /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:705,711 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:705,711 fmt = res.string->string; } - sprint(buf, fmt, ival); + snprint(buf, sizeof(buf), fmt, ival); r->op = OCONST; r->type = TSTRING; r->string = strnode(buf); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:733,747 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:733,747 l->next = al(TINT); l = l->next; l->ival = m->seg[i].b; - l->fmt = 'X'; + l->fmt = 'W'; l->next = al(TINT); l = l->next; l->ival = m->seg[i].e; - l->fmt = 'X'; + l->fmt = 'W'; l->next = al(TINT); l = l->next; l->ival = m->seg[i].f; - l->fmt = 'X'; + l->fmt = 'W'; } return h; } /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:831,837 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:831,837 strace(Node *r, Node *args) { Node *av[Maxarg], *n, res; - ulong pc, sp; + uvlong pc, sp; na = 0; flatten(av, args); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:857,863 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:857,863 tracelist = 0; if ((*machdata->ctrace)(cormap, pc, sp, res.ival, trlist) <= 0) - error("no stack frame"); + error("no stack frame: %r"); r->type = TLIST; r->l = tracelist; } /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:896,902 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:896,902 free(rp); } - char vfmt[] = "aBbcCdDfFgGiIoOqQrRsSuUVxXYZ"; + char vfmt[] = "aBbcCdDfFgGiIoOqQrRsSuUVWxXYZ"; void fmt(Node *r, Node *args) /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:954,962 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:954,959 case 'x': Bprint(bout, "%.4lux", (ulong)res->ival&0xffff); break; - case 'W': - Bprint(bout, "%.16llux", res->ival); - break; case 'D': Bprint(bout, "%d", (int)res->ival); break; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:975,980 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:972,980 case 'V': Bprint(bout, "%lld", res->ival); break; + case 'W': + Bprint(bout, "%.8llux", res->ival); + break; case 'Y': Bprint(bout, "%.16llux", res->ival); break; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/builtin.c:1214,1218 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/builtin.c:1214,1218 p = strrchr(buf, ':'); if(p == 0) error("pcline(addr): funny file %s", buf); - r->ival = atoi(p+1); + r->ival = strtol(p+1, 0, 0); } [rsc] --rw-rw-r-- M 451989 glenda sys 5568 Nov 6 10:04 sys/src/cmd/acid/dbg.y /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/dbg.y:11,17 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/dbg.y:11,17 { Node *node; Lsym *sym; - ulong ival; + uvlong ival; float fval; String *string; } [rsc] --rw-rw-r-- M 451989 glenda sys 2162 Nov 6 10:04 sys/src/cmd/acid/dot.c /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/dot.c:28,34 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/dot.c:28,34 char *s; Type *t; Node res; - ulong addr; + uvlong addr; s = n->sym->name; if(s == 0) [rsc] --rw-rw-r-- M 451989 glenda sys 8383 Nov 6 10:04 sys/src/cmd/acid/exec.c /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/exec.c:62,68 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/exec.c:62,68 Value *v; Lsym *sl; Node *l, *r; - int i, s, e; + vlong i, s, e; Node res, xx; static int stmnt; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/exec.c:203,213 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/exec.c:203,213 } void - indir(Map *m, ulong addr, char fmt, Node *r) + indir(Map *m, uvlong addr, char fmt, Node *r) { int i; - long ival; - vlong vval; + ulong lval; + uvlong uvval; int ret; uchar cval; ushort sval; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/exec.c:241,246 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/exec.c:241,252 break; case 'a': case 'A': + r->type = TINT; + ret = geta(m, addr, &uvval); + if (ret < 0) + error("indir: %r"); + r->ival = uvval; + break; case 'B': case 'X': case 'D': /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/exec.c:248,257 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/exec.c:254,263 case 'O': case 'Q': r->type = TINT; - ret = get4(m, addr, &ival); + ret = get4(m, addr, &lval); if (ret < 0) error("indir: %r"); - r->ival = ival; + r->ival = lval; break; case 'V': case 'W': /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/exec.c:258,267 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/exec.c:264,273 case 'Y': case 'Z': r->type = TINT; - ret = get8(m, addr, &vval); + ret = get8(m, addr, &uvval); if (ret < 0) error("indir: %r"); - r->ival = vval; + r->ival = uvval; break; case 's': r->type = TSTRING; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/exec.c:354,359 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/exec.c:360,366 { uchar cval; ushort sval; + long lval; Node res, aes; int ret; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/exec.c:393,404 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/exec.c:400,414 break; case 'a': case 'A': + ret = puta(m, aes.ival, res.ival); + break; case 'B': case 'X': case 'D': case 'U': case 'O': - ret = put4(m, aes.ival, res.ival); + lval = res.ival; + ret = put4(m, aes.ival, lval); break; case 'V': case 'W': [rsc] --rw-rw-r-- M 451989 glenda sys 15220 Nov 6 10:04 sys/src/cmd/acid/expr.c /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/expr.c:135,141 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/expr.c:135,141 { char *p; Node *lp; - long ival; + uvlong ival; Frtype *f; p = n->sym->name; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/expr.c:553,559 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/expr.c:553,559 res->type = TINT; if(l.type != TINT || r.type != TINT) error("bad expr type >>"); - res->ival = (unsigned)l.ival>>r.ival; + res->ival = (uvlong)l.ival>>r.ival; } void [rsc] --rw-rw-r-- M 451989 glenda sys 7963 Nov 6 10:04 sys/src/cmd/acid/lex.c /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/lex.c:168,182 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/lex.c:168,182 e = lexio; if(e) { - i = sprint(buf, "%s:%d", e->name, line); + i = snprint(buf, sizeof(buf), "%s:%d", e->name, line); while(e->prev) { e = e->prev; if(initialising && e->prev == 0) break; - i += sprint(buf+i, " [%s:%d]", e->name, e->line); + i += snprint(buf+i, sizeof(buf)-i, " [%s:%d]", e->name, e->line); } } else - sprint(buf, "no file:0"); + snprint(buf, sizeof(buf), "no file:0"); fmtstrcpy(f, buf); return 0; } /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/lex.c:228,233 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/lex.c:228,235 unlexc(c); break; } + if(n >= Strsize) + error("string escape too long"); buf[n++] = c; } buf[n] = '\0'; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/lex.c:517,525 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/lex.c:519,527 } if(isbin) - yylval.ival = strtoul(symbol+2, 0, 2); + yylval.ival = strtoull(symbol+2, 0, 2); else - yylval.ival = strtoul(symbol, 0, 0); + yylval.ival = strtoull(symbol, 0, 0); return Tconst; } /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/lex.c:550,556 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/lex.c:552,558 enter(char *name, int t) { Lsym *s; - ulong h; + uint h; char *p; Value *v; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/lex.c:581,587 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/lex.c:583,589 look(char *name) { Lsym *s; - ulong h; + uint h; char *p; h = 0; [rsc] --rw-rw-r-- M 451989 glenda sys 3680 Nov 6 10:04 sys/src/cmd/acid/list.c /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/list.c:173,179 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/list.c:173,179 } List* - listvar(char *s, long v) + listvar(char *s, vlong v) { List *l, *tl; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/list.c:192,201 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/list.c:192,201 } static List* - listlocals(Map *map, Symbol *fn, ulong fp) + listlocals(Map *map, Symbol *fn, uvlong fp) { int i; - long val; + uvlong val; Symbol s; List **tail, *l2; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/list.c:209,215 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/list.c:209,215 if(s.name[0] == '.') continue; - if(get4(map, fp-s.value, &val) > 0) { + if(geta(map, fp-s.value, &val) > 0) { *tail = listvar(s.name, val); tail = &(*tail)->next; } /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/list.c:218,228 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/list.c:218,228 } static List* - listparams(Map *map, Symbol *fn, ulong fp) + listparams(Map *map, Symbol *fn, uvlong fp) { int i; Symbol s; - long v; + uvlong v; List **tail, *l2; l2 = 0; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/list.c:233,239 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/list.c:233,239 if (s.class != CPARAM) continue; - if(get4(map, fp+s.value, &v) > 0) { + if(geta(map, fp+s.value, &v) > 0) { *tail = listvar(s.name, v); tail = &(*tail)->next; } /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/list.c:242,248 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/list.c:242,248 } void - trlist(Map *map, ulong pc, ulong sp, Symbol *sym) + trlist(Map *map, uvlong pc, uvlong sp, Symbol *sym) { List *q, *l; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/list.c:265,271 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/list.c:265,271 l->next = al(TINT); /* called from address */ l = l->next; l->ival = pc; - l->fmt = 'X'; + l->fmt = 'Y'; l->next = al(TLIST); /* make list of params */ l = l->next; [rsc] --rw-rw-r-- M 451989 glenda sys 8565 Nov 6 10:04 sys/src/cmd/acid/main.c /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:31,37 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:31,37 { Lsym *l; Node *n; - char buf[128], *s; + char *s; int pid, i; argv0 = argv[0]; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:73,80 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:73,80 aout = argv[0]; else if(isnumeric(argv[0])) { - pid = atoi(argv[0]); - sprint(prog, "/proc/%d/text", pid); + pid = strtol(argv[0], 0, 0); + snprint(prog, sizeof(prog), "/proc/%d/text", pid); aout = prog; if(argc > 1) aout = argv[1]; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:90,96 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:90,96 } } else if(remote) - aout = "/mips/bcarrera"; + aout = "/mips/9ch"; fmtinstall('x', xfmt); fmtinstall('L', Lfmt); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:114,121 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:114,122 if(access(lm[i], AREAD) >= 0) loadmodule(lm[i]); else { - sprint(buf, "/sys/lib/acid/%s", lm[i]); - loadmodule(buf); + s = smprint("/sys/lib/acid/%s", lm[i]); + loadmodule(s); + free(s); } } /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:198,212 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:199,215 { Lsym *l; Node *n; - char buf[128], *p; + char *buf, *p; - sprint(buf, "/sys/lib/acid/%s", mach->name); + buf = smprint("/sys/lib/acid/%s", mach->name); loadmodule(buf); + free(buf); p = getenv("home"); if(p != 0) { - sprint(buf, "%s/lib/acid", p); + buf = smprint("%s/lib/acid", p); silent = 1; loadmodule(buf); + free(buf); } interactive = 0; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:244,250 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:247,253 Dir *d; Lsym *l; Value *v; - ulong length; + uvlong length; Symbol sym; extern Machdata mipsmach; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:335,347 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:338,350 } Node* - con(int v) + con(vlong v) { Node *n; n = an(OCONST, ZN, ZN); n->ival = v; - n->fmt = 'X'; + n->fmt = 'W'; n->type = TINT; return n; } /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:501,507 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:504,510 return; } - sprint(buf, "/proc/%d/text", pid); + snprint(buf, sizeof(buf), "/proc/%d/text", pid); fd = open(buf, OREAD); if(fd < 0 || (d2 = dirfstat(fd)) == nil){ print("checkqid: (qid not checked) dirstat %s: %r\n", buf); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:538,544 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:541,547 system(void) { char *cpu, *p, *q; - static char kernel[128]; + static char *kernel; cpu = getenv("cputype"); if(cpu == 0) { /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:547,553 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:550,556 } p = getenv("terminal"); if(p == 0 || (p=strchr(p, ' ')) == 0 || p[1] == ' ' || p[1] == 0) { - p = "9power"; + p = "ch"; print("missing or bad $terminal; assuming %s\n", p); } else{ /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/main.c:555,562 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/main.c:558,569 q = strchr(p, ' '); if(q) *q = 0; - sprint(kernel, "/%s/9%s", cpu, p); } + + if(kernel != nil) + free(kernel); + kernel = smprint("/%s/9%s", cpu, p); + return kernel; } [rsc] --rw-rw-r-- M 451989 glenda sys 6831 Nov 6 10:04 sys/src/cmd/acid/print.c /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/print.c:109,116 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/print.c:109,115 if(t == TINT || t == TFLOAT) Bprint(bout, " format %c", l->v->fmt); if(l->v->comt) - Bprint(bout, " complex %s", - l->v->comt->base->name); + Bprint(bout, " complex %s", l->v->comt->base->name); Bputc(bout, '\n'); def = 1; } /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/print.c:252,258 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/print.c:251,257 case OCONST: switch(n->type) { case TINT: - Bprint(bout, "%d", (int)n->ival); + Bprint(bout, "%lld", n->ival); break; case TFLOAT: Bprint(bout, "%g", n->fval); [rsc] --rw-rw-r-- M 451989 glenda sys 4356 Nov 6 10:04 sys/src/cmd/acid/proc.c /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/proc.c:29,41 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/proc.c:29,40 { Lsym *s; char buf[64]; - ulong proctab; - int fd, i, fcor; + int i, fcor; if(symmap == 0) error("no map"); - sprint(buf, "/proc/%d/mem", pid); + snprint(buf, sizeof(buf), "/proc/%d/mem", pid); fcor = open(buf, ORDWR); if(fcor < 0) error("setproc: open %s: %r", buf); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/proc.c:42,64 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/proc.c:41,46 checkqid(symmap->seg[0].fd, pid); - if(kernel) { - proctab = 0; - sprint(buf, "/proc/%d/proc", pid); - fd = open(buf, OREAD); - if(fd >= 0) { - i = read(fd, buf, sizeof(buf)); - if(i >= 0) { - buf[i] = '\0'; - proctab = strtoul(buf, 0, 0); - } - close(fd); - } - s = look("proc"); - if(s != 0) - s->v->ival = proctab; - } - s = look("pid"); s->v->ival = pid; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/proc.c:88,94 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/proc.c:70,76 case 0: rfork(RFNAMEG|RFNOTEG); - sprint(buf, "/proc/%d/ctl", getpid()); + snprint(buf, sizeof(buf), "/proc/%d/ctl", getpid()); fd = open(buf, ORDWR); if(fd < 0) fatal("new: open %s: %r", buf); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/proc.c:132,138 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/proc.c:114,120 return; v = s->v; - sprint(buf, "/proc/%d/note", pid); + snprint(buf, sizeof(buf), "/proc/%d/note", pid); fd = open(buf, OREAD); if(fd < 0) error("pid=%d: open note: %r", pid); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/proc.c:193,199 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/proc.c:175,181 if(new == -1) error("no free process slots"); - sprint(buf, "/proc/%d/ctl", pid); + snprint(buf, sizeof(buf), "/proc/%d/ctl", pid); fd = open(buf, OWRITE); if(fd < 0) error("pid=%d: open ctl: %r", pid); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/proc.c:265,271 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/proc.c:247,253 char *argv[16], buf[64]; static char status[128]; - sprint(buf, "/proc/%d/status", pid); + snprint(buf, sizeof(buf), "/proc/%d/status", pid); fd = open(buf, OREAD); if(fd < 0) error("open %s: %r", buf); [rsc] --rw-rw-r-- M 451989 glenda sys 4609 Nov 6 10:04 sys/src/cmd/acid/util.c /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/util.c:36,42 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/util.c:36,42 } } if(renamed && !quiet) - print("\t%s=%s %c/%lux\n", s->name, buf, s->type, s->value); + print("\t%s=%s %c/%llux\n", s->name, buf, s->type, s->value); if(l == 0) l = enter(buf, Tid); return l; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/util.c:49,55 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/util.c:49,55 Sym *s; long n; Lsym *l; - ulong v; + uvlong v; char buf[1024]; List *list, **tail, *l2, *tl; /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/util.c:178,189 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/util.c:178,189 l->v->type = TLIST; } - vlong + uvlong rget(Map *map, char *reg) { Lsym *s; - long x; - vlong v; + ulong x; + uvlong v; int ret; s = look(reg); /n/sourcesdump/2005/1106/plan9/sys/src/cmd/acid/util.c:191,199 - /n/sourcesdump/2005/1107/plan9/sys/src/cmd/acid/util.c:191,199 fatal("rget: %s\n", reg); if(s->v->fmt == 'W') - ret = get8(map, (long)s->v->ival, &v); + ret = get8(map, s->v->ival, &v); else { - ret = get4(map, (long)s->v->ival, &x); + ret = get4(map, s->v->ival, &x); v = x; } if(ret < 0)