~kris/9p

9hist

2a7904a598c5731cb1b4f15c7737fcb39e2c0d92 — David du Colombier 24 years ago 827f3ac
Plan 9 from Bell Labs 2001-09-24
M alphapc/trap.c => alphapc/trap.c +5 -1
@@ 651,6 651,7 @@ print("unknown noted arg 0x%lux\n", arg0);
long
syscall(Ureg *aur)
{
	char *e;
	long ret;
	ulong sp;
	Ureg *ur;


@@ 704,7 705,10 @@ print("bad sys call %d pc %lux\n", up->scallnr, (ulong)ur->pc);

error:
	/* failure: save the error buffer for errstr */
	kstrcpy(up->syserror, up->error, sizeof up->syserror);
	e = up->syserrstr;
	up->syserrstr = up->errstr;
	up->errstr = e;

	up->nerrlab = 0;
	up->psstate = 0;
	up->insyscall = 0;

M bitsy/devsac.c => bitsy/devsac.c +1 -1
@@ 231,7 231,7 @@ sacwalk(Chan *c, Chan *nc, char **name, int nname)
		if(sac == nil) {
			if(j == 0)
				error(Enonexist);
			strncpy(up->error, Enonexist, ERRMAX);
			kstrcpy(up->errstr, Enonexist, ERRMAX);
			break;
		}
		pathtoqid(getl(sac->qid), &nc->qid);

M bitsy/trap.c => bitsy/trap.c +4 -1
@@ 426,6 426,7 @@ gpiointr(Ureg *ur, void*)
void
syscall(Ureg* ureg)
{
	char *e;
	ulong	sp;
	long	ret;
	int	i, scallnr;


@@ 464,7 465,9 @@ syscall(Ureg* ureg)
		poperror();
	}else{
		/* failure: save the error buffer for errstr */
		kstrcpy(up->syserror, up->error, sizeof up->syserror);
		e = up->syserrstr;
		up->syserrstr = up->errstr;
		up->errstr = e;
	}
	if(up->nerrlab){
		print("bad errstack [%d]: %d extra\n", scallnr, up->nerrlab);

M boot/key.c => boot/key.c +1 -4
@@ 77,10 77,7 @@ key(int islocal, Method *mp)
		warning("can't read nvram");
	}
	check(safe->machkey, DESKEYLEN, safe->machsum, "bad nvram key");
#define NAMELEN 28
/*BUG: THIS IS TOTALLY BOGUS */
	check(safe->authid, NAMELEN, safe->authidsum, "bad authentication id");
#undef NAMELEN
	check(safe->authid, ANAMELEN, safe->authidsum, "bad authentication id");
	check(safe->authdom, DOMLEN, safe->authdomsum, "bad authentication domain");
	if(kflag){
		do

M ip/inferno.c => ip/inferno.c +1 -1
@@ 25,7 25,7 @@ commonfdtochan(int fd, int mode, int a, int b)
char*
commonerror(void)
{
	return up->error;
	return up->errstr;
}

char*

M mtx/trap.c => mtx/trap.c +4 -1
@@ 618,6 618,7 @@ dbgpc(Proc *p)
void
syscall(Ureg* ureg)
{
	char *e;
	ulong	sp;
	long	ret;
	int	i, scallnr;


@@ 655,7 656,9 @@ syscall(Ureg* ureg)
		poperror();
	}else{
		/* failure: save the error buffer for errstr */
		kstrcpy(up->syserror, up->error, sizeof up->syserror);
		e = up->syserrstr;
		up->syserrstr = up->errstr;
		up->errstr = e;
	}
	if(up->nerrlab){
		print("bad errstack [%d]: %d extra\n", scallnr, up->nerrlab);

M pc/trap.c => pc/trap.c +4 -1
@@ 494,6 494,7 @@ if(up == nil) {print("what? up is zero pc %8lux\n", ureg->pc); for(;;);}
void
syscall(Ureg* ureg)
{
	char *e;
	ulong	sp;
	long	ret;
	int	i, scallnr;


@@ 535,7 536,9 @@ syscall(Ureg* ureg)
		poperror();
	}else{
		/* failure: save the error buffer for errstr */
		kstrcpy(up->syserror, up->error, sizeof up->syserror);
		e = up->syserrstr;
		up->syserrstr = up->errstr;
		up->errstr = e;
	}
	if(up->nerrlab){
		print("bad errstack [%d]: %d extra\n", scallnr, up->nerrlab);

M port/chan.c => port/chan.c +14 -6
@@ 776,6 776,9 @@ walk(Chan **cp, char **names, int nnames, int nomount)
				runlock(&mh->lock);
				nexterror();
			}
			/*
			 * mh->mount == c, so start at mh->mount->next
			 */
			for(f = mh->mount->next; f; f = f->next)
				if((wq = devtab[f->to->type]->walk(f->to, nil, names, ntry)) != nil)
					break;


@@ 974,7 977,7 @@ namec(char *aname, int amode, int omode, ulong perm)
	Elemlist e;
	Rune r;
	Mhead *m;
	char createerr[ERRMAX];
	char *createerr, tmperrbuf[ERRMAX];
	char *name;

	name = aname;


@@ 1039,11 1042,11 @@ namec(char *aname, int amode, int omode, ulong perm)
	e.name = nil;
	e.elems = nil;
	if(waserror()){
		if(strcmp(up->error, Enonexist) == 0){
		if(strcmp(up->errstr, Enonexist) == 0){
			if(strlen(aname) < ERRMAX/3 || (name=strrchr(aname, '/'))==nil || name==aname)
				snprint(up->error, sizeof up->error, "\"%s\" does not exist", aname);
				snprint(up->errstr, ERRMAX, "\"%s\" does not exist", aname);
			else
				snprint(up->error, sizeof up->error, "file \"...%s\" does not exist", name);
				snprint(up->errstr, ERRMAX, "file \"...%s\" does not exist", name);
		}
		cclose(c);
		free(e.name);


@@ 1246,9 1249,14 @@ if(c->umh != nil){
			if(omode & OEXCL)
				nexterror();
			/* save error */
			kstrcpy(createerr, up->error, sizeof createerr);
			if(walk(&c, e.elems+e.nelems-1, 1, nomount) < 0)
			createerr = up->errstr;
			up->errstr = tmperrbuf;
			/* note: we depend that walk does not error */
			if(walk(&c, e.elems+e.nelems-1, 1, nomount) < 0){
				up->errstr = createerr;
				error(createerr);	/* report true error */
			}
			up->errstr = createerr;
			omode |= OTRUNC;
			goto Open;
		}

M port/dev.c => port/dev.c +1 -1
@@ 175,7 175,7 @@ devwalk(Chan *c, Chan *nc, char **name, int nname, Dirtab *tab, int ntab, Devgen
			Notfound:
				if(j == 0)
					error(Enonexist);
				strncpy(up->error, Enonexist, ERRMAX);
				kstrcpy(up->errstr, Enonexist, ERRMAX);
				goto Done;
			case 0:
				continue;

M port/devmnt.c => port/devmnt.c +1 -1
@@ 776,7 776,7 @@ mountio(Mnt *m, Mntrpc *r)
	while(waserror()) {
		if(m->rip == up)
			mntgate(m);
		if(strcmp(up->error, Eintr) != 0){
		if(strcmp(up->errstr, Eintr) != 0){
			mntflushfree(m, r);
			nexterror();
		}

M port/devsd.c => port/devsd.c +1 -1
@@ 727,7 727,7 @@ sdbio(Chan* c, int write, char* a, long len, vlong off)
	qlock(&unit->ctl);
	while(waserror()){
		/* notification of media change; go around again */
		if(strcmp(up->error, Eio) == 0 && unit->sectors == 0 && nchange++ == 0){
		if(strcmp(up->errstr, Eio) == 0 && unit->sectors == 0 && nchange++ == 0){
			sdinitpart(unit);
			continue;
		}

M port/fault.c => port/fault.c +2 -2
@@ 43,7 43,7 @@ faulterror(char *s, Chan *c, int freemem)
	char buf[ERRMAX];

	if(c && c->name){
		snprint(buf, sizeof buf, "%s accessing %s: %s", s, c->name->s, up->error);
		snprint(buf, sizeof buf, "%s accessing %s: %s", s, c->name->s, up->errstr);
		s = buf;
	}
	if(up->nerrlab) {


@@ 219,7 219,7 @@ retry:
	if(loadrec == 0) {			/* This is demand load */
		c = s->image->c;
		while(waserror()) {
			if(strcmp(up->error, Eintr) == 0)
			if(strcmp(up->errstr, Eintr) == 0)
				continue;
			kunmap(k);
			putpage(new);

M port/portdat.h => port/portdat.h +4 -2
@@ 611,8 611,10 @@ struct Proc
	Sargs	s;		/* address of this is known by db */
	int	nerrlab;
	Label	errlab[NERR];
	char	syserror[ERRMAX];	/* last error from a system call */
	char	error[ERRMAX];		/* reason we're unwinding the error stack */
	char *syserrstr;			/* last error from a system call, errbuf0 or 1 */
	char *errstr;			/* reason we're unwinding the error stack, errbuf1 or 0 */
	char errbuf0[ERRMAX];
	char errbuf1[ERRMAX];
	char	genbuf[128];	/* buffer used e.g. for last name element from namec */
	Chan	*slash;
	Chan	*dot;

M port/proc.c => port/proc.c +5 -3
@@ 338,8 338,10 @@ newproc(void)
	p->movetime = 0;
	p->wired = 0;
	p->ureg = 0;
	p->error[0] = '\0';
	p->syserror[0] = '\0';
	p->errstr = p->errbuf0;
	p->syserrstr = p->errbuf1;
	p->errbuf0[0] = '\0';
	p->errbuf1[0] = '\0';
	kstrdup(&p->user, "*nouser");
	kstrdup(&p->text, "*notext");
	kstrdup(&p->args, "");


@@ 1109,7 1111,7 @@ void
error(char *err)
{
	spllo();
	kstrcpy(up->error, err, sizeof up->error);
	kstrcpy(up->errstr, err, ERRMAX);
	nexterror();
}


M port/sysproc.c => port/sysproc.c +4 -4
@@ 629,14 629,14 @@ werrstr(char *fmt, ...)
		return;

	va_start(va, fmt);
	doprint(up->error, up->error+ERRMAX, fmt, va);
	doprint(up->syserrstr, up->syserrstr+ERRMAX, fmt, va);
	va_end(va);
}

static long
generrstr(char *buf, uint nbuf)
{
	char tmp[sizeof up->syserror];
	char tmp[ERRMAX];

	validaddr((ulong)buf, nbuf, 1);
	if(nbuf > sizeof tmp)


@@ 644,9 644,9 @@ generrstr(char *buf, uint nbuf)
	memmove(tmp, buf, nbuf);
	/* make sure it's NUL-terminated */
	tmp[nbuf-1] = '\0';
	memmove(buf, up->syserror, nbuf);
	memmove(buf, up->syserrstr, nbuf);
	buf[nbuf-1] = '\0';
	memmove(up->syserror, tmp, nbuf);
	memmove(up->syserrstr, tmp, nbuf);
	return 0;
}