~kris/9p

9hist

f8deea59a575c12e010ab2556dc86f097410bf53 — David du Colombier 26 years ago f8b5d73
Plan 9 from Bell Labs 2000-03-10
2 files changed, 19 insertions(+), 8 deletions(-)

M boot/boot.c
M boot/settime.c
M boot/boot.c => boot/boot.c +16 -5
@@ 39,8 39,10 @@ boot(int argc, char *argv[])
	int fd;
	Method *mp;
	char cmd[64];
	char rootbuf[64];
	char flags[6];
	int islocal, ishybrid;
	char *rp;

	sleep(1000);



@@ 117,13 119,22 @@ boot(int argc, char *argv[])
	 */
	if(bind("/", "/", MREPL) < 0)
		fatal("bind /");
	if(mount(fd, "/root", MREPL|MCREATE, "") < 0)
	rp = getenv("rootspec");
	if(rp == nil)
		rp = "";
	if(mount(fd, "/root", MREPL|MCREATE, rp) < 0)
		fatal("mount /");
	if(bind(rootdir, "/", MAFTER|MCREATE) < 0)
		fatal("bind /");
	rp = getenv("rootdir");
	if(rp == nil)
		rp = rootdir;
	if(strncmp(rp, "/root", 5) != 0){
		snprint(rootbuf, sizeof rootbuf, "/root/%s", rp);
		rp = rootbuf;
	}
	if(bind(rp, "/", MAFTER|MCREATE) < 0)
		fatal("second bind /");
	close(fd);

	setenv("rootdir", rootdir);
	setenv("rootdir", rp);

	/*
	 *  if a local file server exists and it's not

M boot/settime.c => boot/settime.c +3 -3
@@ 41,17 41,17 @@ settime(int islocal)
		f = open(timeserver, ORDWR);
		if(f < 0)
			return;
		if(mount(f, "/n/boot", MREPL, "") < 0){
		if(mount(f, "/mnt", MREPL, "") < 0){
			warning("settime mount");
			close(f);
			return;
		}
		close(f);
		if(stat("/n/boot", dirbuf) < 0)
		if(stat("/mnt", dirbuf) < 0)
			fatal("stat");
		convM2D(dirbuf, &dir);
		sprint(dirbuf, "%ld", dir.atime);
		unmount(0, "/n/boot");
		unmount(0, "/mnt");
	}

	f = open("#c/time", OWRITE);