Browse Source

Plan 9 from Bell Labs 2003-01-01

David du Colombier 21 years ago
parent
commit
edb63c3c2c

+ 12 - 12
dist/replica/plan9.db

@@ -5182,7 +5182,7 @@ sys/src/9/port/devcons.c - 664 sys sys 1036812998 20919
 sys/src/9/port/devdraw.c - 664 sys sys 1039753332 41987
 sys/src/9/port/devdup.c - 664 sys sys 1014931172 2332
 sys/src/9/port/devenv.c - 664 sys sys 1019762849 6562
-sys/src/9/port/devfs.c - 664 sys sys 1041261474 11170
+sys/src/9/port/devfs.c - 664 sys sys 1041350175 11171
 sys/src/9/port/devkprof.c - 664 sys sys 1014931173 3111
 sys/src/9/port/devloopback.c - 664 sys sys 1018721201 14968
 sys/src/9/port/devmnt.c - 664 sys sys 1039743586 21096
@@ -10468,7 +10468,7 @@ sys/src/cmd/xd.c - 664 sys sys 944961355 5735
 sys/src/cmd/yacc.c - 664 sys sys 984717754 57876
 sys/src/fs - 20000000775 sys sys 1015110109 0
 sys/src/fs/choline - 20000000775 sys sys 1015110109 0
-sys/src/fs/choline/9cholinefs.c - 664 sys sys 1037805080 2916
+sys/src/fs/choline/9cholinefs.c - 664 sys sys 1041361226 2962
 sys/src/fs/choline/dat.h - 664 sys sys 1037805081 528
 sys/src/fs/choline/fns.h - 664 sys sys 1037805081 1968
 sys/src/fs/choline/io.h - 664 sys sys 1037805081 6576
@@ -10483,7 +10483,7 @@ sys/src/fs/dev/mworm.c - 664 sys sys 1037805087 4138
 sys/src/fs/dev/sony.c - 664 sys sys 1037805088 17049
 sys/src/fs/dev/wren.c - 664 sys sys 1015109978 2327
 sys/src/fs/emelie - 20000000775 sys sys 1015110098 0
-sys/src/fs/emelie/9pcfs.c - 664 sys sys 1037805101 2916
+sys/src/fs/emelie/9pcfs.c - 664 sys sys 1041361237 2962
 sys/src/fs/emelie/dat.h - 664 sys sys 1037805101 502
 sys/src/fs/emelie/fns.h - 664 sys sys 1037805101 1968
 sys/src/fs/emelie/io.h - 664 sys sys 1037805101 6576
@@ -10542,15 +10542,15 @@ sys/src/fs/port - 20000000775 sys sys 1015110029 0
 sys/src/fs/port/9p1.c - 664 sys sys 1015109993 30114
 sys/src/fs/port/9p1.h - 664 sys sys 1015109994 2122
 sys/src/fs/port/9p1lib.c - 664 sys sys 1015109996 7629
-sys/src/fs/port/9p2.c - 664 sys sys 1015110001 35994
+sys/src/fs/port/9p2.c - 664 sys sys 1041361346 36053
 sys/src/fs/port/all.h - 664 sys sys 1015110002 1883
-sys/src/fs/port/auth.c - 664 sys sys 1015110003 7560
+sys/src/fs/port/auth.c - 664 sys sys 1041361345 7608
 sys/src/fs/port/chk.c - 664 sys sys 1037805158 13882
 sys/src/fs/port/clock.c - 664 sys sys 1015110006 4033
 sys/src/fs/port/con.c - 664 sys sys 1037805158 16254
 sys/src/fs/port/config.c - 664 sys sys 1037805158 15691
 sys/src/fs/port/console.c - 664 sys sys 1015110011 4821
-sys/src/fs/port/data.c - 664 sys sys 1015110012 4369
+sys/src/fs/port/data.c - 664 sys sys 1041361346 4411
 sys/src/fs/port/dentry.c - 664 sys sys 1015110013 3801
 sys/src/fs/port/devcons.c - 664 sys sys 1015110014 4329
 sys/src/fs/port/fcmd.c - 664 sys sys 1015110015 1266
@@ -10558,22 +10558,22 @@ sys/src/fs/port/iobuf.c - 664 sys sys 1017679319 4819
 sys/src/fs/port/lib.h - 664 sys sys 1015110017 3335
 sys/src/fs/port/main.c - 664 sys sys 1037805158 5694
 sys/src/fs/port/mkfile - 664 sys sys 1015110018 189
-sys/src/fs/port/portdat.h - 664 sys sys 1040140792 16477
+sys/src/fs/port/portdat.h - 664 sys sys 1041361347 16579
 sys/src/fs/port/portfns.h - 664 sys sys 1037805159 7454
 sys/src/fs/port/print.c - 664 sys sys 1015110022 153
 sys/src/fs/port/proc.c - 664 sys sys 1015110023 5244
 sys/src/fs/port/sub.c - 664 sys sys 1037805159 23725
-sys/src/fs/port/time.c - 664 sys sys 1037805159 6411
+sys/src/fs/port/time.c - 664 sys sys 1041361347 6179
 sys/src/fs/port/uidgid.c - 664 sys sys 1015110030 9194
 sys/src/fs/roro - 20000000775 sys sys 1015110093 0
-sys/src/fs/roro/9rorofs.c - 664 sys sys 1037805167 2868
+sys/src/fs/roro/9rorofs.c - 664 sys sys 1041361248 2914
 sys/src/fs/roro/dat.h - 664 sys sys 1037805167 502
 sys/src/fs/roro/fns.h - 664 sys sys 1037805167 1968
 sys/src/fs/roro/io.h - 664 sys sys 1037805168 6576
 sys/src/fs/roro/mem.h - 664 sys sys 1015110092 2865
 sys/src/fs/roro/mkfile - 664 sys sys 1037805168 1645
 sys/src/fs/sony - 20000000775 sys sys 1015110104 0
-sys/src/fs/sony/9sonyfs.c - 664 sys sys 1037805175 2916
+sys/src/fs/sony/9sonyfs.c - 664 sys sys 1041361261 2962
 sys/src/fs/sony/dat.h - 664 sys sys 1037805175 490
 sys/src/fs/sony/fns.h - 664 sys sys 1037805175 1968
 sys/src/fs/sony/io.h - 664 sys sys 1037805175 6576
@@ -10798,11 +10798,11 @@ sys/src/libc/9sys/convS2M.c - 664 sys sys 1021580001 5014
 sys/src/libc/9sys/cputime.c - 664 sys sys 944961712 191
 sys/src/libc/9sys/ctime.c - 664 sys sys 944961712 4919
 sys/src/libc/9sys/dial.c - 664 sys sys 1014927336 3606
-sys/src/libc/9sys/dirfstat.c - 664 sys sys 1035998181 650
+sys/src/libc/9sys/dirfstat.c - 664 sys sys 1041363499 676
 sys/src/libc/9sys/dirfwstat.c - 664 sys sys 1014927336 242
 sys/src/libc/9sys/dirmodefmt.c - 664 sys sys 1014927337 581
 sys/src/libc/9sys/dirread.c - 664 sys sys 1014927337 1385
-sys/src/libc/9sys/dirstat.c - 664 sys sys 1035998182 662
+sys/src/libc/9sys/dirstat.c - 664 sys sys 1041363499 688
 sys/src/libc/9sys/dirwstat.c - 664 sys sys 1014927337 246
 sys/src/libc/9sys/fcallfmt.c - 664 sys sys 1033829606 5733
 sys/src/libc/9sys/fork.c - 664 sys sys 950892938 89

+ 12 - 0
dist/replica/plan9.log

@@ -16861,3 +16861,15 @@
 1041229876 0 c 386/lib/libregexp.a - 664 sys sys 1041228419 37356
 1041262210 0 a sys/man/3/fs - 664 sys sys 1041261485 2707
 1041262210 1 a sys/src/9/port/devfs.c - 664 sys sys 1041261474 11170
+1041350417 0 c sys/src/9/port/devfs.c - 664 sys sys 1041350175 11171
+1041361316 0 c sys/src/fs/choline/9cholinefs.c - 664 sys sys 1041361226 2962
+1041361316 1 c sys/src/fs/emelie/9pcfs.c - 664 sys sys 1041361237 2962
+1041361316 2 c sys/src/fs/port/9p2.c - 664 sys sys 1041361346 36053
+1041361316 3 c sys/src/fs/port/auth.c - 664 sys sys 1041361345 7608
+1041361316 4 c sys/src/fs/port/data.c - 664 sys sys 1041361346 4411
+1041361316 5 c sys/src/fs/port/portdat.h - 664 sys sys 1041361347 16579
+1041361316 6 c sys/src/fs/port/time.c - 664 sys sys 1041361347 6179
+1041361316 7 c sys/src/fs/roro/9rorofs.c - 664 sys sys 1041361248 2914
+1041361316 8 c sys/src/fs/sony/9sonyfs.c - 664 sys sys 1041361261 2962
+1041364878 0 c sys/src/libc/9sys/dirfstat.c - 664 sys sys 1041363499 676
+1041364878 1 c sys/src/libc/9sys/dirstat.c - 664 sys sys 1041363499 688

+ 3 - 3
sys/src/9/port/devfs.c

@@ -191,6 +191,8 @@ mconfig(char* a, long n)	// "name idev0 idev1"
 	char	*c;
 	vlong	size, start;
 
+	size = 0;
+	start = 0;
 	if (confstr[0] == 0)
 		seprint(confstr, confstr+sizeof(confstr), Cfgstr);
 	mp = nil;
@@ -419,7 +421,6 @@ catio(Fsdev *mp, int isread, void *a, long n, vlong off)
 	int	i;
 	Chan*	mc;
 	long	l, wl, res;
-	char*	s;
 	//print("catio %d %p %ld %lld\n", isread, a, n, off);
 	res = n;
 	for (i = 0; n >= 0 && i < mp->ndevs ; i++){
@@ -433,7 +434,6 @@ catio(Fsdev *mp, int isread, void *a, long n, vlong off)
 		else
 			l = n;
 		//print("\tdev %d %p %ld %lld\n", i, a, l, off);
-		s = a;
 
 		if (isread)
 			wl = devtab[mc->type]->read(mc, a, l, off);
@@ -595,7 +595,7 @@ mwrite(Chan *c, void *a, long n, vlong off)
 	return res;
 }
 
-Dev fsdevdevtab = {
+Dev fsdevtab = {
 	L'k',
 	"devfs",
 

+ 3 - 0
sys/src/fs/choline/9cholinefs.c

@@ -166,6 +166,9 @@ localconfinit(void)
 	conf.ripoff = 1;
 	conf.nlgmsg = 100;
 	conf.nsmmsg = 500;
+
+	conf.minuteswest = 5*60;
+	conf.dsttime = 1;
 }
 
 int (*fsprotocol[])(Msgbuf*) = {

+ 3 - 0
sys/src/fs/emelie/9pcfs.c

@@ -166,6 +166,9 @@ localconfinit(void)
 	conf.ripoff = 1;
 	conf.nlgmsg = 100;
 	conf.nsmmsg = 500;
+
+	conf.minuteswest = 5*60;
+	conf.dsttime = 1;
 }
 
 int (*fsprotocol[])(Msgbuf*) = {

+ 4 - 1
sys/src/fs/port/9p2.c

@@ -231,7 +231,10 @@ auth(Chan* chan, Fcall* f, Fcall* r)
 	freewp(file->wpath);
 	file->wpath = 0;
 	file->auth = authnew(f->uname, f->aname);
-
+	if(file->auth == nil){
+		error = Eauthfile;
+		goto out;
+	}
 	r->aqid = file->qid;
 	
 out:

+ 8 - 5
sys/src/fs/port/auth.c

@@ -248,14 +248,17 @@ Auth*
 authnew(char *uname, char *aname)
 {
 	static int si = 0;
-	int i;
+	int i, nwrap;
 	Auth *s;
 
-	i = si + 1;
-	if(i < 0 || i >= conf.nauth)
-		i = 0;
-	si = i;
+	i = si;
+	nwrap = 0;
 	for(;;){
+		if(i < 0 || i >= conf.nauth){
+			if(++nwrap > 1)
+				return nil;
+			i = 0;
+		}
 		s = &auths[i++];
 		if(s->inuse)
 			continue;

+ 1 - 0
sys/src/fs/port/data.c

@@ -45,6 +45,7 @@ char	*errstr9p[MAXERR] =
 	[Eversion]	"version conversion",
 	[Eauthnone]	"auth -- user 'none' requires no authentication",
 	[Eauthdisabled]	"auth -- authentication disabled",	/* development */
+	[Eauthfile]	"auth -- out of auth files",
 	[Eedge]		"at the bleeding edge",		/* development */
 };
 

+ 4 - 0
sys/src/fs/port/portdat.h

@@ -493,6 +493,9 @@ struct	Conf
 	uchar	ripoff;
 	uchar	dumpreread;	/* read and compare in dump copy */
 
+	short	minuteswest;	/* minutes west of Greenwich */
+	short	dsttime;	/* dst correction */
+
 	ulong	npage0;		/* total physical pages of memory */
 	ulong	npage1;		/* total physical pages of memory */
 	ulong	base0;		/* base of bank 0 */
@@ -790,6 +793,7 @@ enum
 	Eversion,
 	Eauthdisabled,
 	Eauthnone,
+	Eauthfile,
 	Eedge,
 	MAXERR
 };

+ 2 - 12
sys/src/fs/port/time.c

@@ -192,16 +192,6 @@ static	struct
 	0,	73,	119,	303,
 };
 
-static struct
-{
-	short	minuteswest;	/* minutes west of Greenwich */
-	short	dsttime;	/* dst correction */
-} timezone =
-{
-//	5*60, 1			// East Coast North America time zone
-	8*60, 1			// West Coast North America time zone
-};
-
 static
 prevsunday(Tm *t, int d)
 {
@@ -230,7 +220,7 @@ localtime(ulong tim, Tm *ct)
 	int daylbegin, daylend, dayno, i;
 	ulong copyt;
 
-	copyt = tim - timezone.minuteswest*60L;
+	copyt = tim - conf.minuteswest*60L;
 	gmtime(copyt, ct);
 	dayno = ct->yday;
 	for(i=0;; i++)
@@ -240,7 +230,7 @@ localtime(ulong tim, Tm *ct)
 			daylend = prevsunday(ct, daytab[i].dayle);
 			break;
 		}
-	if(timezone.dsttime &&
+	if(conf.dsttime &&
 	    (dayno>daylbegin || (dayno==daylbegin && ct->hour>=2)) &&
 	    (dayno<daylend || (dayno==daylend && ct->hour<1))) {
 		copyt += 60L*60L;

+ 3 - 0
sys/src/fs/roro/9rorofs.c

@@ -164,6 +164,9 @@ localconfinit(void)
 	conf.firstsb = 0;
 	conf.recovsb = 0;
 	conf.ripoff = 1;
+
+	conf.minuteswest = 5*60;
+	conf.dsttime = 1;
 }
 
 int (*fsprotocol[])(Msgbuf*) = {

+ 3 - 0
sys/src/fs/sony/9sonyfs.c

@@ -166,6 +166,9 @@ localconfinit(void)
 	conf.ripoff = 1;
 	conf.nlgmsg = 100;
 	conf.nsmmsg = 500;
+
+	conf.minuteswest = 5*60;
+	conf.dsttime = 1;
 }
 
 int (*fsprotocol[])(Msgbuf*) = {

+ 3 - 3
sys/src/libc/9sys/dirfstat.c

@@ -16,11 +16,11 @@ dirfstat(int fd)
 
 	nd = DIRSIZE;
 	for(i=0; i<2; i++){	/* should work by the second try */
-		d = malloc(sizeof(Dir) + nd);
+		d = malloc(sizeof(Dir) + BIT16SZ + nd);
 		if(d == nil)
 			return nil;
 		buf = (uchar*)&d[1];
-		n = fstat(fd, buf, nd);
+		n = fstat(fd, buf, BIT16SZ+nd);
 		if(n < BIT16SZ){
 			free(d);
 			return nil;
@@ -30,7 +30,7 @@ dirfstat(int fd)
 			convM2D(buf, n, d, (char*)&d[1]);
 			return d;
 		}
-		/* else sizeof(Dir)+nd is plenty */
+		/* else sizeof(Dir)+BIT16SZ+nd is plenty */
 		free(d);
 	}
 	return nil;

+ 3 - 3
sys/src/libc/9sys/dirstat.c

@@ -16,11 +16,11 @@ dirstat(char *name)
 
 	nd = DIRSIZE;
 	for(i=0; i<2; i++){	/* should work by the second try */
-		d = malloc(sizeof(Dir) + nd);
+		d = malloc(sizeof(Dir) + BIT16SZ + nd);
 		if(d == nil)
 			return nil;
 		buf = (uchar*)&d[1];
-		n = stat(name, buf, nd);
+		n = stat(name, buf, BIT16SZ+nd);
 		if(n < BIT16SZ){
 			free(d);
 			return nil;
@@ -30,7 +30,7 @@ dirstat(char *name)
 			convM2D(buf, n, d, (char*)&d[1]);
 			return d;
 		}
-		/* else sizeof(Dir)+nd is plenty */
+		/* else sizeof(Dir)+BIT16SZ+nd is plenty */
 		free(d);
 	}
 	return nil;