]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/port/initcode.c
Import sources from 2011-03-30 iso image
[plan9front.git] / sys / src / 9 / port / initcode.c
1 /*
2  * IMPORTANT!  DO NOT ADD LIBRARY CALLS TO THIS FILE.
3  * The entire text image must fit on one page
4  * (and there's no data segment, so any read/write data must be on the stack).
5  */
6
7 #include <u.h>
8 #include <libc.h>
9
10 char cons[] = "#c/cons";
11 char boot[] = "/boot/boot";
12 char dev[] = "/dev";
13 char c[] = "#c";
14 char e[] = "#e";
15 char ec[] = "#ec";
16 char s[] = "#s";
17 char srv[] = "/srv";
18 char env[] = "/env";
19
20 void
21 startboot(char *argv0, char **argv)
22 {
23         char buf[200];  /* keep this fairly large to capture error details */
24
25         /* in case boot is a shell script */
26         open(cons, OREAD);
27         open(cons, OWRITE);
28         open(cons, OWRITE);
29         bind(c, dev, MAFTER);
30         bind(ec, env, MAFTER);
31         bind(e, env, MCREATE|MAFTER);
32         bind(s, srv, MREPL|MCREATE);
33
34         exec(boot, argv);
35
36         rerrstr(buf, sizeof buf);
37         buf[sizeof buf - 1] = '\0';
38         _exits(buf);
39 }