Browse Source

Plan 9 from Bell Labs 2002-12-27

David du Colombier 19 years ago
parent
commit
f5815a7089

+ 7 - 7
dist/replica/plan9.db

@@ -104,12 +104,12 @@
 386/bin/aux/ms2 - 775 sys sys 1039758542 84047
 386/bin/aux/mswordstrings - 775 sys sys 1039758542 64268
 386/bin/aux/na - 775 sys sys 1039758542 152747
-386/bin/aux/nfsserver - 775 sys sys 1039758542 171424
+386/bin/aux/nfsserver - 775 sys sys 1040969002 171040
 386/bin/aux/olefs - 775 sys sys 1039758543 142400
 386/bin/aux/p9bitpost - 775 sys sys 1039758543 127979
 386/bin/aux/pcmcia - 775 sys sys 1039758543 46790
-386/bin/aux/pcnfsd - 775 sys sys 1039758543 127219
-386/bin/aux/portmapper - 775 sys sys 1039758544 126116
+386/bin/aux/pcnfsd - 775 sys sys 1040969003 126744
+386/bin/aux/portmapper - 775 sys sys 1040969003 125632
 386/bin/aux/postgif - 775 sys sys 1038443100 177440
 386/bin/aux/postprint - 775 sys sys 1038443101 161939
 386/bin/aux/postreverse - 775 sys sys 1038443101 167452
@@ -6318,17 +6318,17 @@ sys/src/cmd/9nfs/nametest.c - 664 sys sys 1015090372 1723
 sys/src/cmd/9nfs/nfs.c - 664 sys sys 1017337814 9508
 sys/src/cmd/9nfs/nfs.h - 664 sys sys 1015090372 642
 sys/src/cmd/9nfs/nfsmount.c - 664 sys sys 1034737122 6538
-sys/src/cmd/9nfs/nfsserver.c - 664 sys sys 1034458291 15508
+sys/src/cmd/9nfs/nfsserver.c - 664 sys sys 1040952455 15576
 sys/src/cmd/9nfs/pcnfsd.c - 664 sys sys 1017337815 3964
-sys/src/cmd/9nfs/portmapper.c - 664 sys sys 1017337815 3140
+sys/src/cmd/9nfs/portmapper.c - 664 sys sys 1040952456 3179
 sys/src/cmd/9nfs/rpc.c - 664 sys sys 1017337815 5293
 sys/src/cmd/9nfs/rpc.h - 664 sys sys 1017337815 1996
-sys/src/cmd/9nfs/server.c - 664 sys sys 1017337815 11025
+sys/src/cmd/9nfs/server.c - 664 sys sys 1040952456 11027
 sys/src/cmd/9nfs/string.c - 664 sys sys 1017337815 1659
 sys/src/cmd/9nfs/strparse.c - 664 sys sys 1015090373 506
 sys/src/cmd/9nfs/system.c - 664 sys sys 1017337815 437
 sys/src/cmd/9nfs/testit - 775 sys sys 1017337816 251
-sys/src/cmd/9nfs/unixnames.c - 664 sys sys 1017337816 5963
+sys/src/cmd/9nfs/unixnames.c - 664 sys sys 1040952457 5974
 sys/src/cmd/9nfs/xfile.c - 664 sys sys 1017337816 1847
 sys/src/cmd/aan.c - 664 sys sys 1019856827 9758
 sys/src/cmd/acid - 20000000775 sys sys 944960739 0

+ 7 - 0
dist/replica/plan9.log

@@ -16823,3 +16823,10 @@
 1040698912 0 c rc/bin/man - 775 sys sys 1040698721 2088
 1040698912 1 c sys/man/8/boot - 664 sys sys 1040698789 6482
 1040698912 2 c sys/man/8/plan9.ini - 664 sys sys 1040698791 20588
+1040952686 0 c sys/src/cmd/9nfs/nfsserver.c - 664 sys sys 1040952455 15576
+1040952686 1 c sys/src/cmd/9nfs/portmapper.c - 664 sys sys 1040952456 3179
+1040952686 2 c sys/src/cmd/9nfs/server.c - 664 sys sys 1040952456 11027
+1040952686 3 c sys/src/cmd/9nfs/unixnames.c - 664 sys sys 1040952457 5974
+1040970707 0 c 386/bin/aux/nfsserver - 775 sys sys 1040969002 171040
+1040970707 1 c 386/bin/aux/pcnfsd - 775 sys sys 1040969003 126744
+1040970707 2 c 386/bin/aux/portmapper - 775 sys sys 1040969003 125632

+ 9 - 10
sys/src/cmd/9nfs/nfsserver.c

@@ -70,11 +70,10 @@ doalarm(void)
 {
 	nfstime = time(0);
 	mnttimer(nfstime);
-	if(++conftime >= 360){
-		conftime = 0;
+	if(conftime+5*60 < nfstime){
+		conftime = nfstime;
 		readunixidmaps(config);
 	}
-	alarm(10000);
 }
 
 void
@@ -84,7 +83,6 @@ nfsinit(int argc, char **argv)
 	clog("nfs file server init\n");
 	rpcalarm = doalarm;
 	nfstime = time(0);
-	alarm(10000);
 }
 
 static int
@@ -121,7 +119,7 @@ static int
 nfssetattr(int n, Rpccall *cmd, Rpccall *reply)
 {
 	Xfid *xf;
-	Dir dir;
+	Dir dir, nd;
 	Sattr sattr;
 	int r;
 	uchar *argptr = cmd->args;
@@ -151,15 +149,16 @@ nfssetattr(int n, Rpccall *cmd, Rpccall *reply)
 	}else if(sattr.size != NOATTR)
 		return error(reply, NFSERR_PERM);
 	r = 0;
-	nulldir(&dir);
+	nulldir(&nd);
 	if(sattr.mode != NOATTR)
-		++r, dir.mode = (dir.mode & ~0777) | (sattr.mode & 0777);
+		++r, nd.mode = (dir.mode & ~0777) | (sattr.mode & 0777);
 	if(sattr.atime != NOATTR)
-		++r, dir.atime = sattr.atime;
+		++r, nd.atime = sattr.atime;
 	if(sattr.mtime != NOATTR)
-		++r, dir.mtime = sattr.mtime;
+		++r, nd.mtime = sattr.mtime;
+	chat("sattr.mode=%luo dir.mode=%luo nd.mode=%luo...", sattr.mode, dir.mode, nd.mode);
 	if(r){
-		r = xfwstat(xf, &dir);
+		r = xfwstat(xf, &nd);
 		if(r < 0)
 			return error(reply, NFSERR_PERM);
 	}

+ 3 - 2
sys/src/cmd/9nfs/portmapper.c

@@ -11,8 +11,9 @@ struct Portmap
 };
 
 Portmap map[] = {
-	100005, 1, IPPROTO_UDP, 2049,	/* mount */
 	100003, 2, IPPROTO_UDP, 2049,	/* nfs */
+//	100003, 3, IPPROTO_UDP, 2049,	/* nfs */
+	100005, 1, IPPROTO_UDP, 2049,	/* mount */
 	150001, 2, IPPROTO_UDP, 1111,	/* pcnfsd v2 */
 	150001, 1, IPPROTO_UDP, 1111,	/* pcnfsd v1 */
 	0, 0, 0, 0,
@@ -96,7 +97,7 @@ pmapgetport(int n, Rpccall *cmd, Rpccall *reply)
 	uchar *dataptr = reply->results;
 	Portmap *mp;
 
-fprint(2, "get port\n");
+	clog("get port\n");
 
 	if(n != 16)
 		return garbage(reply, "bad count");

+ 17 - 17
sys/src/cmd/9nfs/server.c

@@ -6,7 +6,6 @@ static int	alarmflag;
 
 static int	Iconv(Fmt*);
 static void	openudp(int);
-static int	rcvalarm(void*, char*);
 static void	cachereply(Rpccall*, void*, int);
 static int	replycache(int, Rpccall*, long (*)(int, void*, long));
 static void	udpserver(int, Progmap*);
@@ -66,7 +65,17 @@ server(int argc, char **argv, int myport, Progmap *progmap)
 		tcp = 1;
 		break;
 	}ARGEND
-	atnotify(rcvalarm, 1);
+
+	switch(rfork(RFMEM|RFPROC)){
+	case 0:
+		for(;;){
+			sleep(30*1000);
+			alarmflag = 1;
+		}
+	case -1:
+		sysfatal("rfork: %r");
+	}
+
 	for(pg=progmap; pg->init; pg++)
 		(*pg->init)(Argc, Argv);
 	if(tcp)
@@ -75,17 +84,6 @@ server(int argc, char **argv, int myport, Progmap *progmap)
 		udpserver(myport, progmap);
 }
 
-static int
-rcvalarm(void *ureg, char *msg)
-{
-	USED(ureg);
-	if(strcmp(msg, "alarm") == 0){
-		++alarmflag;
-		return 1;
-	}
-	return 0;
-}
-
 static void
 udpserver(int myport, Progmap *progmap)
 {
@@ -393,12 +391,12 @@ writetcp(int fd, void *vbuf, long len)
 long
 niwrite(int fd, void *buf, long n)
 {
-	int savalarm;
+//	int savalarm;
 
-	savalarm = alarm(0);
+// 	savalarm = alarm(0);
 	n = write(fd, buf, n);
-	if(savalarm > 0)
-		alarm(savalarm);
+// 	if(savalarm > 0)
+//		alarm(savalarm);
 	return n;
 }
 
@@ -487,9 +485,11 @@ getdnsdom(ulong ip, char *name, int len)
 	clog("getdnsdom: %I\n", ip);
 	snprint(buf, sizeof buf, "%I", ip);
 	t = csgetval("/net", "ip", buf, "dom", dom);
+clog("csgetval %p\n", t);
 	if(t == nil)
 		return -1;
 	ndbfree(t);
+clog("csgetval %s\n", dom);
 	strncpy(name, dom, len-1);
 	name[len] = 0;
 	addcacheentry(name, strlen(name), ip);

+ 4 - 4
sys/src/cmd/9nfs/unixnames.c

@@ -81,13 +81,13 @@ readunixidmaps(char *file)
 	Unixidmap *m;
 	int i, arc; char *arv[16], buf[256];
 	char *l;
-	long savalarm;
+// 	long savalarm;
 
-	savalarm = alarm(0);
+// 	savalarm = alarm(0);
 	in = Bopen(file, OREAD);
 	if(in == 0){
 		clog("readunixidmaps can't open %s: %r\n", file);
-		alarm(savalarm);
+//		alarm(savalarm);
 		return -1;
 	}
 	for(m=idhead; m; m=m->next)
@@ -166,7 +166,7 @@ readunixidmaps(char *file)
 			uxfree(m->g.ids);
 			m->g.ids = 0;
 		}
-	alarm(savalarm);
+// 	alarm(savalarm);
 	return 0;
 }