Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2005/1211/2

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


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


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.