~kris/9p

9hist

ref: 59800ad5dede4ebcf460e7404f7e55f8038008f8 9hist/boot/sac.c -rw-r--r-- 802 bytes
59800ad5 — David du Colombier Plan 9 from Bell Labs 2002-08-17 24 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <u.h>
#include <libc.h>
#include <../boot/boot.h>

// HACK - take over from boot since file system is not
// available on a pipe

void
configsac(Method *mp)
{
	int fd;
	char cmd[64];

	USED(mp);

	/*
	 *  create the name space, mount the root fs
	 */
	if(bind("/", "/", MREPL) < 0)
		fatal("bind /");
	if(bind("#C", "/", MAFTER) < 0)
		fatal("bind /");

	// fixed sysname - enables correct namespace file
	fd = open("#c/sysname", OWRITE);
	if(fd < 0)
		fatal("open sysname");
	write(fd, "brick", 5);
	close(fd);

	fd = open("#c/hostowner", OWRITE);
	if(fd < 0)
		fatal("open sysname");
	write(fd, "brick", 5);
	close(fd);

	sprint(cmd, "/%s/init", cputype);
	print("starting %s\n", cmd);
	execl(cmd, "init", "-c", 0);
	fatal(cmd);
}

int
connectsac(void)
{
	// does not get here
	return -1;
}