Browse Source

Plan 9 from Bell Labs 2003-11-05

David du Colombier 20 years ago
parent
commit
a92e31ee7d
6 changed files with 89 additions and 15 deletions
  1. 4 3
      dist/replica/plan9.db
  2. 6 0
      dist/replica/plan9.log
  3. 55 0
      rc/bin/fshalt
  4. 7 7
      sys/src/9/port/devmnt.c
  5. 1 1
      sys/src/9/port/qio.c
  6. 16 4
      sys/src/cmd/cpu.c

+ 4 - 3
dist/replica/plan9.db

@@ -2974,6 +2974,7 @@ rc/bin/dosmnt - 775 sys sys 958526437 285
 rc/bin/eject - 775 sys sys 945617207 123
 rc/bin/fax - 775 sys sys 1015701359 2390
 rc/bin/fedex - 775 sys sys 1060187356 1244
+rc/bin/fshalt - 775 sys sys 1067991211 958
 rc/bin/homespool - 775 sys sys 945617207 339
 rc/bin/ipconf - 20000000775 sys sys 1058791152 0
 rc/bin/ipconf/inside - 775 sys sys 1058790955 427
@@ -5344,7 +5345,7 @@ sys/src/9/port/devenv.c - 664 sys sys 1048644225 6992
 sys/src/9/port/devfs.c - 664 sys sys 1067722764 10760
 sys/src/9/port/devkprof.c - 664 sys sys 1014931173 3111
 sys/src/9/port/devloopback.c - 664 sys sys 1067722759 14670
-sys/src/9/port/devmnt.c - 664 sys sys 1067722762 21601
+sys/src/9/port/devmnt.c - 664 sys sys 1067953214 21594
 sys/src/9/port/devmntstats.c - 664 sys sys 1014931173 4039
 sys/src/9/port/devmouse.c - 664 sys sys 1067722758 12203
 sys/src/9/port/devnmouse.c - 664 sys sys 1036812999 3738
@@ -5394,7 +5395,7 @@ sys/src/9/port/portfns.h - 664 sys sys 1067722759 11369
 sys/src/9/port/portmkfile - 664 sys sys 1067722766 2098
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
 sys/src/9/port/proc.c - 664 sys sys 1067722762 24755
-sys/src/9/port/qio.c - 664 sys sys 1063857200 23407
+sys/src/9/port/qio.c - 664 sys sys 1067953182 23406
 sys/src/9/port/qlock.c - 664 sys sys 1067722765 3196
 sys/src/9/port/rdb.c - 664 sys sys 1018721202 1698
 sys/src/9/port/realtimesub.c - 664 sys sys 1055688540 9185
@@ -7052,7 +7053,7 @@ sys/src/cmd/cpp/mkfile - 664 sys sys 944960879 178
 sys/src/cmd/cpp/nlist.c - 664 sys sys 944960879 4631
 sys/src/cmd/cpp/test.c - 664 sys sys 944960879 47
 sys/src/cmd/cpp/tokens.c - 664 sys sys 944960879 6755
-sys/src/cmd/cpu.c - 664 sys sys 1048644441 20353
+sys/src/cmd/cpu.c - 664 sys sys 1067953662 20525
 sys/src/cmd/crop.c - 664 sys sys 1039753034 4136
 sys/src/cmd/date.c - 664 sys sys 944961351 449
 sys/src/cmd/db - 20000000775 sys sys 988249965 0

+ 6 - 0
dist/replica/plan9.log

@@ -14155,3 +14155,9 @@
 1067880679 0 c sys/src/9/port/devproc.c - 664 sys sys 1067880146 28269
 1067891482 0 c sys/src/9/pc/ether2114x.c - 664 sys sys 1067891102 41253
 1067911286 0 c dist/replica/network - 775 sys sys 1067910574 466
+1067954468 0 c sys/src/9/port/devmnt.c - 664 sys sys 1067953214 21594
+1067954468 1 c sys/src/9/port/qio.c - 664 sys sys 1067953182 23406
+1067954468 2 c sys/src/cmd/cpu.c - 664 sys sys 1067953662 20525
+1067956269 0 a rc/bin/fshalt - 775 sys sys 1067955436 974
+1067959869 0 c rc/bin/fshalt - 775 sys sys 1067958750 898
+1067992260 0 c rc/bin/fshalt - 775 sys sys 1067991211 958

+ 55 - 0
rc/bin/fshalt

@@ -0,0 +1,55 @@
+#!/bin/rc
+# halt - sync (flush) and, if possible, halt all file servers
+rfork e
+path=(/bin)
+builtin cd /
+
+f=`{ls /srv/fscons*>[2]/dev/null}
+k=`{ls /srv/kfs*cmd >[2]/dev/null|sort -r}
+
+echo -n syncing...
+for(i in $f){
+	echo -n $i...
+	{
+		echo fsys all sync
+		if(! dial/expect -qt 120 ': ')
+			echo -n 'not synced...' > /dev/cons
+	} < $f >> $f
+}
+
+echo -n venti...
+venti/sync >[2]/dev/null
+
+for (i in $k){
+	echo -n $i
+	disk/kfscmd -n `{echo $i | sed 's%/srv/kfs.(.*).cmd%\1%'} sync
+	sleep 2
+}
+
+# halting (binaries we run can't be on the fs we're halting)
+ramfs
+builtin cd /tmp
+cp /bin/dial/expect /tmp
+cp /bin/echo /tmp
+cp /bin/disk/kfscmd /tmp
+cp /bin/rc /tmp
+cp /bin/sed /tmp
+bind /tmp /bin
+
+echo
+echo -n halting...
+for(i in $f){
+	echo -n $i...
+	{
+		echo fsys all halt
+		if(! expect -qt 120 ': ')
+			echo -n 'not halted...' > /dev/cons
+	} < $f >> $f
+}
+
+for (i in $k){
+	echo -n $i...
+	kfscmd -n `{echo $i | sed 's%/srv/kfs.(.*).cmd%\1%'} halt
+}
+echo
+echo done

+ 7 - 7
sys/src/9/port/devmnt.c

@@ -20,15 +20,15 @@
 
 struct Mntrpc
 {
-	Chan*	c;			/* Channel for whom we are working */
+	Chan*	c;		/* Channel for whom we are working */
 	Mntrpc*	list;		/* Free/pending list */
 	Fcall	request;	/* Outgoing file system protocol message */
 	Fcall 	reply;		/* Incoming reply */
-	Mnt*	m;			/* Mount device during rpc */
-	Rendez	r;			/* Place to hang out */
+	Mnt*	m;		/* Mount device during rpc */
+	Rendez	r;		/* Place to hang out */
 	uchar*	rpc;		/* I/O Data buffer */
 	uint	rpclen;		/* len of buffer */
-	Block	*b;			/* reply blocks */
+	Block	*b;		/* reply blocks */
 	char	done;		/* Rpc completed */
 	uvlong	stime;		/* start time for mnt statistics */
 	ulong	reqlen;		/* request length for mnt statistics */
@@ -66,15 +66,15 @@ void	mntpntfree(Mnt*);
 void	mntqrm(Mnt*, Mntrpc*);
 Mntrpc*	mntralloc(Chan*, ulong);
 long	mntrdwr(int, Chan*, void*, long, vlong);
-int		mntrpcread(Mnt*, Mntrpc*);
+int	mntrpcread(Mnt*, Mntrpc*);
 void	mountio(Mnt*, Mntrpc*);
 void	mountmux(Mnt*, Mntrpc*);
 void	mountrpc(Mnt*, Mntrpc*);
-int		rpcattn(void*);
+int	rpcattn(void*);
 Chan*	mntchan(void);
 
 char	Esbadstat[] = "invalid directory entry received from server";
-char 	Enoversion[] = "version not established for mount channel";
+char	Enoversion[] = "version not established for mount channel";
 
 
 void (*mntstats)(int, Chan*, uvlong, ulong);

+ 1 - 1
sys/src/9/port/qio.c

@@ -1330,7 +1330,7 @@ qiwrite(Queue *q, void *vp, int len)
 			freeb(b);
 			break;
 		}
-	
+
 		QDEBUG checkb(b, "qiwrite");
 		if(q->bfirst)
 			q->blast->next = b;

+ 16 - 4
sys/src/cmd/cpu.c

@@ -32,6 +32,7 @@ char	*system;
 int	cflag;
 int	dbg;
 char	*user;
+char	*patternfile;
 
 char	*srvname = "ncpu";
 char	*exportfs = "/bin/exportfs";
@@ -69,7 +70,7 @@ int setam(char*);
 void
 usage(void)
 {
-	fprint(2, "usage: cpu [-h system] [-a authmethod] [-e 'crypt hash'] [-k keypattern] [-c cmd args ...]\n");
+	fprint(2, "usage: cpu [-h system] [-a authmethod] [-e 'crypt hash'] [-k keypattern] [-p patternfile] [-c cmd args ...]\n");
 	exits("usage");
 }
 int fdd;
@@ -79,6 +80,8 @@ main(int argc, char **argv)
 {
 	char dat[MaxStr], buf[MaxStr], cmd[MaxStr], *p, *err;
 	int fd, ms, data;
+	char *av[10];
+	int ac;
 
 	/* see if we should use a larger message size */
 	fd = open("/dev/draw", OREAD);
@@ -131,6 +134,9 @@ main(int argc, char **argv)
 	case 'k':
 		keyspec = EARGF(usage());
 		break;
+	case 'p':
+		patternfile = EARGF(usage());
+		break;
 	default:
 		usage();
 	}ARGEND;
@@ -176,10 +182,16 @@ main(int argc, char **argv)
 	dup(data, 0);
 	close(data);
 	sprint(buf, "%d", msgsize);
+	ac = 0;
+	av[ac++] = "-m";
 	if(dbg)
-		execl(exportfs, exportfs, "-dm", buf, 0);
-	else
-		execl(exportfs, exportfs, "-m", buf, 0);
+		av[ac++] = "-d";
+	if(patternfile != nil){
+		av[ac++] = "-p";
+		av[ac++] = patternfile;
+	}
+	av[ac] = 0;
+	exec(exportfs, av);
 	fatal(1, "starting exportfs");
 }