Make shrinking segments work.
[jmk] --rw-rw-r-- M 84741 glenda sys 13762 Dec 10 23:48 sys/src/9/port/segment.c
Various impossible tests.
[rsc] --rw-rw-r-- M 84741 glenda sys 25819 Dec 11 07:50 sys/src/cmd/5l/obj.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/5l/obj.c:819,825 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/5l/obj.c:819,825
bloc += r;
c -= r;
- if(p->reg < 0 || p->reg > NREG)
+ if(p->reg > NREG)
diag("register out of range %d", p->reg);
p->link = P;
[rsc] --rw-rw-r-- M 84741 glenda sys 9664 Dec 11 07:50 sys/src/cmd/9660srv/main.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/9660srv/main.c:181,187 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/9660srv/main.c:181,187
errno = 0;
if(!waserror()){
err_msg[0] = 0;
- if(req->type < 0 || req->type > nelem(fcalls) || !fcalls[req->type])
+ if(req->type >= nelem(fcalls) || !fcalls[req->type])
error("bad fcall type");
(*fcalls[req->type])();
poperror();
[rsc] --rw-rw-r-- M 84741 glenda sys 20200 Dec 11 07:50 sys/src/cmd/aux/consolefs.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/aux/consolefs.c:986,992 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/aux/consolefs.c:986,992
return;
}
- if(r->f.count < 0){
+ if((int)r->f.count < 0){
fsreply(fs, r, Ebadcount);
return;
}
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/aux/consolefs.c:1045,1051 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/aux/consolefs.c:1045,1051
return;
}
- if(r->f.count < 0){
+ if((int)r->f.count < 0){
fsreply(fs, r, Ebadcount);
return;
}
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/aux/consolefs.c:1112,1118 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/aux/consolefs.c:1112,1118
void
fsstat(Fs *fs, Request *r, Fid *f)
{
- int i;
+ int i, n;
Qid q;
Dir d;
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/aux/consolefs.c:1119,1129 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/aux/consolefs.c:1119,1130
q = parentqid(f->qid);
for(i = 0; ; i++){
r->f.stat = r->buf+IOHDRSZ;
- r->f.nstat = fsdirgen(fs, q, i, &d, r->f.stat, messagesize-IOHDRSZ);
- if(r->f.nstat < 0){
+ n = fsdirgen(fs, q, i, &d, r->f.stat, messagesize-IOHDRSZ);
+ if(n < 0){
fsreply(fs, r, Eexist);
return;
}
+ r->f.nstat = n;
if(r->f.nstat > BIT16SZ && d.qid.path == f->qid.path)
break;
}
[rsc] --rw-rw-r-- M 84741 glenda sys 25880 Dec 11 07:50 sys/src/cmd/aux/depend.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/aux/depend.c:828,834 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/aux/depend.c:828,834
fsreply(fs, r, Enofid);
return;
}
- if(r->f.count < 0){
+ if((int)r->f.count < 0){
fsreply(fs, r, "bad read count");
return;
}
[rsc] --rw-rw-r-- M 84741 glenda sys 16526 Dec 11 07:50 sys/src/cmd/cfs/cfs.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cfs/cfs.c:373,379 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cfs/cfs.c:373,379
return;
}
if(c.thdr.newfid != c.thdr.fid){
- if(c.thdr.newfid<0 || Nfid<=c.thdr.newfid)
+ if(c.thdr.newfid >= Nfid)
error("clone nfid out of range");
nmf = &mfile[c.thdr.newfid];
if(nmf->busy)
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cfs/cfs.c:477,483 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cfs/cfs.c:477,483
c.rhdr.count = statlen-off;
else
c.rhdr.count = cnt;
- if(c.rhdr.count < 0){
+ if((int)c.rhdr.count < 0){
sendreply("eof");
return;
}
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cfs/cfs.c:787,793 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cfs/cfs.c:787,793
if((rlen = convM2S(datarcv, p->len, f)) != p->len)
error("rcvmsg format error, expected length %d, got %d", rlen, p->len);
- if(f->fid<0 || Nfid<=f->fid){
+ if(f->fid >= Nfid){
fprint(2, "<-%s: %d %s on %d\n", p->name, f->type,
mname[f->type]? mname[f->type] : "mystery",
f->fid);
[rsc] --rw-rw-r-- M 84741 glenda sys 6878 Dec 11 07:50 sys/src/cmd/db/format.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/db/format.c:273,288 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/db/format.c:273,290
case 'I':
case 'i':
- dotinc = machdata->das(map, dot, modifier, buf, sizeof(buf));
- if (dotinc < 0)
+ i = machdata->das(map, dot, modifier, buf, sizeof(buf));
+ if (i < 0)
error("%r");
+ dotinc = i;
dprint("%s\n", buf);
break;
case 'M':
- dotinc = machdata->hexinst(map, dot, buf, sizeof(buf));
- if (dotinc < 0)
+ i = machdata->hexinst(map, dot, buf, sizeof(buf));
+ if (i < 0)
error("%r");
+ dotinc = i;
dprint("%s", buf);
if (*fp) {
dotinc = 0;
[rsc] --rw-rw-r-- M 84741 glenda sys 17649 Dec 11 07:50 sys/src/cmd/disk/format.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/disk/format.c:630,636 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/disk/format.c:630,636
fatal("open %s: %r", *argv);
if((d = dirfstat(sysfd)) == nil)
fatal("stat %s: %r", *argv);
- if(d->length > 0xFFFFFFFF)
+ if(d->length > 0xFFFFFFFFU)
fatal("file %s too big\n", *argv, d->length);
if(commit)
print("Adding file %s, length %lld\n", *argv, d->length);
[rsc] --rw-rw-r-- M 84741 glenda sys 11914 Dec 11 10:48 sys/src/cmd/exportfs/exportsrv.c
[rsc] --rw-rw-r-- M 84741 glenda sys 9616 Dec 11 07:50 sys/src/cmd/iostats/iostats.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/iostats/iostats.c:174,182 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/iostats/iostats.c:174,179
stats->nrpc++;
stats->nproto += n;
- if(r->work.fid < 0)
- fatal("fid out of range");
-
DEBUG(2, "%F\n", &r->work);
type = r->work.type;
[rsc] --rw-rw-r-- M 84741 glenda sys 33088 Dec 11 07:50 sys/src/cmd/ip/ftpd.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/ip/ftpd.c:248,254 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/ip/ftpd.c:248,254
/*
* get rid of telnet control sequences (we don't need them)
*/
- while(*cmd && *cmd == Iac){
+ while(*cmd && (uchar)*cmd == Iac){
cmd++;
if(*cmd)
cmd++;
[rsc] --rw-rw-r-- M 84741 glenda sys 33083 Dec 11 07:50 sys/src/cmd/ndb/cs.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/ndb/cs.c:432,439 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/ndb/cs.c:432,437
freejob(job);
continue;
}
- if(job->request.fid<0)
- error("fid out of range");
lock(&dblock);
mf = newfid(job->request.fid);
if(debug)
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/ndb/cs.c:563,572 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/ndb/cs.c:561,566
if(job->request.newfid != job->request.fid){
/* clone fid */
- if(job->request.newfid<0){
- err = "clone newfid out of range";
- goto send;
- }
nmf = newfid(job->request.newfid);
if(nmf->busy){
nmf = nil;
[rsc] --rw-rw-r-- M 84741 rsc sys 41974 Dec 11 07:50 sys/src/cmd/vnc/devdraw.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/vnc/devdraw.c:2081,2090 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/vnc/devdraw.c:2081,2086
if(active){
drawblankscreen(0);
sdraw.blanktime = 0;
- }else{
- if(blanktime && TK2SEC(sdraw.blanktime)/60 >= blanktime)
- drawblankscreen(1);
- else
- sdraw.blanktime++;
- }
+ }else
+ sdraw.blanktime++;
}
[rsc] --rw-rw-r-- M 84741 glenda sys 25287 Dec 11 19:08 sys/src/cmd/ql/obj.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/ql/obj.c:434,440 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/ql/obj.c:434,440
a->name = p[3];
c = 4;
- if(a->reg < 0 || a->reg > NREG) {
+ if(a->reg > NREG) {
print("register out of range %d\n", a->reg);
p[0] = AEND+1;
return 0; /* force real diagnostic */
[rsc] --rw-rw-r-- M 84741 glenda sys 11453 Dec 11 07:50 sys/src/cmd/srvold9p/9p1lib.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/srvold9p/9p1lib.c:149,155 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/srvold9p/9p1lib.c:149,155
if(count > DUMPL)
count = DUMPL;
for(i=0; i<count && printable; i++)
- if((buf[i]<32 && buf[i] !='\n' && buf[i] !='\t') || buf[i]>127)
+ if((buf[i]<32 && buf[i] !='\n' && buf[i] !='\t') || (uchar)buf[i]>127)
printable = 0;
p = ans;
*p++ = '\'';
[rsc] --rw-rw-r-- M 84741 glenda sys 13635 Dec 11 07:50 sys/src/cmd/vac/vacfs.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/vac/vacfs.c:519,529 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/vac/vacfs.c:519,530
cnt = rhdr.count;
if(f->qid.type & QTDIR)
return "file is a directory";
- thdr.count = vfWrite(vf, buf, cnt, off, "none");
- if(thdr.count < 0) {
+ cnt = vfWrite(vf, buf, cnt, off, "none");
+ if(cnt < 0) {
fprint(2, "write failed: %s\n", vtGetError());
return vtGetError();
}
+ thdr.count = cnt;
return 0;
}
[rsc] --rw-rw-r-- M 84741 glenda sys 21135 Dec 11 07:50 sys/src/cmd/cpu.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cpu.c:921,927 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cpu.c:921,927
fprint(2, "read9pmsg(%d) returns %d: %r\n", fd, n);
break;
}
- if(convM2S(buf, n, &f) < 0)
+ if(convM2S(buf, n, &f) <= BIT16SZ)
break;
if(dbg)
fprint(2, "->%F\n", &f);
[rsc] --rw-rw-r-- M 84741 rsc sys 38683 Dec 11 07:50 sys/src/cmd/ext2srv/ext2subs.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/ext2srv/ext2subs.c:1449,1455 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/ext2srv/ext2subs.c:1449,1455
es = getext2(xf, EXT2_SUPER, 0);
/* get dir inode */
- if( file->pinbr < 0 || file->pinbr > es.u.sb->s_inodes_count ){
+ if( file->pinbr >= es.u.sb->s_inodes_count ){
chat("inode number %d is too big...", file->pinbr);
putext2(es);
errno = Eintern;
[rsc] --rw-rw-r-- M 84741 rsc sys 33320 Dec 11 07:50 sys/src/cmd/fossil/9fsys.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/fossil/9fsys.c:1222,1228 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/fossil/9fsys.c:1222,1228
}
if(strcmp(argv[5], "-") != 0){
de.size = strtoull(argv[5], &p, 0);
- if(argv[5][0] == '\0' || *p != '\0' || de.size < 0){
+ if(argv[5][0] == '\0' || *p != '\0' || (vlong)de.size < 0){
vtSetError("console wstat - bad length");
goto error;
}
[rsc] --rw-rw-r-- M 84741 glenda sys 29820 Dec 11 07:50 sys/src/cmd/scat/scat.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/scat/scat.c:1288,1294 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/scat/scat.c:1288,1294
if(t == s)
goto BadCoords;
/* degree sign etc. is optional */
- if(*t == L'°')
+ if((uchar)*t == L'°')
deg = DEG(getra(s));
if(doreset)
reset();
[rsc] --rw-rw-r-- M 84741 glenda sys 38986 Dec 11 07:50 sys/src/cmd/tweak.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/tweak.c:1165,1171 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/tweak.c:1165,1171
cntledit(char *tag)
{
char buf[256];
- ulong l;
+ long l;
buttons(Up);
if(type(buf, tag) == 0)
[rsc] --rw-rw-r-- M 84741 glenda sys 17110 Dec 11 16:07 sys/src/lib9p/srv.c
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/srv.c:5,10 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/srv.c:5,12
#include <thread.h>
#include <9p.h>
+ void (*_forker)(void(*)(void*), void*, int);
+
static char Ebadattach[] = "unknown specifier in attach";
static char Ebadoffset[] = "bad offset";
static char Ebadcount[] = "bad count";
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/srv.c:463,469 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/srv.c:465,471
respond(r, Eunknownfid);
return;
}
- if(r->ifcall.count < 0){
+ if((int)r->ifcall.count < 0){
respond(r, Ebotch);
return;
}
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/srv.c:509,515 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/srv.c:511,517
respond(r, Eunknownfid);
return;
}
- if(r->ifcall.count < 0){
+ if((int)r->ifcall.count < 0){
respond(r, Ebotch);
return;
}
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/srv.c:592,597 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/srv.c:594,600
return;
}
if(r->fid->file){
+ /* should we rlock the file? */
r->d = r->fid->file->Dir;
if(r->d.name)
r->d.name = estrdup9p(r->d.name);
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/srv.c:630,636 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/srv.c:633,639
}
r->ofcall.nstat = convD2M(&r->d, statbuf, n);
r->ofcall.stat = statbuf; /* freed in closereq */
- if(r->ofcall.nstat < 0){
+ if(r->ofcall.nstat <= BIT16SZ){
r->error = "convD2M fails";
free(statbuf);
return;
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/srv.c:813,818 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/srv.c:816,830
closereq(r);
else
free(r);
+ }
+
+ void
+ responderror(Req *r)
+ {
+ char errbuf[ERRMAX];
+
+ rerrstr(errbuf, sizeof errbuf);
+ respond(r, errbuf);
}
int
[rsc] --rw-rw-r-- M 84741 glenda sys 5747 Dec 11 07:50 sys/src/libc/9sys/fcallfmt.c
/n/sourcesdump/2005/1211/plan9/sys/src/libc/9sys/fcallfmt.c:209,215 -
/n/sourcesdump/2005/1212/plan9/sys/src/libc/9sys/fcallfmt.c:209,215
if(count > DUMPL)
count = DUMPL;
for(i=0; i<count && printable; i++)
- if((buf[i]<32 && buf[i] !='\n' && buf[i] !='\t') || buf[i]>127)
+ if((buf[i]<32 && buf[i] !='\n' && buf[i] !='\t') || (uchar)buf[i]>127)
printable = 0;
p = ans;
*p++ = '\'';
[rsc] --rw-rw-r-- M 84741 glenda sys 11914 Dec 11 10:48 sys/src/cmd/exportfs/exportsrv.c
[rsc] --rw-rw-r-- M 84741 glenda sys 11914 Dec 11 10:48 sys/src/cmd/exportfs/exportsrv.c
[rsc] --rw-rw-r-- M 84741 glenda sys 17110 Dec 11 16:07 sys/src/lib9p/srv.c
[rsc] --rw-rw-r-- M 84741 rsc sys 1626 Dec 11 16:07 sys/src/lib9p/listen.c
[rsc] --rw-rw-r-- M 84741 glenda sys 387 Dec 11 16:45 sys/src/lib9p/mkfile
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/mkfile:2,22 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/mkfile:2,24
LIB=/$objtype/lib/lib9p.a
OFILES=\
- _post.$O\
+ auth.$O\
dirread.$O\
fid.$O\
file.$O\
intmap.$O\
+ listen.$O\
mem.$O\
req.$O\
parse.$O\
post.$O\
+ rfork.$O\
srv.$O\
- tpost.$O\
+ thread.$O\
uid.$O\
util.$O\
- HFILES=/sys/include/9p.h post.h
+ HFILES=/sys/include/9p.h
UPDATE=\
mkfile\
[rsc] --rw-rw-r-- M 84741 glenda sys 1559 Dec 11 19:07 sys/src/lib9p/post.c
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/post.c:3,24 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/post.c:3,71
#include <fcall.h>
#include <thread.h>
#include <9p.h>
- #include "post.h"
+ #include <auth.h>
+ static void postproc(void*);
+
void
- postmountsrv(Srv *s, char *name, char *mtpt, int flag)
+ _postmountsrv(Srv *s, char *name, char *mtpt, int flag)
{
- Postcrud *p;
+ int fd[2];
- p = _post1(s, name, mtpt, flag);
- switch(rfork(RFPROC|RFNAMEG|RFMEM)){
- case -1:
- sysfatal("rfork: %r");
- case 0:
- _post2(s);
- exits(nil);
- default:
- _post3(p);
+ if(!s->nopipe){
+ if(pipe(fd) < 0)
+ sysfatal("pipe: %r");
+ s->infd = s->outfd = fd[1];
+ s->srvfd = fd[0];
}
+ if(name)
+ if(postfd(name, s->srvfd) < 0)
+ sysfatal("postfd %s: %r", name);
+
+ if(_forker == nil)
+ sysfatal("no forker");
+ _forker(postproc, s, RFNAMEG);
+
+ /*
+ * Normally the server is posting as the last thing it does
+ * before exiting, so the correct thing to do is drop into
+ * a different fd space and close the 9P server half of the
+ * pipe before trying to mount the kernel half. This way,
+ * if the file server dies, we don't have a ref to the 9P server
+ * half of the pipe. Then killing the other procs will drop
+ * all the refs on the 9P server half, and the mount will fail.
+ * Otherwise the mount hangs forever.
+ *
+ * Libthread in general and acme win in particular make
+ * it hard to make this fd bookkeeping work out properly,
+ * so leaveinfdopen is a flag that win sets to opt out of this
+ * safety net.
+ */
+ if(!s->leavefdsopen){
+ rfork(RFFDG);
+ rendezvous(0, 0);
+ close(s->infd);
+ if(s->infd != s->outfd)
+ close(s->outfd);
+ }
+
+ if(mtpt){
+ if(amount(s->srvfd, mtpt, flag, "") == -1)
+ sysfatal("mount %s: %r", mtpt);
+ }else
+ close(s->srvfd);
}
+ static void
+ postproc(void *v)
+ {
+ Srv *s;
+
+ s = v;
+ if(!s->leavefdsopen){
+ rfork(RFNOTEG);
+ rendezvous(0, 0);
+ close(s->srvfd);
+ }
+ srv(s);
+ }
[rsc] --rw-rw-r-- M 84741 rsc sys 2657 Dec 11 16:07 sys/src/lib9p/ramfs.c
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/ramfs.c:129,134 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/ramfs.c:129,135
void
main(int argc, char **argv)
{
+ char *addr = nil;
char *srvname = nil;
char *mtpt = nil;
Qid q;
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/ramfs.c:140,145 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/ramfs.c:141,149
case 'D':
chatty9p++;
break;
+ case 'a':
+ addr = EARGF(usage());
+ break;
case 's':
srvname = EARGF(usage());
break;
/n/sourcesdump/2005/1211/plan9/sys/src/lib9p/ramfs.c:155,163 -
/n/sourcesdump/2005/1212/plan9/sys/src/lib9p/ramfs.c:159,170
if(chatty9p)
fprint(2, "ramsrv.nopipe %d srvname %s mtpt %s\n", fs.nopipe, srvname, mtpt);
- if(srvname == nil && mtpt == nil)
- sysfatal("you should at least specify a -s or -m option");
+ if(addr == nil && srvname == nil && mtpt == nil)
+ sysfatal("must specify -a, -s, or -m option");
+ if(addr)
+ listensrv(&fs, addr);
- postmountsrv(&fs, srvname, mtpt, MREPL|MCREATE);
+ if(srvname || mtpt)
+ postmountsrv(&fs, srvname, mtpt, MREPL|MCREATE);
exits(0);
}
[rsc] --rw-rw-r-- M 84741 rsc sys 493 Dec 11 16:07 sys/src/lib9p/rfork.c
[rsc] --rw-rw-r-- M 84741 glenda sys 17110 Dec 11 16:07 sys/src/lib9p/srv.c
[rsc] --rw-rw-r-- M 84741 rsc sys 407 Dec 11 16:07 sys/src/lib9p/thread.c
[rsc] --rw-rw-r-- M 84741 rsc sys 3392 Dec 11 16:45 sys/src/lib9p/auth.c
[rsc] --rw-rw-r-- M 84741 glenda sys 387 Dec 11 16:45 sys/src/lib9p/mkfile
[rsc] --rw-rw-r-- M 84741 glenda sys 25287 Dec 11 19:08 sys/src/cmd/ql/obj.c
[rsc] --rw-rw-r-- M 84741 glenda sys 1559 Dec 11 19:07 sys/src/lib9p/post.c
@1134306103.0
[rsc] --rw-rw-r-- M 84741 glenda sys 15248 Dec 11 07:50 sys/src/cmd/ndb/dns.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/ndb/dns.c:514,523 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/ndb/dns.c:514,519
if(job->request.newfid != job->request.fid){
/* clone fid */
- if(job->request.newfid<0){
- err = "clone newfid out of range";
- goto send;
- }
nmf = copyfid(mf, job->request.newfid);
if(nmf == nil){
err = "clone bad newfid";
@1134306103.0
[rsc] --rw-rw-r-- M 84741 glenda sys 5949 Dec 11 07:50 sys/src/cmd/cfs/disk.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cfs/disk.c:153,159 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cfs/disk.c:153,159
* allocate allocation blocks
*/
for(i = 0; i < d->nab; i++)
- if(dalloc(d, &dptr) < 0){
+ if(dalloc(d, &dptr) == Notabno){
fprint(2, "can't allocate allocation blocks\n");
return -1;
}
@1134306103.0
[rsc] --rw-rw-r-- M 84741 glenda sys 2928 Dec 11 07:50 sys/src/cmd/db/runpcs.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/db/runpcs.c:28,34 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/db/runpcs.c:28,34
rput(cormap, mach->pc, dot);
dot = rget(cormap, mach->pc);
flush();
- while (--loopcnt >= 0) {
+ while (loopcnt-- > 0) {
if(loopcnt != 0)
printpc();
if (runmode == SINGLE) {
@1134306103.0
[rsc] --rw-rw-r-- M 84741 glenda sys 4681 Dec 11 07:50 sys/src/cmd/disk/kfs/ofcallfmt.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/disk/kfs/ofcallfmt.c:161,167 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/disk/kfs/ofcallfmt.c:161,167
if(count > DUMPL)
count = DUMPL;
for(i=0; i<count && printable; i++)
- if((buf[i]<32 && buf[i] !='\n' && buf[i] !='\t') || buf[i]>127)
+ if((buf[i]<32 && buf[i] !='\n' && buf[i] !='\t') || (uchar)buf[i]>127)
printable = 0;
p = ans;
*p++ = '\'';
Some useful warnings.
[rsc] --rw-rw-r-- M 84741 glenda sys 12122 Dec 11 12:22 sys/src/cmd/cc/cc.h
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.h:57,62 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.h:57,64
Type* type;
long lineno;
char op;
+ char oldop;
+ char xcast;
char class;
char etype;
char complex;
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.h:497,502 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.h:499,505
extern char typeilp[];
extern char typechl[];
extern char typechlv[];
+ extern char typechlvp[];
extern char typechlp[];
extern char typechlpfd[];
[rsc] --rw-rw-r-- M 84741 glenda sys 16058 Dec 11 12:21 sys/src/cmd/cc/cc.y
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.y:656,661 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.y:656,662
$$ = new(OCAST, $5, Z);
dodecl(NODECL, CXXX, $2, $3);
$$->type = lastdcl;
+ $$->xcast = 1;
}
| '(' tlist abdecor ')' '{' ilist '}' /* extension */
{
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.y:760,765 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.y:761,767
$$ = new(OCONST, Z, Z);
$$->type = types[TINT];
$$->vconst = $1;
+ $$->cstring = strdup(symb);
}
| LLCONST
{
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.y:766,771 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.y:768,774
$$ = new(OCONST, Z, Z);
$$->type = types[TLONG];
$$->vconst = $1;
+ $$->cstring = strdup(symb);
}
| LUCONST
{
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.y:772,777 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.y:775,781
$$ = new(OCONST, Z, Z);
$$->type = types[TUINT];
$$->vconst = $1;
+ $$->cstring = strdup(symb);
}
| LULCONST
{
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.y:778,783 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.y:782,788
$$ = new(OCONST, Z, Z);
$$->type = types[TULONG];
$$->vconst = $1;
+ $$->cstring = strdup(symb);
}
| LDCONST
{
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.y:784,789 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.y:789,795
$$ = new(OCONST, Z, Z);
$$->type = types[TDOUBLE];
$$->fconst = $1;
+ $$->cstring = strdup(symb);
}
| LFCONST
{
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.y:790,795 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.y:796,802
$$ = new(OCONST, Z, Z);
$$->type = types[TFLOAT];
$$->fconst = $1;
+ $$->cstring = strdup(symb);
}
| LVLCONST
{
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.y:796,801 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.y:803,809
$$ = new(OCONST, Z, Z);
$$->type = types[TVLONG];
$$->vconst = $1;
+ $$->cstring = strdup(symb);
}
| LUVLCONST
{
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/cc.y:802,807 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/cc.y:810,816
$$ = new(OCONST, Z, Z);
$$->type = types[TUVLONG];
$$->vconst = $1;
+ $$->cstring = strdup(symb);
}
| string
| lstring
[rsc] --rw-rw-r-- M 84741 glenda sys 22202 Dec 11 12:22 sys/src/cmd/cc/com.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/com.c:1,5 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/com.c:1,7
#include "cc.h"
+ int compar(Node*, int);
+
void
complex(Node *n)
{
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/com.c:985,990 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/com.c:987,994
case OHI:
ccom(l);
ccom(r);
+ if(compar(n, 0) || compar(n, 1))
+ break;
relcon(l, r);
relcon(r, l);
goto common;
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/com.c:1082,1088 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/com.c:1086,1092
*n = *l;
break;
}
- goto commun;
+ goto commute;
case OAND:
ccom(l);
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/com.c:1096,1102 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/com.c:1100,1106
break;
}
- commun:
+ commute:
/* look for commutative constant */
if(r->op == OCONST) {
if(l->op == n->op) {
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/com.c:1162,1164 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/com.c:1166,1346
evconst(n);
}
}
+
+ /* OEQ, ONE, OLE, OLS, OLT, OLO, OGE, OHS, OGT, OHI */
+ static char *cmps[12] =
+ {
+ "==", "!=", "<=", "<=", "<", "<", ">=", ">=", ">", ">",
+ };
+
+ /* 128-bit numbers */
+ typedef struct Big Big;
+ struct Big
+ {
+ vlong a;
+ uvlong b;
+ };
+ static int
+ cmp(Big x, Big y)
+ {
+ if(x.a != y.a){
+ if(x.a < y.a)
+ return -1;
+ return 1;
+ }
+ if(x.b != y.b){
+ if(x.b < y.b)
+ return -1;
+ return 1;
+ }
+ return 0;
+ }
+ static Big
+ add(Big x, int y)
+ {
+ uvlong ob;
+
+ ob = x.b;
+ x.b += y;
+ if(y > 0 && x.b < ob)
+ x.a++;
+ if(y < 0 && x.b > ob)
+ x.a--;
+ return x;
+ }
+
+ Big
+ big(vlong a, uvlong b)
+ {
+ Big x;
+
+ x.a = a;
+ x.b = b;
+ return x;
+ }
+
+ int
+ compar(Node *n, int reverse)
+ {
+ Big lo, hi, x;
+ int op;
+ char xbuf[40], cmpbuf[50];
+ Node *l, *r;
+ Type *lt, *rt;
+
+ /*
+ * The point of this function is to diagnose comparisons
+ * that can never be true or that look misleading because
+ * of the `usual arithmetic conversions'. As an example
+ * of the latter, if x is a ulong, then if(x <= -1) really means
+ * if(x <= 0xFFFFFFFF), while if(x <= -1LL) really means
+ * what it says (but 8c compiles it wrong anyway).
+ */
+
+ if(reverse){
+ r = n->left;
+ l = n->right;
+ op = comrel[relindex(n->op)];
+ }else{
+ l = n->left;
+ r = n->right;
+ op = n->op;
+ }
+
+ /*
+ * Skip over left casts to find out the original expression range.
+ */
+ while(l->op == OCAST)
+ l = l->left;
+ if(l->op == OCONST)
+ return 0;
+ lt = l->type;
+ if(l->op == ONAME){
+ lt = l->sym->type;
+ if(lt && lt->etype == TARRAY)
+ lt = lt->link;
+ }
+ if(lt == T)
+ return 0;
+ if(lt->etype == TXXX || lt->etype > TUVLONG)
+ return 0;
+
+ /*
+ * Skip over the right casts to find the on-screen value.
+ */
+ if(r->op != OCONST)
+ return 0;
+ while(r->oldop == OCAST && !r->xcast)
+ r = r->left;
+ rt = r->type;
+ if(rt == T)
+ return 0;
+
+ x.b = r->vconst;
+ x.a = 0;
+ if((rt->etype&1) && r->vconst < 0) /* signed negative */
+ x.a = ~0ULL;
+
+ if((lt->etype&1)==0){
+ /* unsigned */
+ lo = big(0, 0);
+ if(lt->width == 8)
+ hi = big(0, ~0ULL);
+ else
+ hi = big(0, (1LL<<(l->type->width*8))-1);
+ }else{
+ lo = big(~0ULL, -(1LL<<(l->type->width*8-1)));
+ hi = big(0, (1LL<<(l->type->width*8-1))-1);
+ }
+
+ switch(op){
+ case OLT:
+ case OLO:
+ case OGE:
+ case OHS:
+ if(cmp(x, lo) <= 0)
+ goto useless;
+ if(cmp(x, add(hi, 1)) >= 0)
+ goto useless;
+ break;
+ case OLE:
+ case OLS:
+ case OGT:
+ case OHI:
+ if(cmp(x, add(lo, -1)) <= 0)
+ goto useless;
+ if(cmp(x, hi) >= 0)
+ goto useless;
+ break;
+ case OEQ:
+ case ONE:
+ /*
+ * Don't warn about comparisons if the expression
+ * is as wide as the value: the compiler-supplied casts
+ * will make both outcomes possible.
+ */
+ if(lt->width >= rt->width && debug['w'] < 2)
+ return 0;
+ if(cmp(x, lo) < 0 || cmp(x, hi) > 0)
+ goto useless;
+ break;
+ }
+ return 0;
+
+ useless:
+ if((x.a==0 && x.b<=9) || (x.a==~0LL && x.b >= -9ULL))
+ snprint(xbuf, sizeof xbuf, "%lld", x.b);
+ else if(x.a == 0)
+ snprint(xbuf, sizeof xbuf, "%#llux", x.b);
+ else
+ snprint(xbuf, sizeof xbuf, "%#llx", x.b);
+ if(reverse)
+ snprint(cmpbuf, sizeof cmpbuf, "%s %s %T",
+ xbuf, cmps[relindex(n->op)], lt);
+ else
+ snprint(cmpbuf, sizeof cmpbuf, "%T %s %s",
+ lt, cmps[relindex(n->op)], xbuf);
+ warn(n, "useless or misleading comparison: %s", cmpbuf);
+ return 0;
+ }
+
[rsc] --rw-rw-r-- M 84741 glenda sys 23923 Dec 11 12:22 sys/src/cmd/cc/lex.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/lex.c:395,401 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/lex.c:395,401
yylex(void)
{
vlong vv;
- long c, c1;
+ long c, c1, t;
char *cp;
Rune rune;
Sym *s;
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/lex.c:540,547 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/lex.c:540,549
if(yylval.vval != vv)
yyerror("overflow in character constant: 0x%lx", c);
else
- if(c & 0x80)
+ if(c & 0x80){
+ nearln = lineno;
warn(Z, "sign-extended character constant");
+ }
yylval.vval = convvtox(vv, TCHAR);
return LCONST;
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/lex.c:784,828 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/lex.c:786,827
if(mpatov(symb, &yylval.vval))
yyerror("overflow in constant");
+ vv = yylval.vval;
if(c1 & Numvlong) {
- if(c1 & Numuns) {
+ if((c1 & Numuns) || convvtox(vv, TVLONG) < 0) {
c = LUVLCONST;
+ t = TUVLONG;
goto nret;
}
- yylval.vval = convvtox(yylval.vval, TVLONG);
- if(yylval.vval < 0) {
- c = LUVLCONST;
- goto nret;
- }
c = LVLCONST;
+ t = TVLONG;
goto nret;
}
if(c1 & Numlong) {
- if(c1 & Numuns) {
+ if((c1 & Numuns) || convvtox(vv, TLONG) < 0) {
c = LULCONST;
+ t = TULONG;
goto nret;
}
- yylval.vval = convvtox(yylval.vval, TLONG);
- if(yylval.vval < 0) {
- c = LULCONST;
- goto nret;
- }
c = LLCONST;
+ t = TLONG;
goto nret;
}
- if(c1 & Numuns) {
+ if((c1 & Numuns) || convvtox(vv, TINT) < 0) {
c = LUCONST;
+ t = TUINT;
goto nret;
}
- yylval.vval = convvtox(yylval.vval, TINT);
- if(yylval.vval < 0) {
- c = LUCONST;
- goto nret;
- }
c = LCONST;
+ t = TINT;
goto nret;
nret:
+ yylval.vval = convvtox(vv, t);
+ if(yylval.vval != vv){
+ nearln = lineno;
+ warn(Z, "truncated constant: %T %s", types[t], symb);
+ }
return c;
casedot:
[rsc] --rw-rw-r-- M 84741 jmk sys 8645 Dec 11 12:22 sys/src/cmd/cc/scon.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/scon.c:226,231 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/scon.c:226,232
} else {
n->vconst = convvtox(v, n->type->etype);
}
+ n->oldop = n->op;
n->op = OCONST;
}
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/scon.c:375,380 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/scon.c:376,382
}
c1 = trm[0].mult;
if(j == 0) {
+ n->oldop = n->op;
n->op = OCONST;
n->vconst = c1;
return;
[rsc] --rw-rw-r-- M 84741 glenda sys 34315 Dec 11 12:22 sys/src/cmd/cc/sub.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/sub.c:1484,1489 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/sub.c:1484,1490
-1, 0, 0,
};
+ /* OEQ, ONE, OLE, OLS, OLT, OLO, OGE, OHS, OGT, OHI */
char comrel[12] =
{
ONE, OEQ, OGT, OHI, OGE, OHS, OLT, OLO, OLE, OLS,
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/sub.c:1522,1527 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/sub.c:1523,1529
char typechl[NTYPE];
char typechlv[NTYPE];
+ char typechlvp[NTYPE];
int typechlinit[] =
{
TCHAR, TUCHAR, TSHORT, TUSHORT, TINT, TUINT, TLONG, TULONG, -1,
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/sub.c:1868,1877 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/sub.c:1870,1881
urk("typechl", nelem(typechl), typechlinit[i]);
typechl[typechlinit[i]] = 1;
typechlv[typechlinit[i]] = 1;
+ typechlvp[typechlinit[i]] = 1;
}
for(i=0; typechlpinit[i] >= 0; i++) {
urk("typechlp", nelem(typechlp), typechlpinit[i]);
typechlp[typechlpinit[i]] = 1;
+ typechlvp[typechlinit[i]] = 1;
}
for(i=0; typechlpfdinit[i] >= 0; i++) {
urk("typechlpfd", nelem(typechlpfd), typechlpfdinit[i]);
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cc/sub.c:1893,1898 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cc/sub.c:1897,1903
urk("typev", nelem(typev), typevinit[i]);
typev[typevinit[i]] = 1;
typechlv[typevinit[i]] = 1;
+ typechlvp[typechlinit[i]] = 1;
}
for(i=0; typefdinit[i] >= 0; i++) {
urk("typefd", nelem(typefd), typefdinit[i]);
Man page cleanup.
[rsc] --rw-rw-r-- M 84741 glenda sys 1069 Dec 11 14:50 sys/man/1/cmp
/n/sourcesdump/2005/1211/plan9/sys/man/1/cmp:4,10 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/cmp:4,10
.SH SYNOPSIS
.B cmp
[
- .B -lsL
+ .B -lLs
]
.I file1 file2
[
/n/sourcesdump/2005/1211/plan9/sys/man/1/cmp:14,36 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/cmp:14,36
]
]
.SH DESCRIPTION
- The two files are
- compared.
- A diagnostic results if the contents differ, otherwise
- there is no output.
+ .I Cmp
+ compares the two files and prints
+ a message if the contents differ.
.PP
The options are:
.TP
- .B l
+ .B -l
Print the byte number (decimal) and the
differing bytes (hexadecimal) for each difference.
.TP
- .B s
+ .B -L
+ Print the line number of the first differing byte.
+ .TP
+ .B -s
Print nothing for differing files,
but set the exit status.
- .TP
- .B L
- Print the line number of the first differing byte.
+ .PD
.PP
If offsets are given,
comparison starts at the designated byte position
/n/sourcesdump/2005/1211/plan9/sys/man/1/cmp:43,49 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/cmp:43,49
octal; with anything else, decimal.
.SH SOURCE
.B /sys/src/cmd/cmp.c
- .SH "SEE ALSO"
+ .SH SEE ALSO
.IR diff (1)
.SH DIAGNOSTICS
If a file is inaccessible or missing, the exit status is
[rsc] --rw-rw-r-- M 84741 glenda sys 1294 Dec 11 14:44 sys/man/1/calendar
/n/sourcesdump/2005/1211/plan9/sys/man/1/calendar:4,13 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/calendar:4,14
.SH SYNOPSIS
.B calendar
[
- .B \-y
+ .B -dy
]
[
- .B \-p days
+ .B -p
+ .I days
]
[
.I file ...
/n/sourcesdump/2005/1211/plan9/sys/man/1/calendar:32,38 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/calendar:33,39
All comparisons are case insensitive.
.PP
If the
- .B \-y
+ .B -y
flag is given, an attempt is made to match on year too. In this case,
dates of the forms listed above will be accepted if they are followed
by the current year (or last two digits thereof) or not a year —
/n/sourcesdump/2005/1211/plan9/sys/man/1/calendar:39,48 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/calendar:40,53
digits not followed by white space or non-digits.
.PP
If the
- .B \-p
+ .B -p
flag is given, its argument is the number of days ahead to match
dates. This flag is not repeatable, and it performs no special
processing at the end of the week.
+ .PP
+ The
+ .B -d
+ flag enables debugging output.
.PP
On Friday and Saturday, events through Monday are printed.
.PP
[rsc] --rw-rw-r-- M 84741 presotto sys 785 Dec 11 14:48 sys/man/1/cb
/n/sourcesdump/2005/1211/plan9/sys/man/1/cb:1,31 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/cb:1,46
.TH CB 1
.SH NAME
- .I cb
- \- C program beautifier
+ cb \- C program beautifier
.SH SYNOPSIS
- \fBcb\fR [\fB-s\fR] [\fB-j\fR] [\fB-l\fR \fIlength\fR] [\fIfile\fR ...]
+ .B cb
+ [
+ .B -js
+ ]
+ [
+ .B -l
+ .I length
+ ]
+ [
+ .I file
+ \&...
+ ]
.SH DESCRIPTION
- \fBCb\fR reads syntactically correct C programs from
+ .I Cb
+ reads syntactically correct C programs from
from its input or the given files, and writes them to its stdout
- with a more visualy pleasing spacing and indentation. \fBCb\fR
+ with a more visualy pleasing spacing and indentation.
+ .I Cb
understands no C++ syntax bar newline terminated comments;
and by default all user new-lines are preserved in the output.
.PP
- \fBCb\fR accepts the following options.
- .TP
- .B -s
- Write the code in the style of Kernighan and
- Ritchie found in The C Programming Language.
+ The options are:
.TP
.B -j
- Put split lines back together.
+ Join split lines.
.TP
+ .B -s
+ Print code in the so-called K&R style used in
+ .IR "The C Programming Language" .
+ .TP
.B -l length
- Split lines that are longer than \fIlength\fR.
+ Split lines that are longer than
+ .IR length .
+ .PD
.SH SOURCE
.B /sys/src/cmd/cb
- .SH NOTES
- The format of structure initializations is unchanged by \fBcb\fR.
+ .SH BUGS
+ .I Cb
+ does not reformat structure initializers.
.br
- Punctuation that is hidden in preprocessing directives
- causes indentation errors.
+ Punctuation hidden in macros can cause
+ indentation errors.
[rsc] --rw-rw-r-- M 84741 glenda sys 1438 Dec 11 14:50 sys/man/1/colors
/n/sourcesdump/2005/1211/plan9/sys/man/1/colors:5,12 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/colors:5,11
.PP
.B colors
[
- .B -r
- .B -x
+ .B -rx
]
.PP
.B getmap
[rsc] --rw-rw-r-- M 84741 glenda sys 4306 Dec 11 14:52 sys/man/1/con
/n/sourcesdump/2005/1211/plan9/sys/man/1/con:4,10 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/con:4,10
.SH SYNOPSIS
.B con
[
- .B -CdnrRvsT
+ .B -CdnrRsTv
]
[
.B -b
/n/sourcesdump/2005/1211/plan9/sys/man/1/con:13,19 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/con:13,19
[
.B -l
[
- .I remuser
+ .I user
]
]
[
/n/sourcesdump/2005/1211/plan9/sys/man/1/con:37,43 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/con:37,43
]
[
.B -l
- .I remuser
+ .I user
]
.RI [ net !] machine
[
/n/sourcesdump/2005/1211/plan9/sys/man/1/con:73,79 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/con:73,79
.TP
.B -l
with an argument causes
- .I remuser
+ .I user
to be used as the account name on the remote system.
Without an argument this option disables automatic login
and a normal login session ensues.
/n/sourcesdump/2005/1211/plan9/sys/man/1/con:178,184 -
/n/sourcesdump/2005/1212/plan9/sys/man/1/con:178,184
.TP
.B \-l
allows
- .I remuser
+ .I user
to be used on the remote machine if the remote
is a BSD machine.
.TP
[rsc] --rw-rw-r-- M 84741 glenda sys 2379 Dec 11 14:48 sys/src/cmd/cmp.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/cmp.c:119,124 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/cmp.c:119,124
static void
usage(void)
{
- print("Usage: cmp [-lsL] file1 file2 [offset1 [offset2] ]\n");
+ print("usage: cmp [-lLs] file1 file2 [offset1 [offset2] ]\n");
exits("usage");
}
@1134331316.0
[rsc] --rw-rw-r-- M 84741 glenda sys 4227 Dec 11 14:43 sys/src/cmd/calendar.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/calendar.c:44,50 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/calendar.c:44,50
ahead = atoi(ARGF());
break;
default:
- fprint(2, "usage: calendar [-y] [-d] [files ...]\n");
+ fprint(2, "usage: calendar [-dy] [-p days] [files ...]\n");
exits("usage");
}ARGEND;
@1134331316.0
[rsc] --rw-rw-r-- M 84741 glenda sys 15237 Dec 11 14:52 sys/src/cmd/con/con.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/con/con.c:61,67 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/con/con.c:61,67
void
usage(void)
{
- punt("usage: con [-drCvsn] [-b baud] [-l [user]] [-c cmd] net!host[!service]");
+ punt("usage: con [-CdnrRsTv] [-b baud] [-l [user]] [-c cmd] net!host[!service]");
}
void
Network-aware and auth-aware 9P library.
[rsc] --rw-rw-r-- M 84741 glenda sys 15859 Dec 11 16:18 sys/man/2/9p
/n/sourcesdump/2005/1211/plan9/sys/man/2/9p:10,15 -
/n/sourcesdump/2005/1212/plan9/sys/man/2/9p:10,16
readbuf,
readstr,
respond,
+ responderror,
threadpostmountsrv,
srv \- 9P file service
.SH SYNOPSIS
/n/sourcesdump/2005/1211/plan9/sys/man/2/9p:61,68 -
/n/sourcesdump/2005/1212/plan9/sys/man/2/9p:62,72
int srv(Srv *s)
void postmountsrv(Srv *s, char *name, char *mtpt, int flag)
void threadpostmountsrv(Srv *s, char *name, char *mtpt, int flag)
+ void listensrv(Srv *s, char *addr)
+ void threadlistensrv(Srv *s, char *addr)
int postfd(char *srvname, int fd)
void respond(Req *r, char *error)
+ void responderror(Req*)
void readstr(Req *r, char *src)
void readbuf(Req *r, void *src, long nsrc)
typedef int Dirgen(int n, Dir *dir, void *aux)
/n/sourcesdump/2005/1211/plan9/sys/man/2/9p:217,222 -
/n/sourcesdump/2005/1212/plan9/sys/man/2/9p:221,241
.I sysfatal
(see
.IR perror (2)).
+ .PP
+ .I Listensrv
+ and
+ .I threadlistensrv
+ create a separate process to announce as
+ .IR addr .
+ The process listens for incoming connections,
+ creating a new process to serve each.
+ Using these functions results in
+ .I srv
+ and the service functions
+ being run in multiple processes simultaneously.
+ The library locks its own data structures as necessary;
+ the client may need to lock data it shares between
+ the multiple connections.
.SS Service functions
The functions in a
.B Srv
/n/sourcesdump/2005/1211/plan9/sys/man/2/9p:288,293 -
/n/sourcesdump/2005/1212/plan9/sys/man/2/9p:307,319
.B Req*
as well as any pointers it once contained must
be considered freed and not referenced.
+ .PP
+ .I Responderror
+ calls
+ .I respond
+ with the system error string
+ (see
+ .IR errstr (2)).
.PP
If the service loop detects an error in a request
(e.g., an attempt to reuse an extant fid, an open of
[rsc] --rw-rw-r-- M 84741 glenda sys 4759 Dec 11 16:45 sys/include/9p.h
/n/sourcesdump/2005/1211/plan9/sys/include/9p.h:198,203 -
/n/sourcesdump/2005/1212/plan9/sys/include/9p.h:198,204
int nopipe;
int srvfd;
int leavefdsopen; /* magic for acme win */
+ char* keyspec;
/* below is implementation-specific; don't use */
Fidpool* fpool;
/n/sourcesdump/2005/1211/plan9/sys/include/9p.h:208,220 -
/n/sourcesdump/2005/1212/plan9/sys/include/9p.h:209,227
QLock rlock;
uchar* wbuf;
QLock wlock;
+
+ char* addr;
};
void srv(Srv*);
void postmountsrv(Srv*, char*, char*, int);
+ void _postmountsrv(Srv*, char*, char*, int);
+ void listensrv(Srv*, char*);
+ void _listensrv(Srv*, char*);
int postfd(char*, int);
int chatty9p;
void respond(Req*, char*);
+ void responderror(Req*);
void threadpostmountsrv(Srv*, char*, char*, int);
/*
/n/sourcesdump/2005/1211/plan9/sys/include/9p.h:230,236 -
/n/sourcesdump/2005/1212/plan9/sys/include/9p.h:237,252
OMASK = 3
};
- void readstr(Req*, char*);
- void readbuf(Req*, void*, long);
- void walkandclone(Req*, char*(*walk1)(Fid*,char*,void*), char*(*clone)(Fid*,Fid*,void*), void*);
+ void readstr(Req*, char*);
+ void readbuf(Req*, void*, long);
+ void walkandclone(Req*, char*(*walk1)(Fid*,char*,void*),
+ char*(*clone)(Fid*,Fid*,void*), void*);
+
+ void auth9p(Req*);
+ void authread(Req*);
+ void authwrite(Req*);
+ void authdestroy(Fid*);
+ int authattach(Req*);
+
+ extern void (*_forker)(void (*)(void*), void*, int);
Listensrv now in library.
[rsc] --rw-rw-r-- M 84741 glenda sys 14440 Dec 11 21:33 sys/src/cmd/wikifs/fs.c
/n/sourcesdump/2005/1211/plan9/sys/src/cmd/wikifs/fs.c:807,895 -
/n/sourcesdump/2005/1212/plan9/sys/src/cmd/wikifs/fs.c:807,812
exits("usage");
}
- char*
- getremotesys(char *ndir)
- {
- char buf[128], *serv, *sys;
- int fd, n;
-
- snprint(buf, sizeof buf, "%s/remote", ndir);
- sys = nil;
- fd = open(buf, OREAD);
- if(fd >= 0){
- n = read(fd, buf, sizeof(buf)-1);
- if(n>0){
- buf[n-1] = 0;
- serv = strchr(buf, '!');
- if(serv)
- *serv = 0;
- sys = estrdup(buf);
- }
- close(fd);
- }
- if(sys == nil)
- sys = estrdup("unknown");
- return sys;
- }
-
- void
- listensrv(Srv *os, char *addr)
- {
- int ctl, data, nctl;
- char ndir[NETPATHLEN], dir[NETPATHLEN];
- Srv *s;
-
- switch(rfork(RFPROC|RFMEM|RFNOWAIT)){
- case -1:
- sysfatal("rfork: %r");
- default:
- return;
- case 0:
- break;
- }
-
- ctl = announce(addr, dir);
- if(ctl < 0){
- fprint(2, "wikifs announce %s: %r", addr);
- _exits(0);
- }
-
- for(;;){
- nctl = listen(dir, ndir);
- if(nctl < 0){
- fprint(2, "wikifs listen %s: %r", addr);
- _exits(0);
- }
-
- switch(rfork(RFPROC|RFMEM|RFNOWAIT)){
- case -1:
- fprint(2, "rfork answerer: %r\n");
- continue;
- default:
- continue;
- case 0:
- break;
- }
-
- data = accept(ctl, ndir);
- close(nctl);
- if(data < 0){
- fprint(2, "wikifs accept %s: %r\n", ndir);
- _exits(nil);
- }
-
- s = emalloc(sizeof *s);
- *s = *os;
- s->aux = getremotesys(ndir);
- s->infd = s->outfd = data;
- srv(s);
- close(data);
- free(s->aux);
- free(s);
- _exits(nil);
- }
- }
-
void
main(int argc, char **argv)
{
[rsc] --rw-rw-r-- M 84741 glenda sys 14440 Dec 11 21:33 sys/src/cmd/wikifs/fs.c
|